Instructions for AI coding agents (Codex, Claude Code, etc.) working on QGroundControl.
- CODING_STYLE.md — Naming, formatting, C++20 features, QML style, logging
- .github/CONTRIBUTING.md — Architecture patterns (Fact System, Multi-Vehicle, FirmwarePlugin)
- tools/README.md — Development scripts, tooling, and every
justrecipe - test/README.md — Test framework, base classes, CTest labels, MultiSignalSpy, sanitizers, coverage
- cmake/README.md — CMake modules, presets, and test options
- .github/ci-overview.md — What runs on a pull request, CI invariants, and how-tos (a failed check, workflows, dependencies); design notes in
.github/ci-notes/ - .pre-commit-config.yaml — Lint hooks (
just lintruns every hook not markedmanual)
Before modifying any repository file:
- Read CODING_STYLE.md completely.
- Read the task-specific references listed in this file.
- Do not begin editing until those reads are complete.
- Before the first edit, state in a progress update which instruction files were read.
These are the non-negotiables. The first four are QGC's core architecture patterns. The pre-commit hook named in a rule fails CI on a violation. Full list with code examples: .github/CONTRIBUTING.md#architecture-patterns and CODING_STYLE.md#common-pitfalls.
- Fact System — ALL vehicle parameters flow through Facts; never create custom parameter storage.
- Multi-Vehicle — ALWAYS null-check
activeVehicle()/Vehicle*before dereferencing (vehicle-null-checkflags uncheckedactiveVehicle()results). - Firmware Plugin — use
vehicle->firmwarePlugin()for firmware-specific behavior, notif (px4)branches. - QML Integration — register types with
QML_ELEMENT/QML_SINGLETON/QML_UNCREATABLE; expose state viaQ_PROPERTY. - No
Q_ASSERTin production code — use defensive checks with early returns (check-no-qassert). - No
QTest::ignoreMessagein tests — useexpectLogMessage/ignoreLogMessage(check-no-qtest-ignore-message). - No fixed-delay
QTest::qWait(<n>)— useQTRY_*_WITH_TIMEOUTorQSignalSpy::wait(check-no-fixed-qwait). - Comments — prefer self-documenting code; comment only non-obvious intent, constraints, or workarounds.
src/FactSystem/Fact.h— Parameter system foundationsrc/Vehicle/Vehicle.h— Core vehicle modelsrc/FirmwarePlugin/FirmwarePlugin.h— Firmware abstraction
Key modules (src/ has about 30 subdirectories):
src/
├── Vehicle/ # Vehicle state/comms
├── Comms/ # Link layer (serial, UDP, TCP, Bluetooth)
├── FactSystem/ # Parameter management
├── FirmwarePlugin/ # PX4/ArduPilot abstraction
├── AutoPilotPlugins/ # Vehicle setup UI
├── MissionManager/ # Mission planning
├── MAVLink/ # Protocol handling
├── VideoManager/ # Video pipeline (GStreamer)
├── FlyView/ # In-flight UI
├── PlanView/ # Mission planning UI
├── QmlControls/ # Reusable QML components
└── Settings/ # Persistent settings
The just recipes are the canonical workflow — see tools/README.md for the full list. They
configure and build build/ with the default* preset for BUILD_TYPE (default Debug, tests enabled).
just qt # install the pinned Qt into ~/Qt; does nothing when configure already finds it
just configure # CMake configure through the default preset
just build # incremental build; uses all cores (override with JOBS=N)
just test # ctest --preset default, LABELS="Unit|Integration" EXCLUDE="Flaky|Network"
just lint # prek run --all-files (the pre-commit hooks)
just lint-docs # only the docs hooks, on docs/en pages (pass --changed for branch changes)
just test-python # pytest for tools/tests with CI's dependency groups (CI script tests in tools/tests/ci)
just check # lint + test-python + test
just format-fix # apply clang-format to changed lines
just format-fix-python # apply ruff's lint fixes and formatting (the ruff hooks only report)
just info # print configured versions (Qt, CMake minimum, GStreamer) and build settings- Build incrementally — rebuild every few file edits during multi-file C++/Qt work, not just at the end; fix build errors before continuing.
- Tight test loops — iterate one test with
ctest --test-dir build -R <name>orbuild/Debug/QGroundControl --unittest:<name>(Linux path); runjust teston the final pass. - Match CI — Linux CI runs the
Unitand then theIntegrationlabel as separate CTest runs, excludingFlaky|Network, in theLinux-coverageandLinux-sanitizers(ASan + UBSan; also excludesNoSanitizer) presets. Reproduce a sanitizer failure withcmake --workflow --preset Linux-sanitizers(needsQT_ROOT_DIR) and coverage withjust coverage. CI lints only the files changed from the PR base, likeuv run --frozen --project tools --group dev python tools/pre_commit.py --changed. See .github/ci-overview.md for the rest.
Before considering a change complete:
just buildsucceeds.just lintpasses.- Relevant tests pass:
ctest --test-dir build -R <name>for the touched area,just test-pythonfor Python tooling, andjust teston the final pass. - Commit message follows Conventional Commits (below).
Commit messages follow Conventional Commits — the type decides the release-notes section
(tools/configs/cliff.toml → git-cliff). Use: feat, fix, perf, revert (listed in release notes);
docs, style, chore, refactor, test, build, ci (omitted unless breaking). Example: fix(Vehicle): guard null activeVehicle in telemetry handler.
prek install adds a commit-msg hook that checks this format; Renovate's deps type, fixup!/squash!,
merge, and revert messages also pass.
Keep pull request history intentional and easy to review. Organize related work into coherent commits and combine fixups or closely related incremental changes before publication. Avoid a trail of tiny work-in-progress, cleanup, or review-fix commits. Each commit should represent a clear, reviewable change without mixing unrelated work.
Your output will be reviewed by another AI agent before being accepted. Keep changes focused and minimal, use clear naming, and leave explanatory commit messages. Avoid unrelated changes, commented-out code, or ambiguous TODOs.
Key Principle: Match the style of code you're editing. See CODING_STYLE.md for conventions and CODING_STYLE.md#examples for canonical Vehicle/Fact/QML snippets.