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
83b500d0
Commit
83b500d0
authored
May 14, 2019
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
63778dc4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
37 deletions
+45
-37
APMFirmwarePlugin.cc
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
+44
-37
APMFirmwarePlugin.h
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
+1
-0
No files found.
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
83b500d0
...
...
@@ -446,46 +446,55 @@ void APMFirmwarePlugin::_handleIncomingHeartbeat(Vehicle* vehicle, mavlink_messa
{
bool
flying
=
false
;
// We pull Vehicle::flying state from HEARTBEAT on ArduPilot. This is a firmware specific test.
mavlink_heartbeat_t
heartbeat
;
mavlink_msg_heartbeat_decode
(
message
,
&
heartbeat
);
if
(
vehicle
->
armed
()
)
{
mavlink_heartbeat_t
heartbeat
;
mavlink_msg_heartbeat_decode
(
message
,
&
heartbeat
);
if
(
message
->
compid
==
MAV_COMP_ID_AUTOPILOT1
)
{
// We pull Vehicle::flying state from HEARTBEAT on ArduPilot. This is a firmware specific test.
if
(
vehicle
->
armed
())
{
flying
=
heartbeat
.
system_status
==
MAV_STATE_ACTIVE
;
if
(
!
flying
&&
vehicle
->
flying
())
{
// If we were previously flying, and we go into critical or emergency assume we are still flying
flying
=
heartbeat
.
system_status
==
MAV_STATE_CRITICAL
||
heartbeat
.
system_status
==
MAV_STATE_EMERGENCY
;
flying
=
heartbeat
.
system_status
==
MAV_STATE_ACTIVE
;
if
(
!
flying
&&
vehicle
->
flying
())
{
// If we were previously flying, and we go into critical or emergency assume we are still flying
flying
=
heartbeat
.
system_status
==
MAV_STATE_CRITICAL
||
heartbeat
.
system_status
==
MAV_STATE_EMERGENCY
;
}
}
vehicle
->
_setFlying
(
flying
);
}
vehicle
->
_setFlying
(
flying
);
// We need to know whether this component is part of the ArduPilot stack code or not so we can adjust mavlink quirks appropriately.
// If the component sends a heartbeat we can know that. If it's doesn't there is pretty much no way to know.
_ardupilotComponentMap
[
message
->
sysid
][
message
->
compid
]
=
heartbeat
.
autopilot
==
MAV_AUTOPILOT_ARDUPILOTMEGA
;
// Force the ESP8266 to be non-ArduPilot code (it doesn't send heartbeats)
_ardupilotComponentMap
[
message
->
sysid
][
MAV_COMP_ID_UDP_BRIDGE
]
=
false
;
}
bool
APMFirmwarePlugin
::
adjustIncomingMavlinkMessage
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
)
{
// Only translate messages which come from the autopilot. All other components are expected to follow current mavlink spec.
if
(
message
->
compid
!=
MAV_COMP_ID_AUTOPILOT1
)
{
if
(
message
->
msgid
==
MAVLINK_MSG_ID_HEARTBEAT
)
{
// We need to look at all heartbeats that go by from any component
_handleIncomingHeartbeat
(
vehicle
,
message
);
return
true
;
}
switch
(
message
->
msgid
)
{
case
MAVLINK_MSG_ID_PARAM_VALUE
:
_handleIncomingParamValue
(
vehicle
,
message
);
break
;
case
MAVLINK_MSG_ID_STATUSTEXT
:
return
_handleIncomingStatusText
(
vehicle
,
message
,
false
/* longVersion */
)
;
case
MAVLINK_MSG_ID_STATUSTEXT_LONG
:
return
_handleIncomingStatusText
(
vehicle
,
message
,
tru
e
/* longVersion */
);
case
MAVLINK_MSG_ID_HEARTBEAT
:
_handleIncomingHeartbeat
(
vehicle
,
message
);
break
;
case
MAVLINK_MSG_ID_RC_CHANNELS
:
_handleRCChannels
(
vehicle
,
message
)
;
break
;
case
MAVLINK_MSG_ID_RC_CHANNELS_RAW
:
_handleRCChannelsRaw
(
vehicle
,
message
)
;
break
;
// Only translate messages which come from ArduPilot code. All other components are expected to follow current mavlink spec.
if
(
_ardupilotComponentMap
[
vehicle
->
id
()][
message
->
compid
])
{
switch
(
message
->
msgid
)
{
case
MAVLINK_MSG_ID_PARAM_VALUE
:
_handleIncomingParamValue
(
vehicle
,
message
);
break
;
case
MAVLINK_MSG_ID_STATUSTEXT
:
return
_handleIncomingStatusText
(
vehicle
,
message
,
fals
e
/* longVersion */
);
case
MAVLINK_MSG_ID_STATUSTEXT_LONG
:
return
_handleIncomingStatusText
(
vehicle
,
message
,
true
/* longVersion */
);
case
MAVLINK_MSG_ID_RC_CHANNELS
:
_handleRCChannels
(
vehicle
,
message
);
break
;
case
MAVLINK_MSG_ID_RC_CHANNELS_RAW
:
_handleRCChannelsRaw
(
vehicle
,
message
);
break
;
}
}
return
true
;
...
...
@@ -493,15 +502,13 @@ bool APMFirmwarePlugin::adjustIncomingMavlinkMessage(Vehicle* vehicle, mavlink_m
void
APMFirmwarePlugin
::
adjustOutgoingMavlinkMessage
(
Vehicle
*
vehicle
,
LinkInterface
*
outgoingLink
,
mavlink_message_t
*
message
)
{
//-- Don't process messages to/from UDP Bridge. It doesn't suffer from these issues
if
(
message
->
compid
==
MAV_COMP_ID_UDP_BRIDGE
)
{
return
;
}
switch
(
message
->
msgid
)
{
case
MAVLINK_MSG_ID_PARAM_SET
:
_handleOutgoingParamSet
(
vehicle
,
outgoingLink
,
message
);
break
;
// Only translate messages which come from ArduPilot code. All other components are expected to follow current mavlink spec.
if
(
_ardupilotComponentMap
[
vehicle
->
id
()][
message
->
compid
])
{
switch
(
message
->
msgid
)
{
case
MAVLINK_MSG_ID_PARAM_SET
:
_handleOutgoingParamSet
(
vehicle
,
outgoingLink
,
message
);
break
;
}
}
}
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
83b500d0
...
...
@@ -137,6 +137,7 @@ private:
// Vehicle specific data should go into APMFirmwarePluginInstanceData
QList
<
APMCustomMode
>
_supportedModes
;
QMap
<
int
/* vehicle id */
,
QMap
<
int
/* componentId */
,
bool
/* true: component is part of ArduPilot stack */
>>
_ardupilotComponentMap
;
static
const
char
*
_artooIP
;
static
const
int
_artooVideoHandshakePort
;
...
...
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