
First start with downloading Mission Planner
Get your Ground Control Station set up the right way from day one. In this lecture, you’ll learn where to safely download Mission Planner, which build (stable vs. beta) to choose, and how to verify the installer so you avoid corrupt or outdated packages. We’ll also cover system requirements, common Windows prerequisites, and tips for users behind firewalls or on metered connections. You’ll see how the Mission Planner folder structure is laid out after download—so later, when we compile or add plugins, you know exactly where everything lives.
You’ll learn to:
Identify the correct, trusted source for downloading Mission Planner
Use search effectively to locate the official installer (try searching for “Mission Planner download” in your browser)
Decide between stable and beta/nightly builds depending on your workflow
Verify the installer to ensure integrity before installation
Organize your downloads and version them for future builds
Prerequisites: A Windows PC with admin rights and a reliable internet connection.
What you’ll produce: A verified Mission Planner installer saved in a clearly labeled course folder (e.g., C:\UAVCourse\Installers\MissionPlanner_vX.Y.Z), ready for installation in the next lecture.
Installation of Mission Planner
Set up Mission Planner cleanly so you can connect to SITL and real hardware without surprises. This lecture walks you through a trustworthy install on Windows, first-run configuration, and quick health checks.
What you’ll learn:
Install Mission Planner (stable vs. beta) with the right options
Handle Windows prompts (SmartScreen, firewall) safely
Install board USB drivers (CP210x/FTDI) and verify in Device Manager
Complete first-run setup: units, layout, log folders, and update check
Prerequisites:
Windows 10/11 with admin rights
Stable internet connection
A verified installer (search “Mission Planner installation” in your browser to find the official guide)
Step-by-step:
Get the installer
Search for Mission Planner installation and download the stable installer unless you specifically need beta/nightly for new features.
Run as Administrator
Right-click the installer → Run as administrator.
If SmartScreen warns you, choose More info → Run anyway (only if you confirmed the source is official).
Choose components
Keep defaults. Ensure USB drivers are selected; they install the CP210x/FTDI drivers many flight controllers use.
Allow firewall access
When Windows asks, allow MissionPlanner.exe on Private networks. (This will be needed for UDP/SITL later.)
Finish & launch
On first launch, let Mission Planner check for updates.
Set units (metric/imperial), language, and theme (optional).
Verify drivers
Plug in your flight controller (or another USB-serial device).
Open Device Manager → Ports (COM & LPT) and confirm a new COM port appears.
Quick health checks
Go to Help → About to verify version.
Confirm Documents\Mission Planner\logs exists after first run.
Optional: Help → Install Firmware tab loads without errors.
Troubleshooting (fast fixes):
Installer blocked: Temporarily disable overly aggressive antivirus, re-download, then re-try.
No COM port: Re-run the driver installer (look for mpdrivers.exe in the Mission Planner folder), or try a different USB cable/port.
Firewall issues: Open Windows Security → Firewall and allow Mission Planner for private networks.
Missing dependencies: Run the built-in updater (Help → Check for Updates) or repair the install; ensure Windows Update is current.
Outcome:
By the end, you’ll have Mission Planner installed, drivers working, firewall configured, and first-run settings saved—ready for the next lecture on connecting to SITL and real hardware.
Intro to Mission Planner
Get a clear, hands-on tour of Mission Planner—the all-in-one Ground Control Station for ArduPilot. We’ll map the interface, explain core concepts, and run a quick demo so you know exactly where to click and why.
What you’ll learn:
Mission Planner’s main tabs and what they’re for (Flight Data, Flight Plan, Initial Setup, Config/Tuning, Simulation, Log Browser)
Core GCS concepts: MAVLink link types (USB/COM, UDP), baud rate, modes, parameters, HUD, messages, and logs
How to customize the UI (layouts, quick panels, units, themes) to match your workflow
Safe first connection: SITL vs. real hardware, and basic health checks
Guided tour (fast):
Flight Data: HUD, map, status text, quick actions; reading GPS, EKF, battery, and mode.
Flight Plan: Drawing waypoints, setting altitudes, saving/loading missions.
Initial Setup: Firmware view, mandatory calibrations, radio/compass/accelerometer wizards.
Config/Tuning: Full parameter tree, search & filters, writing/reading params, compare & save.
Simulation (SITL): Launch a simulated vehicle and understand the default UDP link.
Data/Log: Where tlogs and DF logs are stored, quick replay, and inspection basics.
Hands-on mini-lab (10–15 min):
Start SITL (or connect a known good autopilot).
In Mission Planner, open a UDP or COM connection and confirm:
Heartbeats arriving (status text scrolling)
GPS Fix (simulated), mode changes visible, and sensors updating
Change a non-critical parameter (e.g., a display/unit setting), Write Params, reboot, and verify it persisted.
Outcomes:
By the end, you’ll confidently navigate Mission Planner, know which tab to use for planning vs. tuning, and establish a clean first connection (SITL or hardware) without guesswork—setting you up for the next lectures on calibration and mission building.
Prerequisites: Mission Planner installed on Windows, admin rights, and either SITL or a supported flight controller with USB drivers.
Downloading Stable & Dev SITL in Mission Planner
A) Online (from the Simulation tab)
Open Mission Planner → Simulation.
Internet + server connectivity required on first run.
Download Stable:
Pick your vehicle (Plane, Copter, or Rover) → click Start.
Approve firewall prompts; Mission Planner will download Stable SITL.
When finished, click Stop (files are now cached locally).
Download Dev (Master):
In the Simulation panel, switch channel to Dev.
Click Start to download Dev SITL, then Stop.
You can switch between Stable/Dev later without re-downloading unless a new build is available.
Cache location (default): %USERPROFILE%\Documents\Mission Planner\sitl
B) Offline / Manual method
If online download is blocked, you can manually place the SITL files:
Create (or use) your course folder path: C:\UAVCourse\Documents\Mission Planner\sitl
Search for “ArduPilot SITL packages Mission Planner” and download the appropriate ZIP archives.
Extract them into the sitl folder, preserving the folder structure from the archive.
Restart Mission Planner → Simulation tab. It will detect the cached SITL binaries and launch without fetching them online.
Notes & Tips
First download is one-time per version; later launches use the local cache.
For troubleshooting or extra documentation, search “ArduPilot SITL simulator software-in-the-loop”.
1) Wipe / Reset to Default Parameters
Reset the simulated vehicle to factory defaults before starting new missions.
Steps:
Go to Config/Tuning → Full Parameter List
Click Reset to Defaults (button label may vary slightly) → then click Write Params
Return to Flight Data
Under Actions, select Reboot (or simply Stop/Start the simulator)
2) Skip Download (Use Local Firmware)
If you’ve already cached or manually placed firmware, you can run SITL without re-downloading.
Steps in Mission Planner:
Open the Flight Planner tab
Right-click on the map → Set Home Here (choose an open/flat area)
Add waypoints as desired
First point → set Command = TAKEOFF
Final point → set Command = LAND
(Optional tip: insert DO_LAND_START before LAND for smoother approaches, but we’ll keep it simple here.)
Click Write
Flight Data Demo:
Go to Flight Data → Actions tab
Arm/Disarm → Arm
Set Mode → AUTO
Apply throttle → vehicle takes off, follows waypoints, and lands
Outcome:
By the end of this exercise, you’ll know how to:
Reset SITL parameters to defaults
Build and upload a simple waypoint mission
Run a full takeoff-to-landing sequence in AUTO mode
Install Visual Studio 2022 v17.8 (LTSC) for Mission Planner
In this lecture, you’ll learn how to install Visual Studio 2022 v17.8 (LTSC)—the recommended version for compiling and debugging Mission Planner. This specific build avoids common issues like random exits from FlightData.cs or crashes during runtime. You’ll also import the official configuration file so all the required workloads install in one shot.
What you’ll learn:
Why newer Visual Studio builds can sometimes be unstable with Mission Planner projects
How to download and install Visual Studio 2022 v17.8 LTSC
How to apply Mission Planner’s prepared configuration file (vs2022.vsconfig)
How to confirm Mission Planner compiles cleanly on the first try
Why v17.8 LTSC?
Later or Latest Visual Studio versions (like 17.10 or 17.12 or 17.14) may also work, but 17.8 LTSC is the proven “sweet spot” for Mission Planner development. Even though Microsoft no longer actively supports it, it remains compatible and stable for this workflow.
Step-by-step:
Get the Visual Studio installer
Search online for “Visual Studio 2022 download” and select the Community, Professional, or Enterprise edition.
Download the bootstrapper (VisualStudioSetup.exe).
Place installer & config file together
Keep VisualStudioSetup.exe and the vs2022.vsconfig file in the same folder.
The .vsconfig file comes with the Mission Planner repository—check the README to locate it.
Run installation (Admin mode)
Open Command Prompt as Administrator.
Run the installer with the .vsconfig file so the required workloads install automatically.
First run check
After installation, open the Mission Planner solution.
Confirm it builds without errors.
Tips & Notes:
If the installer has trouble downloading modules, ensure your internet is stable and try again.
Use the .vsconfig file to avoid missing workloads—this is critical for Mission Planner.
Once setup is complete, you should be able to open Mission Planner in Visual Studio and compile a clean build without crashes.
Outcome:
By the end of this lecture, you’ll have a clean Visual Studio 2022 v17.8 LTSC installation with all workloads configured, fully ready to build and debug Mission Planner.
Cloning the Mission Planner Repository
To build Mission Planner from source, you’ll need to clone the official repository into Visual Studio.
Steps:
Open Visual Studio 2022.
Go to Git → Clone a Repository.
Paste the official Mission Planner repository URL (you can find it by searching “Mission Planner GitHub repository”).
Choose a local path on your computer where you’d like to store the project.
Click Clone.
After cloning:
When the repository opens, let Visual Studio finish loading all projects.
Then open MissionPlanner.sln to access the main solution.
Notes:
Always perform a clean clone. Incomplete or interrupted downloads can cause errors.
A fast, stable internet connection is recommended.
If you encounter errors after cloning, check whether any submodules were missed — this is a common cause of build failures.
First Build: NuGet Restore and Project Indexing
Once you open the Mission Planner solution in Visual Studio, the environment will automatically start restoring NuGet packages and indexing all projects.
What to expect:
On first setup, this can take time depending on your internet speed and the number of modules.
It’s best to wait until the package restore is complete and Solution Explorer has stopped updating before you attempt a build.
For a clean first setup, allow 20–30 minutes for everything to settle.
Good signs of success:
Submodules are present from your clone.
NuGet restore completes without errors.
All projects show as loaded in Solution Explorer.
At this stage, you should have a very high chance of compiling Mission Planner without issues.
Troubleshooting tips:
If the clone appears complete but builds still fail, the server may have been unresponsive during the first attempt. Simply retry cloning later with a stable connection.
If you suspect a corrupted package download:
Go to Tools → NuGet Package Manager → Package Manager Settings.
Select Clear All NuGet Caches.
Run Restore again from the same menu.
Outcome:
After NuGet packages restore properly, you’ll be ready to build Mission Planner with a clean, stable setup.
Visual Studio 2022 — UI Basics
Before diving deeper into Mission Planner development, it’s important to get comfortable with the Visual Studio interface. In this lecture, you’ll learn how to navigate the core windows, menus, toolbars, and shortcuts that you’ll use constantly during development.
Core windows (panes you’ll use often):
Solution Explorer (View → Solution Explorer): Browse projects and files, set the Startup Project, and include/exclude files.
Properties (View → Properties Window): Displays properties for the selected control or file. Essential for WinForms/WPF design work.
Error List (View → Error List): Double-click any error to jump directly to its code location.
Output (View → Output): Shows build logs, NuGet restore activity, and debugger output.
Git Changes / Git Repository (View → Git…): Manage commits, branches, stashes, and history.
Terminal (View → Terminal): Run commands like git submodule update --init.
Search in Solution Explorer: Quickly locate files by typing in the search box at the top.
Layout Tip: If your windows get messy, use Window → Reset Window Layout. You can dock, float, or auto-hide any pane (look for the pin icon).
Menu bar (top):
File: Open/close solutions, manage accounts.
Edit: Find/replace, formatting, quick refactors (Ctrl+.).
View: Show/hide any window (Solution Explorer, Properties, Toolbox, etc.).
Git: Clone, pull, fetch, push, manage branches.
Project: Add references, manage NuGet packages.
Build: Build, clean, or rebuild solutions/projects.
Debug: Start/stop debugging, manage breakpoints, exception settings.
Test: Run unit tests (if present).
Analyze: Code analysis and performance tools.
Tools: NuGet Package Manager, Options, Import/Export Settings.
Extensions: Manage installed extensions or access Marketplace.
Window: Arrange windows, reset layout.
Help: Documentation, updates, “Report a Problem.”
Toolbars (below the menu):
Debug target & Start button (green): Run with/without debugging (F5 / Ctrl+F5).
Solution Config: Choose Debug or Release.
Target CPU: Select Any CPU or x64 (depending on solution).
Other tools: Live Share, branch indicator, notifications (depending on layout).
Customize: Right-click toolbar area → Customize. You can also toggle toolbars via View → Toolbars.
Toolbox (for designers):
Open with View → Toolbox or Ctrl+Alt+X.
Context-sensitive: shows controls when a designer (WinForms/WPF) is open.
Drag & drop controls (Button, Panel, Chart, etc.) onto forms.
Use the Properties window to edit Name, Text, Docking, colors, and events (double-click a control to auto-generate an event handler).
Organize with custom tabs: right-click inside Toolbox → Add Tab.
Status bar & background tasks (bottom):
Shows build progress, line/column numbers, and background tasks (e.g., NuGet restore, indexing).
Always wait for background tasks to finish before the first build.
Handy shortcuts:
Build Solution → Ctrl+Shift+B
Run (Debug) → F5
Run (No Debug) → Ctrl+F5
Quick Actions (fixes) → Ctrl+.
Navigate To (Go To) → Ctrl+T
Find in Files → Ctrl+Shift+F
Toggle Solution Explorer → Ctrl+Alt+L
Toolbox → Ctrl+Alt+X
VS 2022 — Debug Build (for Mission Planner)
Why Debug?
A Debug build turns off most compiler optimizations and includes full symbols (defines DEBUG, often TRACE). This makes stepping through code, inspecting variables, and diagnosing issues straightforward—binaries are larger/slower, which is fine for day-to-day development, unit tests, and breakpoint-driven debugging.
What you’ll do
Select the Debug configuration
Build the solution
Run under the debugger and verify symbols are loaded
Use breakpoints, Watch/Locals, Output, and Call Stack
Step-by-step
Open the solution
Open MissionPlanner.sln in Visual Studio 2022.
Let packages finish
Wait for NuGet restore and background indexing to complete (watch the bottom status bar).
Choose Debug config
Top toolbar → Solution Configurations: Debug.
Top toolbar → Solution Platforms: Any CPU (use x86 if you hit native DLL load errors).
Set startup project
Solution Explorer → right-click MissionPlanner → Set as Startup Project.
Build
Build → Build Solution (Ctrl+Shift+B).
Watch Output and Error List for a clean build.
Run with debugger
Press F5 (green button).
Open Debug → Windows → Modules and confirm PDBs are loaded for your projects.
Debug basics
Click the gutter to add a breakpoint
F10 step over / F11 step into / Shift+F11 step out
Inspect values in Locals, Autos, and your Watch list
Use Output for logs and Call Stack to trace flow
Quick checks (if something fails)
Missing references/projects: run git submodule update --init, then Restore NuGet Packages.
Native DLL not found: try x86 platform (or ensure required native files exist).
Weird build state: Build → Clean, then Rebuild; if needed, Tools → NuGet Package Manager → Package Manager Settings → Clear All NuGet Caches, then Restore.
Tips for smoother sessions
Debug → Options → General: keep Just My Code ON for simpler stepping.
Project → Properties → Build: ensure Optimize code is OFF in Debug (default).
Ctrl+Q (global search) to jump to Modules, Exception Settings, or Symbols.
Outcome
You’ll produce a reliable Debug build of Mission Planner, run it under the debugger with symbols loaded, and comfortably step through code using breakpoints and the key debug windows.
VS 2022 — Release Build (for Mission Planner)
Why Release?
A Release build enables compiler optimizations, removes the DEBUG constant (but usually keeps TRACE), and generates smaller, faster executables. Symbols are limited (pdb-only), so stepping through code is harder—but the output is optimized for end use. Use Release for final testing and shipping. Always verify behavior matches Debug, check for timing-sensitive logic, and confirm native DLLs are correctly included.
Steps:
Open the solution
Launch Visual Studio 2022.
Open MissionPlanner.sln.
Wait for NuGet restore and indexing to complete.
Pick the right configuration
Top toolbar → Solution Configurations: Release.
Solution Platforms: choose Any CPU (use x86 only if you encounter native DLL load issues).
Set startup & included projects
Solution Explorer → right-click MissionPlanner → Set as Startup Project.
Build → Configuration Manager…: make sure only the projects you actually need are checked for Build under Release (uncheck samples/tests to save time).
Build
Run Build → Clean Solution once.
Then Build → Rebuild Solution.
Monitor the Output and Error List windows for issues.
Verify artifacts
Check the output folder: MissionPlanner\bin\Release\
Confirm MissionPlanner.exe and required DLLs are present.
If you use native libraries (e.g., GDAL, FTDI), ensure the correct x86/x64 versions are copied alongside the EXE.
Run with Ctrl+F5 (without debugger) to sanity-check the main tabs.
Recommended Release settings (verify in Project Properties):
Configuration: Release
Optimize code: Enabled
Define DEBUG constant: Disabled
Define TRACE constant: Enabled (optional)
Advanced → Debug info: pdb-only (keeps smaller PDBs for crash analysis without full debug overhead)
Outcome:
By the end, you’ll produce a clean, optimized, ready-to-ship Release build of Mission Planner—ideal for packaging, testing, or distribution.
Clean Solution (VS 2022)
What it does
A Clean Solution removes all compiled outputs (bin/, obj/) for every project in your solution. This forces Visual Studio to rebuild everything from scratch on the next build. It does not delete your source code or NuGet packages.
When to use it
After switching between Debug ⇄ Release or Any CPU ⇄ x86
After large refactors or switching Git branches
When you hit strange build errors caused by stale artifacts
How to do it (GUI)
Go to Build → Clean Solution
Watch the Output window for “Clean succeeded.”
(Optional) Run Build → Rebuild Solution for a completely fresh compile.
Command line (optional advanced use)
From a Developer Command Prompt:
msbuild MissionPlanner.sln -t:Clean
msbuild MissionPlanner.sln -t:Rebuild -p:Configuration=Debug
If you’re working with SDK-style projects:
dotnet clean MissionPlanner.sln -c Debug
Deep clean (only if needed)
Manually delete each project’s bin/ and obj/ folders.
Clear NuGet caches: Tools → NuGet Package Manager → Package Manager Settings → General → Clear All NuGet Caches, then restore.
Gotchas (Mission Planner context)
Cleaning is safe — it won’t touch ExtLibs or Git submodules. But you must allow NuGet restore to finish before rebuilding.
If your project uses post-build steps to copy native DLLs, a Clean will remove them. Always run Rebuild (not just Build) after a Clean to restore those files.
Outcome
By the end, you’ll know how to reset your build environment and start fresh, eliminating most “weird build error” scenarios in Visual Studio.
Intro to C# Code, Design View, and Designer Files (WinForms)
When you create a Windows Forms project in C#, Visual Studio splits your form into three files that work together as a single class. Understanding these files is the key to keeping your project organized.
What each file does
MyForm.cs (Code/Logic):
This is where you write your own C# code—constructors, event handlers, timers, and background logic.
MyForm.Designer.cs (Designer/Layout):
Auto-generated code that describes your graphical elements. The designer writes this file when you drag and drop controls.
MyForm.cs (Design/View):
It created by VS 2022 using Code.cs and Code.Designer.cs. Its visualization the graphical elements and help developer to easily adjustment of representation and size of elements etc.
MyForm.resx (Resources):
Stores images, strings, and other localizable values used by the form.
All three files are combined into one class using partial classes. The constructor in MyForm.cs calls InitializeComponent(), which lives in .Designer.cs and builds the UI.
Design View (the visual editor)
Open: Right-click a form or control → View Designer (or press Shift+F7).
Add controls: Drag from View → Toolbox, place them on your form, and use Dock and Anchor for responsive layouts.
Configure: Use the Properties window to set values like Name, Text, Dock, etc.
Wire events: In the Properties window, click the lightning tab → double-click an event (like Click or Load) to auto-generate the handler in MyForm.cs.
Do’s & Don’ts
Do:
Keep layout in .Designer.cs and logic in .cs.
Make sure namespace and class names match across both partial files.
Use the Properties → Events panel to wire event handlers.
Commit both .cs and .Designer.cs files to source control.
Don’t:
Manually edit the Designer’s generated regions—always use Design View.
Put heavy runtime code directly in the constructor (guard it with if (!DesignMode)).
Rename or remove InitializeComponent() or forget to call it.
Common designer errors (and quick fixes)
“InitializeComponent not found” → Namespace or partial class mismatch. Ensure both files say partial class MyForm in the same namespace.
Designer crashes on open → Runtime code is executing at design time. Move it to Form_Load or guard with if (!DesignMode).
Missing event handler method → The Designer wired button_Click but you deleted or renamed it. Recreate the handler or reassign it in Properties → Events.
Ambiguous types (e.g., Timer) → Use the full name: System.Windows.Forms.Timer.
Core mental model
Design View edits .Designer.cs (UI layout).
You write logic in .cs (event handlers and code).
Together, they compile into one complete form class.
Difference Between Form, UserControl, and Component (C# / WinForms)
One-line definitions
Form → A top-level window (main app window or dialog) that has its own title bar, borders, minimize/close buttons, and can host other controls.
UserControl → A reusable, composite UI element built by combining existing controls. You drop it inside a Form or another container.
Component → A non-visual building block (logic/service) that appears in the designer but has no user interface. Examples: Timer, SerialPort, BackgroundWorker.
When to choose what
Form: Use when you need a standalone window or dialog.
Examples: main application shell, “Settings” window, “About” dialog.
UserControl: Use when you want a reusable piece of UI that can be placed on multiple tabs, panels, or forms.
Examples: a “Flight Status Panel,” a custom dashboard widget.
Component: Use when you need non-visual functionality that integrates with the designer, can be dropped onto a form, and is disposable.
Examples: handling serial communication, scheduling tasks, timers.
Key takeaway
Forms = full windows
UserControls = reusable UI blocks inside windows
Components = invisible helpers that provide background functionality
Adding a New Windows Form in Visual Studio
In Solution Explorer, right-click your project.
Select Add → Windows Form (C#).
Enter a name for your new form (for example, MyForm.cs).
Click Add.
Your new form will appear in Solution Explorer with three files:
MyForm.cs (your logic/code)
MyForm.Designer.cs (auto-generated layout)
MyForm.resx (resources, if needed)
Now you can open the form in Design View, drag controls from the Toolbox, and start building your UI.
Adding a New UserControl in Visual Studio
In Solution Explorer, right-click your project.
Select Add → User Control (C#).
Enter a name for your control (for example, StatusPanel.cs).
Click Add.
Visual Studio will generate two files for you:
StatusPanel.cs → where you write your logic (event handlers, custom behavior).
StatusPanel.Designer.cs → auto-generated layout code for the controls you place in Design View.
Now you can open the control in Design View, drag items from the Toolbox, and design your reusable panel. Once built, this UserControl can be dropped into a Form or another container just like any built-in control.
Adding a New Component in Visual Studio
In Solution Explorer, right-click your project.
Select Add → Component Class (C#).
Enter a name for your component (for example, HeartbeatService.cs).
Click Add.
This creates a new non-visual class that shows up in the Designer tray (below the form when open). Components are used for background services like timers, data handling, or serial communication.
Constructors in C# (with WinForms context)
What is a constructor?
A constructor is a special method that:
Has no return type
Shares the same name as the class
Runs once when you create an object
Lets you initialize fields, validate inputs, or wire events
If you don’t declare a constructor, the compiler provides a default parameterless constructor automatically.
Types of constructors
Default constructor → runs with no arguments if you don’t define one.
Parameterized constructor → lets you pass arguments when creating objects.
Overloaded constructors → you can define multiple constructors with different parameter sets.
Constructor chaining (: this(...)) → reuse logic between constructors in the same class.
Base chaining (: base(...)) → pass arguments to a parent class constructor.
Static constructor → declared as static ClassName(), runs once per type to initialize static state.
WinForms context (Mission Planner example)
A Form or UserControl constructor should always call InitializeComponent().
InitializeComponent() (generated in .Designer.cs) builds the UI defined in the designer.
Avoid heavy runtime work in the constructor because Visual Studio’s designer also instantiates your class.
Instead:
Move runtime setup to OnLoad or OnShown.
Or guard with:
if (!DesignMode)
{
// runtime-only code
}
Best practices
Keep constructors fast and simple.
Validate parameters (e.g., throw new ArgumentNullException(...)).
Use constructor injection for required dependencies, so your objects are always correctly set up.
Don’t put long-running operations inside constructors.
ShowDialog() vs. Show() in WinForms — Summary
ShowDialog() (Modal)
Blocks calling code until closed
Disables the owner form
Returns a DialogResult (OK/Cancel, etc.)
Use for confirmations, settings, or required user decisions
Show() (Modeless)
Returns immediately, owner stays interactive
No return value — handle outcomes with events (FormClosed)
Keep a reference to avoid duplicates
Use for tools, floating panels, or optional windows
Rule of thumb:
Use ShowDialog() when the user must finish the dialog before continuing.
Use Show() when the form is optional and can stay open alongside others.
To add a Form or UserControl inside the MissionPlanner → GCSViews folder (namespace), the process is the same as adding them anywhere in a WinForms solution — but you need to make sure the file lands in the correct folder and namespace.
1. Adding a Form (e.g., MyForm.cs)
In Solution Explorer, expand the MissionPlanner → GCSViews folder.
Right-click → Add → Windows Form (C#).
Name it MyForm.cs → click Add.
Visual Studio will generate:
MyForm.cs (your logic and constructor)
MyForm.Designer.cs (auto-generated layout)
MyForm.resx (resources)
Check that the namespace matches:
namespace MissionPlanner.GCSViews
{
public partial class MyForm : Form
{
public MyForm()
{
InitializeComponent();
}
}
}
2. Adding a UserControl (e.g., StatusPanel.cs)
In Solution Explorer, expand MissionPlanner → GCSViews.
Right-click → Add → User Control (C#).
Name it StatusPanel.cs → click Add.
Visual Studio generates:
StatusPanel.cs (your logic and constructor)
StatusPanel.Designer.cs (layout)
Ensure namespace:
namespace MissionPlanner.GCSViews
{
public partial class StatusPanel : UserControl
{
public StatusPanel()
{
InitializeComponent();
}
}
}
3. Using them inside Mission Planner
To open your Form:
var f = new MissionPlanner.GCSViews.MyForm();
f.Show(); // modeless
// f.ShowDialog(); // modal
To drop your UserControl into an existing Form (like FlightData.cs):
var panel = new MissionPlanner.GCSViews.StatusPanel();
this.Controls.Add(panel);
panel.Dock = DockStyle.Fill; // optional
This way your new Forms and UserControls are properly placed inside the GCSViews namespace and can be used anywhere else in Mission Planner.
Adding First Tab
Steps to Add a New Tab (Design View)
Open the FlightData Designer
In Solution Explorer → go to:
MissionPlanner → GCSViews → FlightData.cs
Right-click → View Designer.
Select the TabControl
Click on the tabControlactions in the designer (the one holding tabs like Quick, Actions, etc.).
Add a New Tab Option
Look at the top-right corner of the TabControl in the Designer → you’ll see a small arrow (smart-tag “TabControl Tasks”).
Click it → choose “Add Tab”.
A new TabPage will be created (by default named tabPage1).
Rename the Tab
With the new tab selected → in the Properties Window:
Set the (Name) property → e.g., tabMyFeature.
Set the Text property → e.g., "My Feature".
Add Controls to the Tab
Drag and drop any controls (e.g., Label, Panel, or your custom UserControl) onto the new tab.
If you created a custom control like StatusPanel, drag it from the Toolbox → drop it inside your new tab.
(Optional) set Dock = Fill so it resizes with the tab.
? Behind the Scenes (Designer Code)
Visual Studio will auto-generate code in FlightData.Designer.cs like this
Adding First Label
? Adding a Label to the Map Module (Design View)
Open the Designer
In Solution Explorer, open FlightData.cs → View Designer.
Locate the map control inside the form/tab (usually myMap or similar in Mission Planner).
Open the Toolbox
From the Visual Studio menu → View → Toolbox (or press Ctrl+Alt+X).
Expand the Common Controls section.
Drag a Label
From Toolbox → drag a Label control.
Drop it onto the map module (inside the map control area or the tab containing the map).
Change the Label Text
With the new label selected, go to the Properties Window.
Find the Text property.
Change it (e.g., "My Map Label").
? Optional Adjustments
Name property → rename it (e.g., lblMapInfo) so you can use it in code.
Font/Color → change via Properties (Font, ForeColor, BackColor).
Positioning → use mouse drag or set Location (X,Y) in Properties.
Now, from this point mission planner development practice is started and utilize your gain knowledge to apply in real development.
It is great feature to set your form at TopMost. it is very necessary to learn it and very useful for the development.
I recommend to practice with the video.
Please practice as shown in the video.
Timer vs. Loop in WinForms / Mission Planner
1. Timer
Event-driven: Fires a Tick (or Elapsed) event at a set interval (e.g., 100 ms).
Non-blocking: The UI thread keeps responding since the timer just posts events.
Best for:
Updating telemetry at steady intervals
Refreshing UI elements (labels, graphs)
Periodic checks (heartbeat, watchdogs)
2. Loop (while / for)
Continuous execution: Runs code repeatedly until stopped.
Blocking risk: while(true) on the UI thread will freeze Mission Planner unless you use Task.Delay or move it to a background thread.
Best for:
Long-running tasks (e.g., parsing logs, replaying SITL data)
Playback where precise delays are needed
Sequential processing where timer accuracy isn’t enough
? Rule of thumb:
Use a Timer for UI updates and periodic checks.
Use a Loop for long, sequential background tasks — but always run it async or off the UI thread.
First Data Receiving from UAV (with Timer in WinForms)
How it works
A WinForms Timer fires at a fixed interval (e.g., every 100–250 ms).
Each tick, it checks if the MAVLink connection is alive.
If connected, it reads telemetry (yaw, airspeed, etc.) from Mission Planner’s CurrentState.
The values are pushed into UI labels and QuickView widgets.
If not connected, the status label shows “No”.
Code walkthrough (line-by-line):
private void Data_Receiver_Timer_Tick(object sender, EventArgs e)
{
// 1) Are we connected?
if (MainV2.comPort.BaseStream.IsOpen)
{
// 2) Show connection state
label6.Text = "Yes";
// 3) Read live telemetry from CurrentState
Yaw_data.Text = $"{MainV2.comPort.MAV.cs.yaw:0.0}°";
Air_speed_Data.Text = $"{MainV2.comPort.MAV.cs.airspeed:0.0} m/s";
// 4) Update QuickView
quickView1.desc = MainV2.comPort.MAV.cs.GetFieldDesc("Yaw");
quickView1.number = MainV2.comPort.MAV.cs.yaw;
// Optional: color-code connection
label6.BackColor = Color.LightGreen;
}
else
{
// Not connected
label6.Text = "No";
label6.BackColor = Color.LightCoral;
}
}
Video narration (script):
“This timer fires on the UI thread and keeps our dashboard fresh.”
“IsOpen tells us if Mission Planner’s comPort is connected.”
“When connected, we pull yaw and airspeed from MAV.cs, which Mission Planner keeps updated from incoming MAVLink packets.”
“We display those values in labels and a QuickView—desc is the friendly label, number is the live value.”
“If the link drops, we flip the status label back to ‘No’.”
Polishing tips (for real projects):
Only set quickView1.desc once (e.g., in Form_Load), not on every tick.
Use units in labels (° and m/s).
Always null-check:
var cs = MainV2.comPort?.MAV?.cs;
if (MainV2.comPort?.BaseStream?.IsOpen == true && cs != null) { … }
Hooking the Timer (Form_Load example):
Data_Receiver_Timer.Interval = 200; // 5 Hz refresh
Data_Receiver_Timer.Tick += Data_Receiver_Timer_Tick;
Data_Receiver_Timer.Start();
By the end of this lesson, your form will show live Yes/No connection state, yaw, airspeed, and a QuickView widget — updated in real time from your UAV or SITL.
Installing Windows Subsystem for Linux (WSL)
1. Enable Windows features
Click Start → Search → “Turn Windows features on or off”.
Enable:
Windows Subsystem for Linux
Virtual Machine Platform
Restart your PC (a reboot is recommended).
2. Install a Linux distribution
Open Command Prompt or PowerShell as Administrator.
Run the following commands:
wsl --list --online # shows available distros
wsl --install -d Ubuntu # installs Ubuntu
On first launch, create your Linux username and password.
Update WSL:
wsl --update
3. Optional: GUI helper
You can also search in the Microsoft Store for “WSL Toolbox Beta” — a graphical helper that makes managing WSL easier.
After this setup, you’ll have Ubuntu running inside Windows via WSL — ready for development and Mission Planner build tools.
Download and Install VS Code (with WSL integration)
1. Install VS Code
Download and install Visual Studio Code on Windows.
On first launch, VS Code usually detects WSL automatically and prompts to install the required extension.
2. If not detected automatically
Open VS Code.
Press Ctrl+Shift+X (Extensions view).
Search for “Remote - WSL”.
Install the extension published by Microsoft.
3. Connect to WSL
After installation, look at the bottom-right corner of VS Code.
Click the WSL Indicator → choose your Linux distribution (e.g., Ubuntu).
VS Code will reconnect and open a remote WSL session where you can edit files directly inside Linux.
With this setup, VS Code becomes your development editor inside WSL — seamless editing, debugging, and terminal access without leaving Windows.
Cloning the ArduPilot Repository in WSL
1. Open Ubuntu (WSL)
From the Start menu, search for Ubuntu (or your chosen Linux distro).
Launch it to open a Linux terminal.
2. Clone the ArduPilot repo
Run the following commands in order:
# Clone the ArduPilot repository
# Enter the new folder
cd ardupilot
# Initialize submodules
git submodule init
# Update all submodules (recursive)
git submodule update --recursive
3. What these commands do
git clone … → downloads the ArduPilot code from GitHub.
git submodule init → prepares the submodules that ArduPilot depends on.
git submodule update --recursive → pulls all nested submodules so your clone is complete.
After this step, your WSL environment will have a full copy of the ArduPilot source code, ready for building SITL (Software-In-The-Loop) or customizing Mission Planner integration.
Setting Up the ArduPilot Build Environment (WSL)
1. Navigate to the install script
After cloning the repository, move into the setup folder:
cd ardupilot
cd Tools
cd environment_install
2. Run the prerequisites installer
bash install-prereqs-ubuntu.sh
This script will download and install all the required packages (Python tools, compilers, libraries).
During installation, you may be prompted to confirm actions — type Yes and continue until the end.
3. What’s happening here
The script prepares your Linux environment so you can build and run ArduPilot SITL.
It installs MAVLink libraries, compilers, and mission control dependencies.
After completion, your system will be ready for compiling ArduPilot code.
4. Notes & Tips
Occasionally, MAVLink setup can cause issues during simulation or after an incomplete clone.
If this happens, double-check that:
Your git submodule update --recursive finished cleanly.
MAVLink and MAVProxy are installed properly (they come as part of this script, but sometimes need manual fixes).
For troubleshooting, consult the ArduPilot documentation or community forums on MAVLink and MAVProxy.
After this step, your WSL environment will have all the required dependencies installed and you’ll be ready to compile and run SITL simulations.
Running ArduPilot SITL (Simulation)
1. Navigate to the autotest folder
After setting up the environment, move into the simulation scripts:
cd ardupilot
cd Tools
cd autotest
2. Launch the simulator
Run the following command:
./sim_vehicle.py -v ArduPlane -f plane --console --map
3. What each part means
./ → Current path (run the script from here)
sim_vehicle.py → Creates and launches the simulation
-v ArduPlane → Vehicle type (here: fixed-wing aircraft)
-f plane → Frame type (vehicle model to simulate)
--console → Opens a terminal window for vehicle control
--map → Loads a map display; if everything is correct, you’ll see the simulated vehicle appear
4. Expected result
A console window opens, showing SITL boot messages.
A map window appears with your simulated ArduPlane.
You can now send commands, change modes, and interact with the simulated UAV.
At this stage, you’ve gone from cloning ArduPilot → installing prerequisites → launching SITL. You now have a working virtual UAV ready for testing.
Installing ArduPilot Prerequisites on Windows
ArduPilot provides a PowerShell script to automatically install all required tools on Windows (Cygwin, compilers, libraries, and dependencies).
1. Locate the script
You can find the script in two places:
Inside the repo:
ardupilot/Tools/environment_install/install-prereqs-windows.ps1
Or inside WSL:
\\wsl.localhost\Ubuntu\home\<your-username>\ardupilot\Tools\environment_install\install-prereqs-windows.ps1
Copy this file to any folder you want (e.g., your Desktop).
2. Unblock the file (important)
Right-click install-prereqs-windows.ps1 → Properties
At the bottom, check Unblock → Apply → OK
3. Run the script in PowerShell
Open PowerShell as Administrator
Run: powershell -ExecutionPolicy Bypass -File "C:\Users\Autobot\Desktop\install-prereqs-windows.ps1"
4. What happens
The script will download all required files.
It will install Cygwin and all supporting packages needed for ArduPilot development on Windows.
Once finished, your Windows system will be ready for building and testing.
After this step, you’ll have a fully configured Windows environment for compiling and running ArduPilot, parallel to your WSL setup.
Cloning and compiling ArduPilot in Cygwin (Windows)
1. Open Cygwin
Navigate to C:\cygwin64\
Double-click Cygwin.bat to open the terminal.
2. Clone the ArduPilot repository
Inside the Cygwin terminal, run: cloning command as did in WSL.
This will download the ArduPilot source code into a new ardupilot folder.
3. Initialize submodules
After cloning, enter the new directory and set up submodules:
cd ardupilot
git submodule init
git submodule update --recursive
git submodule init → prepares the submodules.
git submodule update --recursive → downloads all required submodules (including nested ones).
4. Expected result
You now have a complete ArduPilot codebase inside your Cygwin environment.
This includes SITL, MAVLink, and all required supporting modules.
After this step, you’ll be ready to build ArduPilot on Windows using Cygwin and the provided tools.
Connecting Mission Planner to SITL (Simulation)
When you launch SITL, Mission Planner can connect automatically using standard ports.
Common connection types:
UDP (most common):
Address: 127.0.0.1
Port: 14550
This is the default for SITL → Mission Planner.
Mission Planner usually auto-detects and connects here.
TCP (alternate):
Address: 127.0.0.1
Ports: 5760, 5761, 5762
These are additional TCP endpoints SITL may open.
Useful if you want to connect multiple GCS clients or testing tools.
How to check in Mission Planner:
Open Mission Planner.
In the top-right Connection panel, choose:
UDP → Port 14550 (first try this, it usually autoconnects).
If that fails, try TCP → Port 5760 (or 5761/5762).
Click Connect.
If successful, you’ll see heartbeats and HUD data start updating.
Summary:
By default, SITL → Mission Planner uses UDP 14550.
If UDP doesn’t connect, use TCP 5760/5761/5762.
Mission Planner often auto-connects without any manual configuration.
Adding Main Menu button in MainV2.cs
Please do the practice.
Creating a Mission Planner Installer with Inno Setup
What is Inno Setup?
A free, lightweight, script-driven installer tool for Windows (first released in 1997).
Packages your app into a professional setup.exe.
Adds support for installation, uninstallation, shortcuts, drivers, and more.
Key features:
Supports Windows XP → Windows 11 (32/64-bit).
Small, fast, and highly compressed installers (LZMA).
Custom scripting (Pascal) for advanced logic.
Built-in uninstaller.
Multilingual support.
Code signing (digital signatures).
Optional silent installs.
Workflow
Install Inno Setup Compiler.
Write a .iss script that defines your installer.
Compile the script → produces setup.exe.
Distribute the installer.
Example Installer Script
; Mission Planner Installer with Driver Support
[Setup]
AppName=Mission Planner
AppVersion=1.0
DefaultDirName={pf}\Mission Planner
DefaultGroupName=Mission Planner
UninstallDisplayIcon={app}\MissionPlanner.exe
OutputBaseFilename=MissionPlannerSetup
Compression=lzma
SolidCompression=yes
[Files]
; Main application files
Source: "C:\Users\shahz\source\repos\MissionPlanner\bin\Release\net461\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs
; Include driver installer
Source: "C:\Users\shahz\source\repos\MissionPlanner\bin\Release\net461\Drivers\DPInstx64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
[Icons]
Name: "{group}\Mission Planner"; Filename: "{app}\MissionPlanner.exe"
Name: "{group}\Uninstall Mission Planner"; Filename: "{uninstallexe}"
[Run]
; Run driver installer silently
Filename: "{tmp}\DPInstx64.exe"; Parameters: "/S /LM"; StatusMsg: "Installing USB Drivers..."; Flags: waituntilterminated
; Run Mission Planner after install (optional)
Filename: "{app}\MissionPlanner.exe"; Description: "Launch Mission Planner"; Flags: nowait postinstall skipifsilent
How to Use This Script
Build Mission Planner in Release mode so compiled files are in:
C:\Users\<yourname>\source\repos\MissionPlanner\bin\Release\net461\
Adjust file paths in the [Files] section if your build directory is different.
Open Inno Setup Compiler.
Save the script as MissionPlannerInstaller.iss.
Click Compile → the installer (MissionPlannerSetup.exe) will be created in the .\Output folder.
With this, you’ll have a clean, professional installer that installs Mission Planner, configures drivers, adds Start Menu/desktop shortcuts, and supports safe uninstall.
Go beyond flying and start building your ideas into real Ground Control Station features.
This course takes you inside the Mission Planner codebase, enabling you to design, extend, and deliver custom Ground Control Station (GCS) features using C#/.NET and Visual Studio. Rather than treating Mission Planner as a black box, you will learn how it is structured internally and how to safely modify and extend it for UAV development, academic research, and simulation-based experimentation. The course emphasizes hands-on learning, simulation-first development, and open-source workflows, allowing you to test ideas without real-world flight risk.
What you’ll learn
Download and install Mission Planner to gain an overview of its core usage and functionality.
Explore the Mission Planner user interface and understand its core operational components.
Run the built-in Mission Planner simulation and perform a first simulated UAV flight using lightweight ArduPilot firmware optimized for rapid feature testing.
Set up and use Visual Studio 2022 (version 17.8) for stable Mission Planner development, VS Code for ArduPilot development, and Git for version control and repository cloning.
Learn the fundamentals of the Visual Studio IDE, including project structure, build configurations, and core development tools.
Compile Mission Planner and understand the differences between Debug and Release builds, including proper solution cleaning methods.
Understand C# code files, the Design View, and the Designer file, and how they work together in WinForms applications.
Learn the differences between Forms, UserControls, and Components, and identify appropriate use cases for each within Mission Planner.
Add and customize UI elements such as tabs, labels, menus, timers, and controls following Mission Planner design patterns.
Create custom forms (modal vs. non-modal), manage form behavior, and correctly use TopMost and ShowDialog().
Understand loops versus timers and their correct usage in Ground Control Station software.
Perform basic telemetry and data wiring to display live values in custom UI widgets.
Install and configure WSL and Cygwin from scratch for ArduPilot development.
Clone, build, and run ArduPilot firmware for simulation on both Windows and Linux.
Package Mission Planner builds using Inno Setup to create a distributable installer.
Tools covered
Open Source Mission Planner and ArduPilot
Visual Studio 2022 (Version 17.8) C# / .NET and WinForms
Git
Inno Setup
Windows Subsystem for Linux (WSL)
Cygwin