# Writing plugins for mission planner

Hi!
Does anyone know if there are any instructions on how to build plugins for mission planner?
Ive tried searching for it but have not found any useful information.
Im looking into writing a plugin for sending guided mode waypoints from an external system.

Think I found out how to do it.
Inherit plugin.cs and implement the functions
Do cool stuff in your code
Compile to dll
Place it in c:\program files (x86)\Mission Planner\Plugins

you got it.

let me know if you need more functions that are not currently public.

Hello,

I am working on a project with a BeagleBone and Erle_Brain Cape for an autopilot. I connected a USB webcam and using a videostreamer software on the BBB - MJPG STREAMER - it is steraming over WIFI to my laptop and it displays on the web browser at port :8080.
(embeddedtweaks.com/beaglebone-us … -tutorial/)

Would it be possible to add a tcp feed option on the video device select tab on the planner configuration menu ? For the moment , the only feed available is my local Laptop embedded webcam.

Or get this feed when you right click on the hud display an replace the SET MJPEG SOURCE - wich is not connecting to my tcp port when i put the numbers in , or this feature has not been designed on this purpose ?

Thanks

Hi,
I am curious about the possibility of adding a plugin that would automatically start running a python script on startup of missionplanner. Or alternatively put a button somewhere to start running said script. The script would be placed in a specific folder so it could be easily changed out if needed. The script is what I have been running from the script tab but would be much easier to have it auto run or have a button for it.

Let me know if you know of a good way to do this! Thanks!

i could add a command line option to open and start running the script if that would help?

That would be awesome! Would that be triggered on launch from a special shortcut? This sounds like a great solution

Hey Michael, has this been implemented?

According to the commits in the source, yes it is already in the code… https://github.com/ArduPilot/MissionPlanner/commit/eccdc1c9276e05a18056aecf2c798ce8e0fc6fb2

Great! Do you happen to know how to use it? I really don’t understand the commits in the code

@Eosbandi
I tried this

powershell -NoExit -ExecutionPolicy ByPass -script E:\coptor\autoscript.py -File E:\coptor\cmdscript.ps1

autoscript.py is the python file that i want to start, and cmdscript is the file i run with cmd, but this is not working, the mini window that appears everytime you manually run a script does not appear. any ideas?

Here is the relavent code
This indicates that if you launch MissionPlanner with the command script it’ll execute it on start-up
MissionPlanner.exe script <c:\to_my_script\script>
It’ll take python scripts according to http://ardupilot.org/planner/docs/using-python-scripts-in-mission-planner.html?highlight=script

if (cmds.ContainsKey("script") && File.Exists(cmds["script"]))
{
// invoke for after onload finished
this.BeginInvoke((Action) delegate()
{
try
{
FlightData.selectedscript = cmds["script"];

FlightData.BUT_run_script_Click(null, null);
}
catch (Exception ex)
{
CustomMessageBox.Show("Start script failed: "+ex.ToString(), Strings.ERROR);
}
});

@Michael_Oborne I looked in the wiki and don’t see a section on command line arguments…perhaps I’m missing it?

@lordneeko

I’ve tried:

1. Cd to my missionplanner directory
MissionPlanner.exe script E:\coptor\autoscript.py, MP starts, script not loaded
MissionPlanner.exe script “E:\coptor\autoscript.py”, MP starts, script not loaded

powershell -NoExit -ExecutionPolicy ByPass -script E:\coptor\autoscript.py -File E:\coptor\cmdscript.ps1

contents of cmdscript.ps1:
Start-Process -FilePath “E:\MiscPrograms\Mission Planner\MissionPlanner.exe” --ArgumentList script “E:\coptor\autoscript.py”, a powershell error stating “A positional parameter cannot be found that accepts argument ‘script’”, prolly the syntax error, will try this again.

From what I observe, it doesn’t feel like the cmdline is working. Am I doing anything wrong? Any other ideas?

EDIT: Tried Start-Process -FilePath “E:\MiscPrograms\Mission Planner\MissionPlanner.exe” -ArgumentList ‘script’, ‘E:\coptor\autoscript.py’, MP starts, script not loaded

Yeah, that’s why I tagged Michael to look at updating the wiki for this. did you try
MissionPlanner.exe -script ?

code shows that it is lookng for -, /, or – before the command

Yeah, I did. still nothing thou. even tried the filepath both with and without quotes (which i don’t think is the issue)

Just for completeness, this is what I did:
MissionPlanner.exe -script E:\coptor\autoscript.py
MissionPlanner.exe -script "E:\coptor\autoscript.py"
MissionPlanner.exe -script ‘E:\coptor\autoscript.py’

Tried these too:
MissionPlanner.exe --script E:\coptor\autoscript.py
MissionPlanner.exe --script "E:\coptor\autoscript.py"
MissionPlanner.exe --script ‘E:\coptor\autoscript.py’

And just in case, my MP’s version is 1.3.56 build 1.3.6672.30243, could it be my MP’s version?

Nah that’s the latest…not sure sorry @Michael_Oborne ?

Thanks for the directions thou!

Did you manage to find a way to run python scripts at startup?

Do you have some sample code I could look at. I am trying to learn how to do plugins.