In the latest release (1.71) of Mission Planner, Michael added an ingenious new feature to the plugin system. It can compile (interpret) plugins written in c#.
Plugins written this way are distributed in source code form and interpreted during loading of Mission Planner.
To illustrate the benefits of this type of plugin I implemented the initial parameters calculation, based on Leonard Hall’s excellent Tuning Guide and it’s excel sheet implementation by Shawn aka xfacta on Ardupilot Discuss forum.
All you have to do is to extract this zip file to the Program Files(x86)/Mission Planner/Plugins directory (zip contains one c# source code file)
Then start Mission Planner and after connected to an Arducopter press ALT+A to start calculator
I copied the “InitialParamsCalculator.cs” file to C:\Program Files(x86)/Mission Planner/Plugins and restarted MissionPlanner - as per the instructions.
Pressing Alt-A brings up the dialog to enter basic info.
I especially like that you’ve put in the different voltages for a range of battery types - I did toy with this idea for my spreadsheet too and I was collecting the battery data.
(I chose some values to ensure all the params would show up for that screenshot)
The one thing I’d say is that writing INS_GYRO_FILTER with a value other than 20 should be optional and probably only for small frames/props. Is it possible to put some warning text at the bottom of the ParamCompare window or similar?
I’ll check the code myself, but no promises there, it’s above my pay grade.
EDIT: I just noticed the closing dialog still says it successfully updated the parameters even if you unselected all params - that’s not a big issue of course.
Thanks for checking. I’ll update it with the warning. The success message box is a known bug, since I use the compare control from Mission planner and it does not differentiate a success or a canceled dialog
Thanks, It is just a bit less powerful than a full blown compiled one, since runtime compiled plugins can be only single files, and use only libraries and packages that already come with Mission Planner. Single file restriction is only painful if you want a fancy form or gui.
@xfacta once I sort out the process for doing the Loiter tuning and pilot speed up/down inclusive of fail safe descents maybe adding a table for that could be handy for the future. I know there is correlation between weight of the aircraft, prop size and air mass displacement which can cause unsteady decent. So if we go down that path to give basic loiter braking and acceleration rates and decent speeds may help with an initial setup. < will discuss later
This is really great! After reading this post and looking at your example I am now also playing with making custom C# plugins. Sometimes I make stupid C# syntax errors which causes the plugin not to load/start. Is there a way that I can see more details about the reasons a plugin failed to load?
You can see compiler errors in the console (enable console window on the help screen) and they also logged to MissionPlanner.log which resides in c:\ProgramData\Mission Planner directory. (note that the ProgramData directory is hidden by default).
I recommend to delete MissionPlanner log, start MP then press CTRL+P to check if your plugin is loaded. If not, close MP and check log, you will find plugin loading at the bottom of the latest log.
But you can use visual studio (community edition is free) to develop your plugin, you can use MissionPlanner.stats plugin as a template project. Once it compiles and runs then you can take the .cs code and put in the plugin directory (so no need to compile and create a dll…)
Thanks for sharing this! Enabled the console and now it’s much easier to debug!
These plugins are really powerful stuff! Spent less than half a day (mostly reading the MP code) on it and so far I could add another tab page to the Data window where I can now add all my custom experimental features
Now also getting curious to try out the dll plugins…
@Jan_Swanepoel I would love to see some of these plugins a main feature of MP. The amount of amazing stuff that can come out of a little bit of time and someone that knows what they are doing is invaluable to projects like these.