Selection of frame of reference in set_position_target

THESE ARE MY FUSED GPS VALUES AND LOCAL NED MESSAGES FROM DRONE

  1. Lat_Drone_deg: 415252107, Lon_Drone_deg: -734249380, Alt_Drone: 84.66
  2. The local ned pose of drone is X:3.2765 Y:-13.0178 Z:-2.6364

THESE ARE MY FUSED GPS VALUES AND LOCAL NED MESSAGES FROM STATIONARY VEHICLE

  1. GPS LAT LON ALT Message:Lat_Vehicle 415251845 Lon_Vehicle -734247594 Alt_Vehicle:103.010
  2. LOCAL NED X Y Z Message: 3.0803356 -7.3146315 -0.3929917

Both drone and vehicle are kept at the same height but still I receive so much difference in altitude even though they are kept at same height near to each other.

I want to send the relative position of drone w.r.t to the vehicle using set_position_target command. I am not sure which frame of reference/coordinate system shall I choose while sending the relative position of drone w.r.t to the vehicle. Their absolute difference is already so much to accumulate the error.

Which would be a better choice and what cordinate frame would give me best results ?

  1. SET_POSITION_TARGET_LOCAL_NED
    Valid options are: (MAV_FRAME_LOCAL_NED) = 1, MAV_FRAME_LOCAL_OFFSET_NED) = 7, [MAV_FRAME_BODY_NED] = 8, (MAV_FRAME_BODY_OFFSET_NED) = 9

                                         OR
    
  2. SET_POSITION_TARGET_GLOBAL_POS_INT
    Valid options are: (MAV_FRAME_GLOBAL_INT) = 5, MAV_FRAME_GLOBAL_RELATIVE_ALT_INT) = 6, MAV_FRAME_GLOBAL_TERRAIN_ALT_INT) = 11

Hello @prarthana_sigedar,
ArduPilot has a Follow Mode, I think this could suit your needs. You just need to feed the the mavlink message GLOBAL_POSITION_INT with the followed vehicle position to the following vehicle flight controller.
About the height difference, is the GPS the same on both vehicles? Are other hardware differences? The local altitude estimations are similar, but your global estimations are quite different, so one vehicle is setting the origin wrong.

hii @beska ,
Thankyou so much for your reply.
No, Follow Mode is not really useful for me. So, I cant use it and have to do it other way.
The gps modules are not exactly the same. I mean they are from the same company but ofc there will be hardware differences.
Is there any way to check on how to set the right/preferred global origin ?

To better understand the altitude issue you should post here the logs of the two vehicles, maybe with LOG_DISARMED. When you send the position command you could specify the altitude relative to the home position, so the different sea-level altitude doesn’t matter, but I think you should still investigate why the sea-level altitudes are different.

It’s not very clear what you want to achieve, but if you want the two vehicles to move coherently they should have the same reference system so:

  1. you send the SET_POSITION_TARGET_GLOBAL_INT message, where the reference system is the earth frame for both the vehicles;
  2. you first set the EKF origin to be the same for both vehicles, and then send the SET_POSITION_TARGET_LOCAL_NED, where the reference system is the EKF origin.