Detecting when RTL has been initiated

I’m developing some programs that will run on a companion computer. Under normal circumstances these programs will guide the drone. However, I’d like to design things such that, should the autopilot ever decide that it needs to land or RTL (i.e. in response to some problem), then these programs will be ignored.

I’ve developed a mavproxy module called “breaker” that is supposed to monitor mavlink traffic and kill the connections to these programs under the right conditions. Ideally it would be able to detect when the autopilot has decided to RTL, but so far I can’t see how to determine that from the information that a mavproxy module receives.

So first, is this “breaker” behavior something that already exists? Or is there perhaps a better way to implement it than with a mavproxy module?

If detecting RTL is possible with a mavproxy module, how do I do it?

We control the drone from a companion computer using GUIDED mode.
The IMPORTANT part is to only change to GUIDED mode once in the entire flight.
Now if Ardupilot has a failsafe (RTL, LAND, HOVER, etc), it will ignore companion computer and do it’s thing.

The thing to remember is to ALMOST never send mode change requests from the companion computer.

No need for a beak module!!!

1 Like

So the autopilot will ignore “fly here” type commands when it leaves GUIDED mode? That does simplify things.

I may still keep a breaker in place out of an over-abundance of caution. I’d like to think that my guidance programs will not issue unexpected instructions to enter GUIDED mode, but I’ve written too much software to trust myself 100%.

Thanks for your advice!

yes, it will.

Search and replace any mode change commands to make sure to do it only once at the beginning of the flight. Or even better, use exclusively the RC to set the mode to guided.