Getting started with Mission Planner plugins
Building simple C# extensions to explore, visualize, and automate missions.
6 min read
- Tagged with
- mission planner
- ardupilot
- csharp
- mavlink
Installation and Setup
-
Install Mission Planner and locate the plugin folder
- Download and install Mission Planner for Windows from the official ArduPilot Mission Planner page.[1]
- After installation, open the Mission Planner install directory (for example:
C:\Program Files (x86)\Mission Planner).[2] - Inside this folder there is a
pluginsdirectory where custom.csplugin files can be dropped and compiled on startup.
-
Clone the plugin example repository
Terminal window git clone https://github.com/rohith8272/missionplanner-plugin-example.gitcd missionplanner-plugin-example- The repository contains several toy plugins demonstrating UI integration, MAVLink message handling, and mission editing with C#.
-
Copy an example plugin into Mission Planner
- From the cloned repo, open the
examplesfolder and pick any.csfile (for exampleMapMarker.cs). - Copy the chosen
.csfile into theMissionPlanner/plugins/directory in your Mission Planner install path. - Restart Mission Planner so it discovers and compiles the new plugin on startup.[3]
- From the cloned repo, open the
-
Enable the plugin in Mission Planner
- In Mission Planner, open the Plugin Manager using
CTRL + P. - Locate your plugin by the
Nameproperty defined in the class (for example “Simple Map Marker”).[1] - Enable the plugin and restart Mission Planner if requested so it loads cleanly.
- In Mission Planner, open the Plugin Manager using
Simple Map Marker plugin
The MapMarker.cs example shows how to embed a small UI panel into the Flight Data view and interact with the map control.[1]
-
UI elements in the quick panel
- The plugin creates labels and text boxes for Lat and Lon, and a
Set Markerbutton.[1] - It locates the
tableLayoutPanelQuickcontrol insideFlightDataand adds the new controls into the existing layout so they appear alongside standard Mission Planner widgets.[1]
- The plugin creates labels and text boxes for Lat and Lon, and a
-
Placing a marker on the map
- A
GMapOverlaynamed"markers"is created and attached toHost.FDGMapControl.Overlays.[4][1] - When the button is clicked, the plugin parses the latitude and longitude from the text boxes, clears existing markers, adds a new
GMarkerGoogleat the given coordinates, recenters the map on that point, and refreshes the control.[5][1]
- A
-
How to use it
- Start Mission Planner with the plugin enabled and go to the Flight Data tab.[1]
- In the quick panel, enter a latitude and longitude (for example
37.7749,-122.4194) and clickSet Markerto drop a red marker at that location and center the view.[1]
Custom mission library plugin
Custom-WP.cs implements a mission library menu entry that can quickly preload a set of waypoints into the Flight Planner.[6]
-
Adding a menu item to the Flight Plan view
- On load, the plugin creates a
ToolStripMenuItemcalled"Mission library"and attaches it toHost.FPMenuMap(the Flight Planner map menu).[6] - It also caches a reference to the
Commandsgrid (MyDataGridView) in the Flight Planner UI to manipulate the visible mission list.[6]
- On load, the plugin creates a
-
Inserting custom waypoints
- When the menu item is clicked, the plugin displays a
CustomMessageBoxprompt indicating that it will load common flight plans.[6] - A small array of waypoints
(lat, lon, alt)is defined and the current mission is cleared usingclearMissionToolStripMenuItem_Clickon the main form.[6]
- When the menu item is clicked, the plugin displays a
-
Syncing with the mission list UI
- For each waypoint, the plugin calls
Host.InsertWPto populate the internal mission withMAV_CMD.WAYPOINTcommands, and then usesHost.AddWPtoListso the waypoints appear in the mission grid.[7][6] - Finally, it removes the first row in the
Commandsgrid if present, cleaning up any placeholder row left by Mission Planner.[6]
- For each waypoint, the plugin calls
-
How to use it
- Enable the plugin, open the Flight Plan tab, and right‑click on the map or open the planner menu where
"Mission library"appears.[6] - Clicking it replaces the current mission with the preconfigured waypoint sequence, ready to upload to the vehicle after review.[8][6]
- Enable the plugin, open the Flight Plan tab, and right‑click on the map or open the planner menu where
GPS MAVLink console plugin
GPS-console.cs demonstrates how to subscribe to raw MAVLink messages and log them directly to the console from within Mission Planner.[3]
-
Registering a GPS RAW listener
- When the plugin initializes, it adds a
"Start GPS RAW Listener"menu item to the Flight Data map menu (Host.FDMenuMap).[3] - Clicking this item subscribes to
MainV2.comPort.OnPacketReceivedand logs that it is listening forGPS_RAW_INTmessages.[9][3]
- When the plugin initializes, it adds a
-
Handling incoming packets
- The
OnComPortOnOnPacketReceivedhandler checks if the message ID isMAVLINK_MSG_ID.GPS_RAW_INTand casts the payload tomavlink_gps_raw_int_t.[10][3] - It converts the raw integers into SI units (latitude and longitude divided by
1e7, altitude from millimeters to meters) and prints a formatted line with position and satellite count.[3]
- The
-
How to use it
- Connect Mission Planner to a vehicle or SITL instance that publishes
GPS_RAW_INT.[11] - Trigger
"Start GPS RAW Listener", then use the Mission Planner console (or debug output in your IDE) to watch the incoming GPS data stream in real time.[3]
- Connect Mission Planner to a vehicle or SITL instance that publishes
Exploring the Mission Planner UI tree
Panelexplorer.cs is a small introspection tool that prints out the control hierarchy of the Flight Data tab.[2]
-
Dumping UI controls
- On
Loaded, the plugin writes a header and then callsDumpControlsonHost.MainForm.FlightData.[2] DumpControlsiterates through each child control, logs itsNameand type, and recurses into its children with indentation to show nesting.[2]
- On
-
Why this is useful
- Mission Planner’s WinForms layout is large and often undocumented at the control level, so discovering names like
tableLayoutPanelQuickorFDGMapControlcan be difficult.[2][1] - Running Panel Explorer gives a live map of what controls exist, making it easier to inject custom widgets into the right panel without digging through the entire source tree.[2][6]
- Mission Planner’s WinForms layout is large and often undocumented at the control level, so discovering names like
-
How to use it
- Enable Panel Explorer and open the Flight Data tab.[2]
- Check the console output (Visual Studio debug window or standard output) to see the full hierarchy, then reuse those control names in your own plugins to position inputs, charts, or overlays.[12][2]
Tips for developing your own plugins
-
Use the Plugin base class
- All examples derive from
MissionPlanner.Plugin.Pluginand overrideName,Version,Author, and lifecycle methods (Init,Loaded,Loop,Exit).[3][6][1][2] Hostexposes key objects likeMainForm,FDGMapControl,FPMenuMap, andFDMenuMap, giving access to both UI elements and the active MAVLink connection.[3]
- All examples derive from
-
Iterate quickly with single‑file plugins
- For early experiments, copying a single
.csfile intoMissionPlanner/plugins/and restarting is enough to test small UI or MAVLink ideas. - Once a plugin grows, clone the official Mission Planner source, open it in Visual Studio, and add your plugin to a dedicated project so you can debug with breakpoints.[6][2]
- For early experiments, copying a single
-
Common patterns from the examples
- UI injection: Use
Controls.Findwith known names (for example"tableLayoutPanelQuick"or"Commands") to attach new controls into existing layouts.[1][6] - Map overlays: Create
GMapOverlayinstances, manage markers, and recenter the map for visual feedback on geographic data.[5][1] - Mission editing: Use helpers like
InsertWPandAddWPtoListto keep the internal mission and planner UI in sync.[7][6] - MAVLink streaming: Subscribe to
OnPacketReceivedto inspect specific messages and prototype analytics or logging tools before integrating them more deeply.[9][3]
- UI injection: Use
Because the repository is MIT‑licensed, you are free to copy, modify, and redistribute these example plugins in your own Mission Planner workflows as long as you include the license notice.[12]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15