Servers by jDrones

LOCAL_POSITION_NED changes as a result of arming

Hi, I am trying to control my drone using Mavlink messages, specifically setting POSITION_TARGET_LOCAL_NED values to get my drone to fly to a location relative to home.

In the process of working towards this goal, I have setup my drone to send me MAVLINK_MSG_ID_LOCAL_POSITION_NED messages at 200ms intervals.

I have noticed something very odd… on the ground doing nothing, I receive MAVLINK_MSG_ID_LOCAL_POSITION_NED messages with position (1, 6, 0)

i.e. struct mavlink_local_position_ned_t members (x, y, z)

After starting to Arm I see a dramatic jump to position (0, 0, 0). The drone has not moved, yet the act of arming has made the location change.

Does anyone know what is going on here? Many thanks!

When you arm the drone sets the home location to the current location, hence the current NED location relative to home will be (0, 0, 0). This allows the drone to come back home later, just by navigating to (0, 0, 0)

1 Like

Okay, cool, makes sense.

After arming I perform a takeoff to 8m and during the takeoff I receive the expected MAVLINK_MSG_ID_LOCAL_POSITION_NED containing this info:

(0, 0, -Z)

with Z increasing to 8. So far so good. Now here comes the confusing bit. I receive MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED with:

[x,y,z] = [0.1, 5.5, -7.9]

Why is the y value 5.5? Surely it should be zero? Both messages are in the local NED frame yet I see different values. Could this be a bug?

Thanks again!

So to be clear, I receive:

MAVLINK_MSG_ID_LOCAL_POSITION_NED relative to the arming location

MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED relative to the EKF origin (position of first GPS fix)

And I must set MAVLINK_MSG_SET_POSITION_TARGET_LOCAL_NED_POSITION relative to the EKF origin.

Little bit confusing really as in my book, they should all be relative to the arming location.

Servers by jDrones