Lua script to recover a copter with no radio/GPS signal

I am writing a Lua script to take over when the radio control signal is lost and there is no GPS. In that case I want the copter to go at top speed in a particular known direction where I trust it will eventually get either GPS or radio. I am trying to figure out the proper protocol. I studied the sources of Ardupilot and I see that there is a call

vehicle: set_target_pos_NED()

and also

vehile:set_target_velocity_NED()

and

vehicle:set_desired_speed()

should I use one of those, something else, or would I have to patch Ardupilot to be able to do this from a Lua script?

My concern is that with no GPS if I set a velocity to a particular value, it would not result in an appropriate response from the motors.

Feel free to point me to the source of Ardupilot for further reading… :slight_smile:

Guided No GPS accepts only attitude and altitude targets.

Velocity controller requires position estimate.

Thanks. So how would I just turn the motors at full throttle after setting the attitude ? I would prefer to do it in a way that does not depend on the specifics of the aircraft.