Browse Source

Fixes #6484: Bug in Offboard mode incorrect use of type_mask

sbg
Sean Matthews 8 years ago committed by Lorenz Meier
parent
commit
08891526fd
  1. 12
      src/modules/mavlink/mavlink_receiver.cpp

12
src/modules/mavlink/mavlink_receiver.cpp

@ -909,22 +909,24 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
pos_sp_triplet.next.valid = false; pos_sp_triplet.next.valid = false;
pos_sp_triplet.current.valid = true; pos_sp_triplet.current.valid = true;
if (is_takeoff_sp) { /* Order of statements matters. Takeoff can override loiter.
* See https://github.com/mavlink/mavlink/pull/670 for a broader conversation. */
if (is_loiter_sp) {
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_LOITER;
} else if (is_takeoff_sp) {
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_TAKEOFF; pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_TAKEOFF;
} else if (is_land_sp) { } else if (is_land_sp) {
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_LAND; pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_LAND;
} else if (is_loiter_sp) {
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_LOITER;
} else if (is_idle_sp) { } else if (is_idle_sp) {
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_IDLE; pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_IDLE;
} else { } else {
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_POSITION; pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_POSITION;
} }
/* set the local pos values */ /* set the local pos values */
if (!offboard_control_mode.ignore_position) { if (!offboard_control_mode.ignore_position) {
pos_sp_triplet.current.position_valid = true; pos_sp_triplet.current.position_valid = true;

Loading…
Cancel
Save