Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
e5b5b95c
Commit
e5b5b95c
authored
Jul 16, 2019
by
Pierre TILAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compass - Add indicator of next WP Heading
parent
6a7a15c8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
2 deletions
+109
-2
qgcimages.qrc
qgcimages.qrc
+1
-0
compassDottedLine.svg
src/FlightMap/Images/compassDottedLine.svg
+50
-0
QGCCompassWidget.qml
src/FlightMap/Widgets/QGCCompassWidget.qml
+21
-2
Vehicle.cc
src/Vehicle/Vehicle.cc
+24
-0
Vehicle.h
src/Vehicle/Vehicle.h
+6
-0
VehicleFact.json
src/Vehicle/VehicleFact.json
+7
-0
No files found.
qgcimages.qrc
View file @
e5b5b95c
...
...
@@ -69,6 +69,7 @@
<file alias="CogWheel.svg">src/MissionManager/CogWheel.svg</file>
<file alias="compassInstrumentArrow.svg">src/FlightMap/Images/compassInstrumentArrow.svg</file>
<file alias="compassInstrumentDial.svg">src/FlightMap/Images/compassInstrumentDial.svg</file>
<file alias="compassDottedLine.svg">src/FlightMap/Images/compassDottedLine.svg</file>
<file alias="cOGPointer.svg">src/FlightMap/Images/cOGPointer.svg</file>
<file alias="Connect.svg">src/ui/toolbar/Images/Connect.svg</file>
<file alias="crossHair.svg">src/FlightMap/Images/crossHair.svg</file>
...
...
src/FlightMap/Images/compassDottedLine.svg
0 → 100644
View file @
e5b5b95c
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc=
"http://purl.org/dc/elements/1.1/"
xmlns:cc=
"http://creativecommons.org/ns#"
xmlns:rdf=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg=
"http://www.w3.org/2000/svg"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:sodipodi=
"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape=
"http://www.inkscape.org/namespaces/inkscape"
version=
"1.1"
id=
"Layer_2"
x=
"0px"
y=
"0px"
viewBox=
"-161 253 288 288"
enable-background=
"new -161 253 288 288"
xml:space=
"preserve"
inkscape:version=
"0.91 r13725"
sodipodi:docname=
"compassDottedLine.svg"
><metadata
id=
"metadata131"
><rdf:RDF><cc:Work
rdf:about=
""
><dc:format>
image/svg+xml
</dc:format><dc:type
rdf:resource=
"http://purl.org/dc/dcmitype/StillImage"
/></cc:Work></rdf:RDF></metadata><defs
id=
"defs129"
/><sodipodi:namedview
pagecolor=
"#ffffff"
bordercolor=
"#666666"
borderopacity=
"1"
objecttolerance=
"10"
gridtolerance=
"10"
guidetolerance=
"10"
inkscape:pageopacity=
"0"
inkscape:pageshadow=
"2"
inkscape:window-width=
"1855"
inkscape:window-height=
"1056"
id=
"namedview127"
showgrid=
"false"
inkscape:zoom=
"3.2777778"
inkscape:cx=
"59.669563"
inkscape:cy=
"175.88441"
inkscape:window-x=
"1985"
inkscape:window-y=
"24"
inkscape:window-maximized=
"1"
inkscape:current-layer=
"Layer_2"
inkscape:snap-bbox=
"true"
inkscape:snap-object-midpoints=
"true"
inkscape:snap-center=
"true"
/><path
style=
"fill:#ffff00;fill-rule:evenodd;stroke:#ffe400;stroke-width:3.805;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:7;stroke-dasharray:11.415,3.805;stroke-opacity:1;stroke-dashoffset:0"
d=
"m -17.052985,397 0.10597,-112.28426"
id=
"path4263"
inkscape:connector-curvature=
"0"
/></svg>
\ No newline at end of file
src/FlightMap/Widgets/QGCCompassWidget.qml
View file @
e5b5b95c
...
...
@@ -36,7 +36,8 @@ Item {
property
int
_fontSize
:
ScreenTools
.
defaultFontPointSize
*
_sizeRatio
property
real
_heading
:
vehicle
?
vehicle
.
heading
.
rawValue
:
0
property
real
_headingToHome
:
vehicle
?
vehicle
.
headingToHome
.
rawValue
:
0
property
real
_groundSpeed
:
vehicle
?
vehicle
.
groundSpeed
.
rawValue
:
0
property
real
_groundSpeed
:
vehicle
?
vehicle
.
groundSpeed
.
rawValue
:
0
property
real
_headingToNextWP
:
vehicle
?
vehicle
.
headingToNextWP
.
rawValue
:
0
property
real
_courseOverGround
:
activeVehicle
?
activeVehicle
.
gps
.
courseOverGround
.
rawValue
:
0
function
isCOGAngleOK
(){
...
...
@@ -52,12 +53,15 @@ Item {
return
_showHomeHeadingCompass
&&
!
isNaN
(
_headingToHome
)
}
function
isHeadingToNextWPOK
(){
return
!
isNaN
(
_headingToNextWP
)
}
readonly
property
bool
_showHomeHeadingCompass
:
QGroundControl
.
settingsManager
.
flyViewSettings
.
showHomeHeadingCompass
.
value
readonly
property
bool
_showCOGAngleCompass
:
QGroundControl
.
settingsManager
.
flyViewSettings
.
showCOGAngleCompass
.
value
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
Rectangle
{
id
:
borderRect
anchors.fill
:
parent
...
...
@@ -72,6 +76,21 @@ Item {
anchors.fill
:
parent
visible
:
false
Image
{
id
:
nextWPPointer
source
:
isHeadingToNextWPOK
()
?
"
/qmlimages/compassDottedLine.svg
"
:
""
mipmap
:
true
fillMode
:
Image
.
PreserveAspectFit
anchors.fill
:
parent
sourceSize.height
:
parent
.
height
transform
:
Rotation
{
origin.x
:
cOGPointer
.
width
/
2
origin.y
:
cOGPointer
.
height
/
2
angle
:
_headingToNextWP
-
_heading
}
}
Image
{
id
:
cOGPointer
source
:
isCOGAngleOK
()
?
"
/qmlimages/cOGPointer.svg
"
:
""
...
...
src/Vehicle/Vehicle.cc
View file @
e5b5b95c
...
...
@@ -71,6 +71,7 @@ const char* Vehicle::_altitudeAMSLFactName = "altitudeAMSL";
const
char
*
Vehicle
::
_flightDistanceFactName
=
"flightDistance"
;
const
char
*
Vehicle
::
_flightTimeFactName
=
"flightTime"
;
const
char
*
Vehicle
::
_distanceToHomeFactName
=
"distanceToHome"
;
const
char
*
Vehicle
::
_headingToNextWPFactName
=
"headingToNextWP"
;
const
char
*
Vehicle
::
_headingToHomeFactName
=
"headingToHome"
;
const
char
*
Vehicle
::
_distanceToGCSFactName
=
"distanceToGCS"
;
const
char
*
Vehicle
::
_hobbsFactName
=
"hobbs"
;
...
...
@@ -202,6 +203,7 @@ Vehicle::Vehicle(LinkInterface* link,
,
_flightDistanceFact
(
0
,
_flightDistanceFactName
,
FactMetaData
::
valueTypeDouble
)
,
_flightTimeFact
(
0
,
_flightTimeFactName
,
FactMetaData
::
valueTypeElapsedTimeInSeconds
)
,
_distanceToHomeFact
(
0
,
_distanceToHomeFactName
,
FactMetaData
::
valueTypeDouble
)
,
_headingToNextWPFact
(
0
,
_headingToNextWPFactName
,
FactMetaData
::
valueTypeDouble
)
,
_headingToHomeFact
(
0
,
_headingToHomeFactName
,
FactMetaData
::
valueTypeDouble
)
,
_distanceToGCSFact
(
0
,
_distanceToGCSFactName
,
FactMetaData
::
valueTypeDouble
)
,
_hobbsFact
(
0
,
_hobbsFactName
,
FactMetaData
::
valueTypeString
)
...
...
@@ -404,6 +406,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
,
_flightDistanceFact
(
0
,
_flightDistanceFactName
,
FactMetaData
::
valueTypeDouble
)
,
_flightTimeFact
(
0
,
_flightTimeFactName
,
FactMetaData
::
valueTypeElapsedTimeInSeconds
)
,
_distanceToHomeFact
(
0
,
_distanceToHomeFactName
,
FactMetaData
::
valueTypeDouble
)
,
_headingToNextWPFact
(
0
,
_headingToNextWPFactName
,
FactMetaData
::
valueTypeDouble
)
,
_headingToHomeFact
(
0
,
_headingToHomeFactName
,
FactMetaData
::
valueTypeDouble
)
,
_distanceToGCSFact
(
0
,
_distanceToGCSFactName
,
FactMetaData
::
valueTypeDouble
)
,
_hobbsFact
(
0
,
_hobbsFactName
,
FactMetaData
::
valueTypeString
)
...
...
@@ -438,6 +441,7 @@ void Vehicle::_commonInit(void)
connect
(
this
,
&
Vehicle
::
homePositionChanged
,
this
,
&
Vehicle
::
_updateDistanceHeadingToHome
);
connect
(
this
,
&
Vehicle
::
hobbsMeterChanged
,
this
,
&
Vehicle
::
_updateHobbsMeter
);
connect
(
_toolbox
->
qgcPositionManager
(),
&
QGCPositionManager
::
gcsPositionChanged
,
this
,
&
Vehicle
::
_updateDistanceToGCS
);
_missionManager
=
new
MissionManager
(
this
);
...
...
@@ -447,6 +451,7 @@ void Vehicle::_commonInit(void)
connect
(
_missionManager
,
&
MissionManager
::
newMissionItemsAvailable
,
this
,
&
Vehicle
::
_clearTrajectoryPoints
);
connect
(
_missionManager
,
&
MissionManager
::
sendComplete
,
this
,
&
Vehicle
::
_clearCameraTriggerPoints
);
connect
(
_missionManager
,
&
MissionManager
::
sendComplete
,
this
,
&
Vehicle
::
_clearTrajectoryPoints
);
connect
(
_missionManager
,
&
MissionManager
::
currentIndexChanged
,
this
,
&
Vehicle
::
_updateHeadingToNextWP
);
_parameterManager
=
new
ParameterManager
(
this
);
connect
(
_parameterManager
,
&
ParameterManager
::
parametersReadyChanged
,
this
,
&
Vehicle
::
_parametersReady
);
...
...
@@ -3790,6 +3795,25 @@ void Vehicle::_updateDistanceHeadingToHome(void)
}
}
void
Vehicle
::
_updateHeadingToNextWP
(
void
)
{
const
int
_currentIndex
=
_missionManager
->
currentIndex
();
MissionItem
_currentItem
;
QList
<
MissionItem
*>
llist
=
_missionManager
->
missionItems
();
if
(
llist
.
size
()
>
_currentIndex
&&
_currentIndex
!=-
1
&&
llist
[
_currentIndex
]
->
coordinate
().
longitude
()
!=
0.0
&&
coordinate
().
distanceTo
(
llist
[
_currentIndex
]
->
coordinate
())
>
5.0
){
_headingToNextWPFact
.
setRawValue
(
coordinate
().
azimuthTo
(
llist
[
_currentIndex
]
->
coordinate
()));
}
else
{
_headingToNextWPFact
.
setRawValue
(
qQNaN
());
}
qDebug
()
<<
" Vehicle updateHeadingToNextWP "
<<
_currentIndex
;
}
void
Vehicle
::
_updateDistanceToGCS
(
void
)
{
QGeoCoordinate
gcsPosition
=
_toolbox
->
qgcPositionManager
()
->
gcsPosition
();
...
...
src/Vehicle/Vehicle.h
View file @
e5b5b95c
...
...
@@ -669,6 +669,7 @@ public:
Q_PROPERTY
(
Fact
*
altitudeAMSL
READ
altitudeAMSL
CONSTANT
)
Q_PROPERTY
(
Fact
*
flightDistance
READ
flightDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
distanceToHome
READ
distanceToHome
CONSTANT
)
Q_PROPERTY
(
Fact
*
headingToNextWP
READ
headingToNextWP
CONSTANT
)
Q_PROPERTY
(
Fact
*
headingToHome
READ
headingToHome
CONSTANT
)
Q_PROPERTY
(
Fact
*
distanceToGCS
READ
distanceToGCS
CONSTANT
)
Q_PROPERTY
(
Fact
*
hobbs
READ
hobbs
CONSTANT
)
...
...
@@ -971,6 +972,7 @@ public:
Fact
*
altitudeAMSL
(
void
)
{
return
&
_altitudeAMSLFact
;
}
Fact
*
flightDistance
(
void
)
{
return
&
_flightDistanceFact
;
}
Fact
*
distanceToHome
(
void
)
{
return
&
_distanceToHomeFact
;
}
Fact
*
headingToNextWP
(
void
)
{
return
&
_headingToNextWPFact
;
}
Fact
*
headingToHome
(
void
)
{
return
&
_headingToHomeFact
;
}
Fact
*
distanceToGCS
(
void
)
{
return
&
_distanceToGCSFact
;
}
Fact
*
hobbs
(
void
)
{
return
&
_hobbsFact
;
}
...
...
@@ -1243,6 +1245,7 @@ private slots:
void
_clearTrajectoryPoints
(
void
);
void
_clearCameraTriggerPoints
(
void
);
void
_updateDistanceHeadingToHome
(
void
);
void
_updateHeadingToNextWP
(
void
);
void
_updateDistanceToGCS
(
void
);
void
_updateHobbsMeter
(
void
);
void
_vehicleParamLoaded
(
bool
ready
);
...
...
@@ -1535,7 +1538,9 @@ private:
Fact
_flightDistanceFact
;
Fact
_flightTimeFact
;
Fact
_distanceToHomeFact
;
Fact
_headingToNextWPFact
;
Fact
_headingToHomeFact
;
Fact
_headingToNextWP
;
Fact
_distanceToGCSFact
;
Fact
_hobbsFact
;
Fact
_throttlePctFact
;
...
...
@@ -1565,6 +1570,7 @@ private:
static
const
char
*
_flightDistanceFactName
;
static
const
char
*
_flightTimeFactName
;
static
const
char
*
_distanceToHomeFactName
;
static
const
char
*
_headingToNextWPFactName
;
static
const
char
*
_headingToHomeFactName
;
static
const
char
*
_distanceToGCSFactName
;
static
const
char
*
_hobbsFactName
;
...
...
src/Vehicle/VehicleFact.json
View file @
e5b5b95c
...
...
@@ -104,6 +104,13 @@
"decimalPlaces"
:
1
,
"units"
:
"m"
},
{
"name"
:
"headingToNextWP"
,
"shortDescription"
:
"Heading to Next Waypoint"
,
"type"
:
"double"
,
"decimalPlaces"
:
0
,
"units"
:
"deg"
},
{
"name"
:
"flightTime"
,
"shortDescription"
:
"Flight Time"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment