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
c7e2fa5c
Commit
c7e2fa5c
authored
Jul 02, 2020
by
Patrick José Pereira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vehicle: Add handle for HIGH_LATENCY
Signed-off-by:
Patrick José Pereira
<
patrickelectric@gmail.com
>
parent
d37c41b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+60
-0
Vehicle.h
src/Vehicle/Vehicle.h
+1
-0
No files found.
src/Vehicle/Vehicle.cc
View file @
c7e2fa5c
...
...
@@ -801,6 +801,9 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
case
MAVLINK_MSG_ID_ADSB_VEHICLE
:
_handleADSBVehicle
(
message
);
break
;
case
MAVLINK_MSG_ID_HIGH_LATENCY
:
_handleHighLatency
(
message
);
break
;
case
MAVLINK_MSG_ID_HIGH_LATENCY2
:
_handleHighLatency2
(
message
);
break
;
...
...
@@ -1296,6 +1299,63 @@ void Vehicle::_handleGlobalPositionInt(mavlink_message_t& message)
}
}
void
Vehicle
::
_handleHighLatency
(
mavlink_message_t
&
message
)
{
mavlink_high_latency_t
highLatency
;
mavlink_msg_high_latency_decode
(
&
message
,
&
highLatency
);
QString
previousFlightMode
;
if
(
_base_mode
!=
0
||
_custom_mode
!=
0
){
// Vehicle is initialized with _base_mode=0 and _custom_mode=0. Don't pass this to flightMode() since it will complain about
// bad modes while unit testing.
previousFlightMode
=
flightMode
();
}
_base_mode
=
MAV_MODE_FLAG_CUSTOM_MODE_ENABLED
;
_custom_mode
=
_firmwarePlugin
->
highLatencyCustomModeTo32Bits
(
highLatency
.
custom_mode
);
if
(
previousFlightMode
!=
flightMode
())
{
emit
flightModeChanged
(
flightMode
());
}
// Assume armed since we don't know
if
(
_armed
!=
true
)
{
_armed
=
true
;
emit
armedChanged
(
_armed
);
}
struct
{
const
double
latitude
;
const
double
longitude
;
const
double
altitude
;
}
coordinate
{
highLatency
.
latitude
/
(
double
)
1E7
,
highLatency
.
longitude
/
(
double
)
1E7
,
static_cast
<
double
>
(
highLatency
.
altitude_amsl
)
};
_coordinate
.
setLatitude
(
coordinate
.
latitude
);
_coordinate
.
setLongitude
(
coordinate
.
longitude
);
_coordinate
.
setAltitude
(
coordinate
.
altitude
);
emit
coordinateChanged
(
_coordinate
);
_airSpeedFact
.
setRawValue
((
double
)
highLatency
.
airspeed
/
5.0
);
_groundSpeedFact
.
setRawValue
((
double
)
highLatency
.
groundspeed
/
5.0
);
_climbRateFact
.
setRawValue
((
double
)
highLatency
.
climb_rate
/
10.0
);
_headingFact
.
setRawValue
((
double
)
highLatency
.
heading
*
2.0
);
_altitudeRelativeFact
.
setRawValue
(
std
::
numeric_limits
<
double
>::
quiet_NaN
());
_altitudeAMSLFact
.
setRawValue
(
coordinate
.
altitude
);
_windFactGroup
.
speed
()
->
setRawValue
((
double
)
highLatency
.
airspeed
/
5.0
);
_battery1FactGroup
.
percentRemaining
()
->
setRawValue
(
highLatency
.
battery_remaining
);
_temperatureFactGroup
.
temperature1
()
->
setRawValue
(
highLatency
.
temperature_air
);
_gpsFactGroup
.
lat
()
->
setRawValue
(
coordinate
.
latitude
);
_gpsFactGroup
.
lon
()
->
setRawValue
(
coordinate
.
longitude
);
_gpsFactGroup
.
mgrs
()
->
setRawValue
(
convertGeoToMGRS
(
QGeoCoordinate
(
coordinate
.
latitude
,
coordinate
.
longitude
)));
_gpsFactGroup
.
count
()
->
setRawValue
(
0
);
}
void
Vehicle
::
_handleHighLatency2
(
mavlink_message_t
&
message
)
{
mavlink_high_latency2_t
highLatency2
;
...
...
src/Vehicle/Vehicle.h
View file @
c7e2fa5c
...
...
@@ -1331,6 +1331,7 @@ private:
void
_handleScaledPressure
(
mavlink_message_t
&
message
);
void
_handleScaledPressure2
(
mavlink_message_t
&
message
);
void
_handleScaledPressure3
(
mavlink_message_t
&
message
);
void
_handleHighLatency
(
mavlink_message_t
&
message
);
void
_handleHighLatency2
(
mavlink_message_t
&
message
);
void
_handleAttitudeWorker
(
double
rollRadians
,
double
pitchRadians
,
double
yawRadians
);
void
_handleAttitude
(
mavlink_message_t
&
message
);
...
...
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