Regain control during autonomous flight


I wrote a simple autonomous program to fly my quad from location A to location B using mavsdk. In order to confirm the drone has arrived to target location the current location is been compared to target location until the required accuracy condition is satisfied using GPS.

For safety reason, I am looking for an asynchronous way to break the code and regain remote control (RC) upon the use of one of the RC channels.

I guess I need to create two coroutines tasks and run those concurrently, one for the autonomous flight and one for checking if the RC channel was modified. If channel modification was detected then the autonomous flight coroutine should be stopped. It could be also that there is some built-in solution in mavsdk which I am not aware of.

I am new to mavsdk, asyncio, and drone in general and was wondering what is the correct approach I should take here.

You can simply switch your drone RC controller flight mode channel to Alt Hold or Position flight mode - this will override drone Offboard mode your program swiched to - and you can again control your drone manually. No need to create any coroutines, etc…

Thank you for the direction Sir, I will try it.

Hi @copterspace,
I have tried offboard but it seems like I am loosing the mode everytime when using telemetry position feedback needed to gurantee arrival to my target destination.
I was wondering if offboard is the recommeneded mode for navigation instead of “action.goto_location” and for which other applications offboard is considered powerfull ?

Hi, Yonatan!
Offboard example hitting target baloon you can see here:
Offboard mode is expected to send/renew target point to PX4 at ~5-10 Hz, otherwise offboard mode will be lost.
If you use some other autonomous mode instead (e.g. mission, position) - you can still interrupt it by switching RC manually to Alt Hold, for example. Or Stabilise…

Thanks for sharing this example. It is very useful.
I am new to this hobby and didn’t have chance yet to learn mavros so this is a good opportunity.