Rover: guided consumes set-pos-target-local-ned as offset from origin

This commit is contained in:
Randy Mackay 2020-08-27 11:20:10 +09:00 committed by Andrew Tridgell
parent 2398b5dec4
commit b0f9f9993f

View File

@ -766,6 +766,12 @@ void GCS_MAVLINK_Rover::handleMessage(const mavlink_message_t &msg)
break;
}
// need ekf origin
Location ekf_origin;
if (!rover.ahrs.get_origin(ekf_origin)) {
break;
}
// check for supported coordinate frames
if (packet.coordinate_frame != MAV_FRAME_LOCAL_NED &&
packet.coordinate_frame != MAV_FRAME_LOCAL_OFFSET_NED &&
@ -799,9 +805,10 @@ void GCS_MAVLINK_Rover::handleMessage(const mavlink_message_t &msg)
target_loc.offset(packet.x, packet.y);
break;
case MAV_FRAME_LOCAL_NED:
default:
// MAV_FRAME_LOCAL_NED interpret as an offset from home
target_loc = rover.ahrs.get_home();
// MAV_FRAME_LOCAL_NED is interpreted as an offset from EKF origin
target_loc = ekf_origin;
target_loc.offset(packet.x, packet.y);
break;
}