Contributing to PX4-Autopilot

July 23, 2026 ยท View on GitHub

We follow the GitHub flow development model.

Fork the project, then clone your repo

First fork and clone the project.

Create a feature branch

Always branch off main for new features.

git checkout -b mydescriptivebranchname

Edit and build the code

The developer guide explains how to set up the development environment on Mac OS, Linux or Windows.

Coding standards

All C/C++ code must follow the PX4 coding style. Formatting is enforced by astyle in CI (make check_format, ``make format, make format_changed`). Code quality checks run via clang-tidy. Pull requests that fail either check will not be merged.

Python code is checked with mypy and flake8.

Commit message convention

PX4 uses conventional commits for all commit messages and PR titles.

Format

type(scope): short description of the change
PartRule
typeCategory of change (see types table below)
scopeThe module, driver, board, or area of PX4 affected
! (optional)Append before : to mark a breaking change
descriptionWhat the change does, at least 5 characters, written in imperative form

Types

TypeDescription
featA new feature
fixA bug fix
docsDocumentation only changes
styleFormatting, whitespace, no code change
refactorCode change that neither fixes a bug nor adds a feature
perfPerformance improvement
testAdding or correcting tests
buildBuild system or external dependencies
ciCI configuration files and scripts
choreOther changes that don't modify src or test files
revertReverts a previous commit

Scopes

The scope identifies which part of PX4 is affected. Common scopes:

ScopeArea
ekf2Extended Kalman Filter (state estimation)
mavlinkMAVLink messaging protocol
commanderCommander and mode management
navigatorMission, RTL, Land, and other navigation modes
sensorsSensor drivers and processing
driversHardware drivers
boards/px4_fmu-v6xBoard-specific changes (use the board name)
mc_att_controlMulticopter attitude control
mc_pos_controlMulticopter position control
fw_att_controlFixed-wing attitude control
vtolVTOL-specific logic
actuatorsMixer and actuator output
batteryBattery monitoring and estimation
loggerOn-board logging
paramParameter system
simulationSITL, Gazebo, SIH
ciContinuous integration and workflows
docsDocumentation
buildCMake, toolchain, build system
uorbInter-module messaging

For changes spanning multiple subsystems, use the primary one affected. Look at the directory path of the files you changed to find the right scope: src/modules/ekf2/ uses ekf2, src/drivers/imu/ uses drivers/imu, .github/workflows/ uses ci.

Breaking changes

Append ! before the colon to indicate a breaking change:

feat(ekf2)!: remove deprecated height fusion API

Good commit messages

feat(ekf2): add height fusion timeout
fix(mavlink): correct BATTERY_STATUS_V2 parsing
refactor(navigator): simplify RTL altitude logic
ci(workflows): migrate to reusable workflows
docs(ekf2): update tuning guide
feat(boards/px4_fmu-v6x)!: remove deprecated driver API
perf(mc_rate_control): reduce loop latency

Commits to avoid

These will be flagged by CI and should be squashed or reworded before merging:

fix                                    # too vague, no type or scope
update                                 # too vague, no type or scope
ekf2: fix something                   # missing type prefix
apply suggestions from code review     # squash into parent commit
do make format                         # squash into parent commit
WIP: trying something                  # not ready for main
oops                                   # not descriptive

PR titles

The PR title follows the same type(scope): description format. This is enforced by CI and is especially important because the PR title becomes the commit message when a PR is squash-merged.

Merge policy

Commits should be atomic and independently revertable. Squash at reviewer discretion for obvious cases (multiple WIP commits, messy review-response history). When your commits are clean and logical, they will be preserved as individual commits on main.

Cleaning up commits

If CI flags your commit messages, you can fix them with an interactive rebase:

# Squash all commits into one:
git rebase -i HEAD~N   # replace N with the number of commits
# mark all commits except the first as 'squash' or 'fixup'
# reword the remaining commit to follow the format
git push --force-with-lease

# Or reword specific commits:
git rebase -i HEAD~N
# mark the bad commits as 'reword'
git push --force-with-lease

AI-assisted contributions

AI coding assistants are welcome, under the AI coding assistants policy:

  • You are the author. You must understand, and be able to defend, every line you submit. An AI tool is never an author or co-author, and never appears in a Signed-off-by tag.
  • Disclosure is required. Every commit with AI-generated or AI-assisted content must carry an Assisted-by: NAME:MODEL trailer in the commit body (for example Assisted-by: Claude:claude-fable-5).
  • All licensing, testing, and review requirements apply unchanged. Never claim testing that did not happen.

Test your changes

PX4 is safety-critical software. All contributions must include adequate testing where practical:

  • New features must include unit tests and/or integration tests that exercise the new functionality, where practical. Hardware-dependent changes that cannot be tested in SITL should include bench test or flight test evidence.
  • Bug fixes must include a regression test where practical. When automated testing is not feasible (hardware-specific issues, race conditions, etc.), provide a link to a flight log demonstrating the fix and the reproduction steps for the original bug.
  • Reviewers will verify that tests or test evidence exist before approving a pull request.

Types of tests

Test typeWhen to useHow to run
Unit tests (gtest)Module-level logic, math, parsingmake tests
SITL integration tests (MAVSDK)Flight behavior, failsafes, missionstest/mavsdk_tests/
Bench tests / flight logsHardware-dependent changesUpload logs to Flight Review

Since we care about safety, we will regularly ask you for test results. Best is to do a test flight (or bench test where it applies) and upload the log file from it (on the microSD card in the logs directory) to Google Drive or Dropbox and share the link.

Push your changes

Push changes to your repo and send a pull request.

Make sure to provide some testing feedback and if possible the link to a flight log file. Upload flight log files to Flight Review and link the resulting report.