Disconnect telemetry using Python script

Is there a way to disconnect the drone entirely from Mission Planner using a python code? Thanks in advanced!

As far as I know there is no such ability, nothing is mentioned here

http://ardupilot.org/planner/docs/using-python-scripts-in-mission-planner.html

The only one workaround is to break python module, lol. Which will lead to closing of mission planner.

Hey Nikita,

Thanks for replying, then do you perhaps know how to break the python module? I don’t think a simple sys.exit(0) would work lol. It is fine if missionplanner closes too. The python script is launched from the Scripts tab->Select Script

This is for a failsafe function. I’m using Mission Planner’s scripting functions, which would override RC Control. But the problem is if the script screws up, I’ll need some form of physical shutdown. So I have a button setup with arduino, and there is a thread on my python script which listens for an input on that button. Upon receiving an input (could be because of power failure, could be because of emergency stop), the mission planner should stop controlling the drone and there should be a cut in telemetry. That way, the drone would be its own master again and it could fly back to home using its failsafe (loss of telemetry).

Due to my little knowledge of python, when I tried to do something, I had some errors which lead to MP exit, I cant find what I did, so I cant help You with that. I tried to get access to relay ports with Mavlink commands, that is all I remember. Another workaround would be to modify MP Script.cs in order to include some function to disconnect from drone.

Hey Nikita,

Thanks for sharing. I guess I’ll play around with this more, I could modify MP’s script.cs but the script i’m trying to code out is supposed to work on any fresh installation of MP, so I need to avoid that as much as possible.

MAV.Close() would do it

Thanks Michael, that works! Thanks for all your time spent on MissionPlanner too!

I’m sorry I’m not familiar with MAV functions so I’m just asking all these basic questions. Hopefully these questions would also help those who are new!