GCS_MAVLink: honour coordinate altitude frames for DO_SET_ROI

Also use {} to construct the location.

Note the assumption that the frame is relative-to-home when we receive
the command via COMMAND (as opposed to COMMAND_LONG)

Note that this is a behavioural change as
This commit is contained in:
Peter Barker 2019-11-04 14:50:32 +11:00 committed by Peter Barker
parent f177679e61
commit 402f3ec09c

View File

@ -3850,10 +3850,17 @@ MAV_RESULT GCS_MAVLINK::handle_command_do_set_roi(const mavlink_command_int_t &p
// x : lat // x : lat
// y : lon // y : lon
// z : alt // z : alt
Location roi_loc; Location::AltFrame frame;
roi_loc.lat = packet.x; if (!mavlink_coordinate_frame_to_location_alt_frame((MAV_FRAME)packet.frame, frame)) {
roi_loc.lng = packet.y; // unknown coordinate frame
roi_loc.alt = (int32_t)(packet.z * 100.0f); return MAV_RESULT_UNSUPPORTED;
}
const Location roi_loc {
packet.x,
packet.y,
(int32_t)(packet.z * 100.0f),
frame
};
return handle_command_do_set_roi(roi_loc); return handle_command_do_set_roi(roi_loc);
} }
@ -3865,10 +3872,12 @@ MAV_RESULT GCS_MAVLINK::handle_command_do_set_roi(const mavlink_command_long_t &
// off support for MAV_CMD_DO_SET_ROI_LOCATION (which doesn't // off support for MAV_CMD_DO_SET_ROI_LOCATION (which doesn't
// support the extra fields). // support the extra fields).
Location roi_loc; const Location roi_loc {
roi_loc.lat = (int32_t)(packet.param5 * 1.0e7f); (int32_t)(packet.param5 * 1.0e7f),
roi_loc.lng = (int32_t)(packet.param6 * 1.0e7f); (int32_t)(packet.param6 * 1.0e7f),
roi_loc.alt = (int32_t)(packet.param7 * 100.0f); (int32_t)(packet.param7 * 100.0f),
Location::AltFrame::ABOVE_HOME
};
return handle_command_do_set_roi(roi_loc); return handle_command_do_set_roi(roi_loc);
} }