diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-07-03 15:00:32 +0200 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-07-03 15:00:32 +0200 |
commit | cbd602c27cb081502a2f1f1d910abdd1c2d7be13 (patch) | |
tree | 5c4d946405954b44c4e5960370ec0fbbf5aeffe0 /src/modules | |
parent | 839710daf841a9528a58e915f8b04484bf54e7dc (diff) | |
download | px4-firmware-cbd602c27cb081502a2f1f1d910abdd1c2d7be13.tar.gz px4-firmware-cbd602c27cb081502a2f1f1d910abdd1c2d7be13.tar.bz2 px4-firmware-cbd602c27cb081502a2f1f1d910abdd1c2d7be13.zip |
check sysid and compid for external setpoint
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/mavlink/mavlink_receiver.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 73222637f..f2b9a4e1e 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -406,18 +406,20 @@ MavlinkReceiver::handle_message_local_ned_position_setpoint_external(mavlink_mes struct offboard_control_setpoint_s offboard_control_sp; memset(&offboard_control_sp, 0, sizeof(offboard_control_sp)); - //XXX check if target system/component is correct + if (mavlink_system.sysid == local_ned_position_setpoint_external.target_system && + mavlink_system.compid == local_ned_position_setpoint_external.target_component) { - /* convert mavlink type (local, NED) to uORB offboard control struct */ - //XXX do the conversion - // - offboard_control_sp.timestamp = hrt_absolute_time(); + /* convert mavlink type (local, NED) to uORB offboard control struct */ + //XXX do the conversion + // + offboard_control_sp.timestamp = hrt_absolute_time(); - if (_offboard_control_sp_pub < 0) { - _offboard_control_sp_pub = orb_advertise(ORB_ID(offboard_control_setpoint), &offboard_control_sp); + if (_offboard_control_sp_pub < 0) { + _offboard_control_sp_pub = orb_advertise(ORB_ID(offboard_control_setpoint), &offboard_control_sp); - } else { - orb_publish(ORB_ID(offboard_control_setpoint), _offboard_control_sp_pub, &offboard_control_sp); + } else { + orb_publish(ORB_ID(offboard_control_setpoint), _offboard_control_sp_pub, &offboard_control_sp); + } } } |