Control gps altitude using ardupilot framework

Hello everyone,

I am very new to this field. Currently, I want to navigate the drone using GPS only. Currently, I have the relative values of drone position with respect to a vehicle.
What I want to do is a small test of manually flying the drone to a specific point and from there the drone should autonomously go the specific target position in z axis and hover there for some time using the relative GPS coordinates.

Is there any inbuilt controller in autopilot’s firmware i can use to go to a specific altitude and make it hover or loiter for some time ?

Secondly, will this message from mavlink " SET_POSITION_TARGET_LOCAL_NED ( #84 )" help me?
Does this message just sets the desired position or there is a controller running in back end which will help my drone in reaching the desired position?

Yes, just use GUIDED mode and keep on sending the desired coordinates one per second, it will then go there.

Yes that mavlink message will help you but there are other that operate on a global frame that support lat, lon coordinates.

Do not post in copter 4.0 topic if you are using copter 4.4 firmware.

Thank you so much for this response.

  1. Could you also enlighten me with some of the other messages that operate on gloabl frame. It would be really great.

  2. So, right now, I am using absolute coordinates of the drone in global systems as the input to this message. However, in future, I want perform the same test but I need to send values of drone with respect to a ground/moving vehicle. Then in this case, which would be the apt message to perform this test.

Will set_position_target_local_ned work ?
The input to this message will be n,e,d coordinates as shown below:
let (n, e, d) = geodetic2ned(lat_drone_rad, lon_drone_rad, alt_drone_mts, lat_vehicle_rad, lon_vehicle_rad, alt_vehicle_mts, Ellipsoid::WGS84);

I will take care of this definitely. Thankyou so much!

Please read the documentation on the “follow” flight mode.