added support for SP type idle

This commit is contained in:
Andreas Antener
2016-03-21 20:32:19 +01:00
parent 664b0ee0a9
commit f3a1abf659
+10 -3
View File
@@ -658,7 +658,7 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
if ((mavlink_system.sysid == set_position_target_local_ned.target_system || if ((mavlink_system.sysid == set_position_target_local_ned.target_system ||
set_position_target_local_ned.target_system == 0) && set_position_target_local_ned.target_system == 0) &&
(mavlink_system.compid == set_position_target_local_ned.target_component || (mavlink_system.compid == set_position_target_local_ned.target_component ||
set_position_target_local_ned.target_component == 0) && set_position_target_local_ned.target_component == 0) &&
values_finite) { values_finite) {
/* convert mavlink type (local, NED) to uORB offboard control struct */ /* convert mavlink type (local, NED) to uORB offboard control struct */
@@ -675,6 +675,7 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
bool is_takeoff_sp = (bool)(set_position_target_local_ned.type_mask & 0x1000); bool is_takeoff_sp = (bool)(set_position_target_local_ned.type_mask & 0x1000);
bool is_land_sp = (bool)(set_position_target_local_ned.type_mask & 0x2000); bool is_land_sp = (bool)(set_position_target_local_ned.type_mask & 0x2000);
bool is_loiter_sp = (bool)(set_position_target_local_ned.type_mask & 0x3000); bool is_loiter_sp = (bool)(set_position_target_local_ned.type_mask & 0x3000);
bool is_idle_sp = (bool)(set_position_target_local_ned.type_mask & 0x4000);
offboard_control_mode.timestamp = hrt_absolute_time(); offboard_control_mode.timestamp = hrt_absolute_time();
@@ -717,10 +718,16 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t
if (is_takeoff_sp) { 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) {
} else if (is_loiter_sp) {
pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_LOITER; pos_sp_triplet.current.type = position_setpoint_s::SETPOINT_TYPE_LOITER;
} else if (is_idle_sp) {
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;
} }