← Drones with Go

GO DRONE PROGRAMMING · FLIGHT SIMULATOR · 6 LESSONS

Missions, safety and fleets

Waypoint missions and the MAVLink mission protocol, geofences, failsafes and energy budgets, A* around no-fly zones, fleets with goroutines, and seeded scenario tests.

  1. Waypoint missions: mission items, the MAVLink upload protocol and a survey pattern

    Model a mission as numbered MAVLink-style items with acceptance radii and hold times, explain how MISSION_COUNT, MISSION_REQUEST_INT, MISSION_ITEM_INT and MISSION_ACK move it to the vehicle with retries, and generate and fly a lawnmower survey.

    6 min · Worked lesson

  2. Geofencing: inclusion and exclusion polygons, ray casting and predicting a breach

    Implement point-in-polygon with an explicit boundary rule, combine inclusion zones, exclusion zones and a ceiling, predict the time to the boundary from velocity, and compare a reactive fence with a predictive guard in the simulator.

    6 min · Worked lesson

  3. Failsafes: battery energy budgets, link-loss timeouts and which action wins

    Explain state of charge and voltage sag, estimate the charge needed to fly home against the wind with a reserve, compare that budget with fixed battery thresholds in the simulator, and design link-loss timeouts and failsafe priorities.

    7 min · Worked lesson

  4. Path planning around no-fly zones: A*, line-of-sight pruning and replanning

    Rasterize no-fly zones into an inflated grid, find the shortest path with A* and the admissible octile heuristic, prune it to a few waypoints by line of sight, fly it in the simulator and replan when a new restriction appears.

    5 min · Worked lesson

  5. Fleets from Go: a goroutine per vehicle, telemetry fan-in and separation

    Structure a multi-vehicle ground station with one goroutine per vehicle, fan telemetry into a supervisor over channels, stop everything with context cancellation and monitor pairwise separation with altitude layers, while keeping the simulation deterministic.

    5 min · Worked lesson

  6. Testing drone software: seeded scenarios, invariants, SITL, HIL and CI

    Build a deterministic, table-driven scenario matrix for a mission, check safety invariants and expected outcomes on every run, and place it in a test pyramid with software in the loop, hardware in the loop and continuous integration.

    6 min · Worked lesson