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
9f8d1b52
Unverified
Commit
9f8d1b52
authored
Mar 29, 2020
by
Don Gagne
Committed by
GitHub
Mar 29, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8577 from dakejahl/pr-qgc-wp_index_values_widget
WP index to the values widget
parents
f0af152d
79d36515
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
Vehicle.cc
src/Vehicle/Vehicle.cc
+22
-6
Vehicle.h
src/Vehicle/Vehicle.h
+5
-0
VehicleFact.json
src/Vehicle/VehicleFact.json
+5
-0
No files found.
src/Vehicle/Vehicle.cc
View file @
9f8d1b52
...
...
@@ -76,6 +76,7 @@ const char* Vehicle::_altitudeAMSLFactName = "altitudeAMSL";
const
char
*
Vehicle
::
_flightDistanceFactName
=
"flightDistance"
;
const
char
*
Vehicle
::
_flightTimeFactName
=
"flightTime"
;
const
char
*
Vehicle
::
_distanceToHomeFactName
=
"distanceToHome"
;
const
char
*
Vehicle
::
_missionItemIndexFactName
=
"missionItemIndex"
;
const
char
*
Vehicle
::
_headingToNextWPFactName
=
"headingToNextWP"
;
const
char
*
Vehicle
::
_headingToHomeFactName
=
"headingToHome"
;
const
char
*
Vehicle
::
_distanceToGCSFactName
=
"distanceToGCS"
;
...
...
@@ -205,6 +206,7 @@ Vehicle::Vehicle(LinkInterface* link,
,
_flightDistanceFact
(
0
,
_flightDistanceFactName
,
FactMetaData
::
valueTypeDouble
)
,
_flightTimeFact
(
0
,
_flightTimeFactName
,
FactMetaData
::
valueTypeElapsedTimeInSeconds
)
,
_distanceToHomeFact
(
0
,
_distanceToHomeFactName
,
FactMetaData
::
valueTypeDouble
)
,
_missionItemIndexFact
(
0
,
_missionItemIndexFactName
,
FactMetaData
::
valueTypeUint16
)
,
_headingToNextWPFact
(
0
,
_headingToNextWPFactName
,
FactMetaData
::
valueTypeDouble
)
,
_headingToHomeFact
(
0
,
_headingToHomeFactName
,
FactMetaData
::
valueTypeDouble
)
,
_distanceToGCSFact
(
0
,
_distanceToGCSFactName
,
FactMetaData
::
valueTypeDouble
)
...
...
@@ -413,6 +415,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
,
_flightTimeFact
(
0
,
_flightTimeFactName
,
FactMetaData
::
valueTypeElapsedTimeInSeconds
)
,
_distanceToHomeFact
(
0
,
_distanceToHomeFactName
,
FactMetaData
::
valueTypeDouble
)
,
_headingToNextWPFact
(
0
,
_headingToNextWPFactName
,
FactMetaData
::
valueTypeDouble
)
,
_missionItemIndexFact
(
0
,
_missionItemIndexFactName
,
FactMetaData
::
valueTypeUint16
)
,
_headingToHomeFact
(
0
,
_headingToHomeFactName
,
FactMetaData
::
valueTypeDouble
)
,
_distanceToGCSFact
(
0
,
_distanceToGCSFactName
,
FactMetaData
::
valueTypeDouble
)
,
_hobbsFact
(
0
,
_hobbsFactName
,
FactMetaData
::
valueTypeString
)
...
...
@@ -458,6 +461,7 @@ void Vehicle::_commonInit()
connect
(
_missionManager
,
&
MissionManager
::
newMissionItemsAvailable
,
this
,
&
Vehicle
::
_clearCameraTriggerPoints
);
connect
(
_missionManager
,
&
MissionManager
::
sendComplete
,
this
,
&
Vehicle
::
_clearCameraTriggerPoints
);
connect
(
_missionManager
,
&
MissionManager
::
currentIndexChanged
,
this
,
&
Vehicle
::
_updateHeadingToNextWP
);
connect
(
_missionManager
,
&
MissionManager
::
currentIndexChanged
,
this
,
&
Vehicle
::
_updateMissionItemIndex
);
connect
(
_missionManager
,
&
MissionManager
::
sendComplete
,
_trajectoryPoints
,
&
TrajectoryPoints
::
clear
);
connect
(
_missionManager
,
&
MissionManager
::
newMissionItemsAvailable
,
_trajectoryPoints
,
&
TrajectoryPoints
::
clear
);
...
...
@@ -495,6 +499,7 @@ void Vehicle::_commonInit()
_addFact
(
&
_flightDistanceFact
,
_flightDistanceFactName
);
_addFact
(
&
_flightTimeFact
,
_flightTimeFactName
);
_addFact
(
&
_distanceToHomeFact
,
_distanceToHomeFactName
);
_addFact
(
&
_missionItemIndexFact
,
_missionItemIndexFactName
);
_addFact
(
&
_headingToNextWPFact
,
_headingToNextWPFactName
);
_addFact
(
&
_headingToHomeFact
,
_headingToHomeFactName
);
_addFact
(
&
_distanceToGCSFact
,
_distanceToGCSFactName
);
...
...
@@ -3982,21 +3987,32 @@ void Vehicle::_updateDistanceHeadingToHome()
void
Vehicle
::
_updateHeadingToNextWP
()
{
const
int
_currentIndex
=
_missionManager
->
currentIndex
();
MissionItem
_currentItem
;
const
int
currentIndex
=
_missionManager
->
currentIndex
();
QList
<
MissionItem
*>
llist
=
_missionManager
->
missionItems
();
if
(
llist
.
size
()
>
_currentIndex
&&
_
currentIndex
!=-
1
&&
llist
[
_
currentIndex
]
->
coordinate
().
longitude
()
!=
0.0
&&
coordinate
().
distanceTo
(
llist
[
_
currentIndex
]
->
coordinate
())
>
5.0
){
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
()));
_headingToNextWPFact
.
setRawValue
(
coordinate
().
azimuthTo
(
llist
[
currentIndex
]
->
coordinate
()));
}
else
{
_headingToNextWPFact
.
setRawValue
(
qQNaN
());
}
}
void
Vehicle
::
_updateMissionItemIndex
()
{
const
int
currentIndex
=
_missionManager
->
currentIndex
();
unsigned
offset
=
0
;
if
(
!
_firmwarePlugin
->
sendHomePositionToVehicle
())
{
offset
=
1
;
}
_missionItemIndexFact
.
setRawValue
(
currentIndex
+
offset
);
}
void
Vehicle
::
_updateDistanceToGCS
()
{
QGeoCoordinate
gcsPosition
=
_toolbox
->
qgcPositionManager
()
->
gcsPosition
();
...
...
src/Vehicle/Vehicle.h
View file @
9f8d1b52
...
...
@@ -670,6 +670,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
*
missionItemIndex
READ
missionItemIndex
CONSTANT
)
Q_PROPERTY
(
Fact
*
headingToNextWP
READ
headingToNextWP
CONSTANT
)
Q_PROPERTY
(
Fact
*
headingToHome
READ
headingToHome
CONSTANT
)
Q_PROPERTY
(
Fact
*
distanceToGCS
READ
distanceToGCS
CONSTANT
)
...
...
@@ -981,6 +982,7 @@ public:
Fact
*
altitudeAMSL
()
{
return
&
_altitudeAMSLFact
;
}
Fact
*
flightDistance
()
{
return
&
_flightDistanceFact
;
}
Fact
*
distanceToHome
()
{
return
&
_distanceToHomeFact
;
}
Fact
*
missionItemIndex
()
{
return
&
_missionItemIndexFact
;
}
Fact
*
headingToNextWP
()
{
return
&
_headingToNextWPFact
;
}
Fact
*
headingToHome
()
{
return
&
_headingToHomeFact
;
}
Fact
*
distanceToGCS
()
{
return
&
_distanceToGCSFact
;
}
...
...
@@ -1259,6 +1261,7 @@ private slots:
void
_sendMavCommandAgain
();
void
_clearCameraTriggerPoints
();
void
_updateDistanceHeadingToHome
();
void
_updateMissionItemIndex
();
void
_updateHeadingToNextWP
();
void
_updateDistanceToGCS
();
void
_updateHobbsMeter
();
...
...
@@ -1570,6 +1573,7 @@ private:
Fact
_flightDistanceFact
;
Fact
_flightTimeFact
;
Fact
_distanceToHomeFact
;
Fact
_missionItemIndexFact
;
Fact
_headingToNextWPFact
;
Fact
_headingToHomeFact
;
Fact
_distanceToGCSFact
;
...
...
@@ -1604,6 +1608,7 @@ private:
static
const
char
*
_flightDistanceFactName
;
static
const
char
*
_flightTimeFactName
;
static
const
char
*
_distanceToHomeFactName
;
static
const
char
*
_missionItemIndexFactName
;
static
const
char
*
_headingToNextWPFactName
;
static
const
char
*
_headingToHomeFactName
;
static
const
char
*
_distanceToGCSFactName
;
...
...
src/Vehicle/VehicleFact.json
View file @
9f8d1b52
...
...
@@ -104,6 +104,11 @@
"decimalPlaces"
:
1
,
"units"
:
"m"
},
{
"name"
:
"missionItemIndex"
,
"shortDescription"
:
"Mission Item Index"
,
"type"
:
"uint16"
},
{
"name"
:
"headingToNextWP"
,
"shortDescription"
:
"Next WP Heading"
,
...
...
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