How do you prevent home location being reset during arming?

Before the drone is armed, the coordinate frames of these are identical:

  • the message to send to the drone to move it to a location of MAVLINK_MSG_SET_POSITION_TARGET_LOCAL_NED_POSITION with coordinate_frame = MAV_FRAME_LOCAL_NED. i.e. you must specify this relative to EKF origin.
  • the message sent back from the drone of its current location of MAVLINK_MSG_ID_LOCAL_POSITION_NED. i.e. the drone specifies this relative to EKF origin.

HOWEVER, once you arm the drone, MAVLINK_MSG_SET_POSITION_TARGET_LOCAL_NED_POSITION is thereafter provided relative to the arming location.

If you arm the drone in a different place to getting a GPS fix you are screwed.

Is there a way to ensure this reset of the MAVLINK_MSG_SET_POSITION_TARGET_LOCAL_NED_POSITION coordinate frame is not performed?

In case anyone’s reading, either of these methods will work to reset the origin of the frame for which position targets must be given to the drone:

  1. mavlink_msg_set_home_position_encode

That said, I have an inkling that they location specified to be <50m from the EKF origin (GPS lock location). Not 100% on that though.