Running a live python script in mission planner

Hello, I would like to be able to run a python script that is able to take inputs such as a click, and then send a command to the plane.

  1. I would like to make a UI that would have a couple of buttons
  2. I would like the program to be running once the plane is in the air. I want it to continually run, and if I press a button from my UI, it would send a servo command. I’m assuming it would be along the lines of:
    Script.SendRC(3, 1000,True)

In general, I would like to have a way to control a payload from the interface on the ground control computer.

Here is an example of a Mission Planner Python script that creates a UI, listens for MAVLink messages, and sends RC commands:

ArduRover_Mower/servo_tuner.py at master · yuri-rage/ArduRover_Mower (github.com)

The documentation for Mission Planner Python scripting is somewhat sparse, but it’s a good place to get started.

Yuri,
First of all, thank you so much for replying with great information and examples. I am fairly new to the drone community, so I am not quite sure how to set up your example script in mission planner. I noticed you have a youtube channel, and I was wondering if you could do a video on running a script and building a user interface. If not, could you point me in the right direction? However, I have scoured the internet for a user interface software to control a payload from a computer, but could not find any.

Your time is greatly appreciated

All great ideas for a video. Let me see what I can do. It can be highly frustrating, as I’m sure you know.

This video showcases the script you mention.

This video shows another script I wrote that has been overcome by recent development (gps2yaw is now available to Mission Planner directly).

Perhaps those are helpful in the meantime?

Thank you Yuri. I will look into these videos and continue to research.