Skip to content

Comments

packaging: add PX4 SITL .deb package#26495

Open
mrpollo wants to merge 8 commits intomainfrom
mrpollo/deb-package
Open

packaging: add PX4 SITL .deb package#26495
mrpollo wants to merge 8 commits intomainfrom
mrpollo/deb-package

Conversation

@mrpollo
Copy link
Contributor

@mrpollo mrpollo commented Feb 16, 2026

Single .deb package for PX4 SITL with Gazebo Harmonic resources. Installs to /opt/px4-sitl with a px4-sitl wrapper script symlinked to /usr/bin.

Changes:

  • cmake/package.cmake: CPack config for px4-sitl .deb with minimal Gazebo runtime deps
  • platforms/posix/CMakeLists.txt: install targets for Gazebo models, worlds, plugins
  • Tools/packaging/px4-sitl.sh: launcher script (XDG dirs, gz_env.sh generation, dartsim symlink fix)
  • Tools/packaging/postinst, postrm: create/remove /usr/bin/px4-sitl symlink
  • .github/workflows/build_deb_package.yml: CI to build and validate the .deb
  • docs/en/packaging/px4_sitl_deb.md: usage and build docs

Tested with PX4_SIM_MODEL=gz_x500 and sihsim_quadx in Ubuntu 24.04 container.

@github-actions
Copy link

github-actions bot commented Feb 16, 2026

No broken links found in changed files.

@mrpollo mrpollo force-pushed the mrpollo/deb-package branch 4 times, most recently from 5b0f78f to 021d189 Compare February 17, 2026 07:28
@mrpollo mrpollo marked this pull request as ready for review February 17, 2026 07:57
@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-dev-call-feb-18-2026-team-sync-and-community-q-a/48516/2

Comment on lines 65 to 71
### Multi-Instance

```bash
PX4_SIM_MODEL=gz_x500 px4-sitl -i 0
PX4_SIM_MODEL=gz_x500 px4-sitl -i 1
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also work for SIH? I assume this must be done in separate command prompts?

Maybe something like:

Suggested change
### Multi-Instance
```bash
PX4_SIM_MODEL=gz_x500 px4-sitl -i 0
PX4_SIM_MODEL=gz_x500 px4-sitl -i 1
```
### Multi-Instance
Multiple simulated vehicle instances can be started by passing the `-i` argument with an instance number.
For example, to start an instance of a X500 Quad and a Cessna in Gazebo you could enter the following commands in separate command shells:
```sh
PX4_SIM_MODEL=gz_x500 px4-sitl -i 0
```
```sh
PX4_SIM_MODEL=gz_rc_cessna px4-sitl -i 1
```
The instance number determines the UDP address for each vehicle in MAVLink.

What happens if I mix and match the different packages above?

@@ -0,0 +1,195 @@
# PX4 SITL .deb Packages
Copy link
Contributor

@hamishwillee hamishwillee Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrpollo This feature is awesome, and this document is very succint. I am not however certain it is correctly positioned for audience.

In this section we're talking to people setting up their environment for the first time, they don't necessarily know what SITL, SIH, worlds, models, etc are.

The most important thing to present to them is "why this" - at the level of the reader. I suspect there are two reasons:

  • To test ROS applications
  • To just give simulation a go

Where it lives and how it is named depends on your answer to that question.

And depending on that answer it might be worth having two docs. I would be tempted to have a short intro doc that covers the minimum here:

Image

This doc could then be linked and live in simulation.

Or even have an intro to this in the Ubuntu dev setup.

Add cmake/cpack infrastructure and a CI workflow to build .deb packages
for PX4 SITL. The px4-sitl package bundles the PX4 binary, ROMFS,
Gazebo models/worlds/plugins, and a wrapper script that configures
the runtime environment.

Key pieces:
- cmake/package.cmake: cpack configuration for the .deb
- platforms/posix/CMakeLists.txt: install rules gated behind
  CPACK_DEBIAN_PACKAGE_NAME (skipped for emscripten builds, legacy
  install targets excluded)
- Tools/packaging/: wrapper script, postinst/postrm maintainer scripts
- .github/workflows/build_deb_package.yml: matrix CI across
  noble/jammy x amd64/arm64 with ccache, validation, and artifact upload
- docs/en/packaging/px4_sitl_deb.md: installation and usage docs

Signed-off-by: Ramon Roche <rroche@linuxfoundation.org>
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Add a lightweight SIH build variant that excludes Gazebo modules,
producing a smaller px4-sitl-sih .deb with no simulator dependencies.

- boards/px4/sitl/sih.px4board: new board config without gz modules
- cmake/package.cmake: conditional package name, install prefix, and
  maintainer scripts based on target
- Tools/packaging/sih/: dedicated postinst/postrm in subdirectory
  for dpkg compatibility
- Workflow matrix expanded with sih jobs using --no-sim-tools

Signed-off-by: Ramon Roche <rroche@linuxfoundation.org>
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
- Downgrade workflow permissions to read-only
- Skip Gazebo install for SIH builds (--no-sim-tools)
- Use per-target ccache keys to avoid cache pollution between
  default and sih builds

Signed-off-by: Ramon Roche <rroche@linuxfoundation.org>
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Move ccache, build, cpack, validate, and upload steps into a reusable
composite action at .github/actions/build-deb/action.yml. Other
workflows can now build .deb packages with a single step.

Inputs: target, artifact-name, ccache-key-prefix, ccache-max-size.

Uses grep > /dev/null instead of grep -q to avoid broken-pipe
failures under bash pipefail (which composite actions enable via
shell: bash).

Signed-off-by: Ramon Roche <rroche@linuxfoundation.org>
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Replace the "Connect with" column (QGroundControl, MAVSDK, etc.) with a
"Link" and "Mode" column sourced directly from px4-rc.mavlink comments
and flags. Remove the QGroundControl auto-connect paragraph and the
MAVSDK connection example since neither was sourced from the codebase.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
- px4-sitl-sih → px4 (installs to /opt/px4, /usr/bin/px4)
- px4-sitl → px4-gazebo (installs to /opt/px4-gazebo, /usr/bin/px4-gazebo)
- Remove wrapper script for the px4 (SIH) package; bake install prefix
  into the binary at build time via PX4_INSTALL_PREFIX so it locates
  its ROMFS and XDG working directory without any wrapper
- Keep a minimal px4-gazebo.sh wrapper only for Gazebo (sets GZ_SIM_*
  env vars pointing at installed models/worlds/plugins)
- Add mkdir_p() to change_directory() so XDG paths with multiple new
  components are created correctly
- Update CI validation steps and artifact globs for new names
- Update docs: reframe page around full SITL experience with no build
  setup, address all hamish review comments, move page from Getting
  Started to Simulation section, add tip callout in simulation/index.md
@mrpollo mrpollo force-pushed the mrpollo/deb-package branch from 57cdde3 to 05e5cdb Compare February 19, 2026 04:12
Replace multi-line ternary with if/else block to satisfy astyle's
tab-based alignment rules. Store getenv("HOME") in a local variable
so clang-tidy's StringChecker can verify the null check applies to
the same pointer used in std::string construction.
The astylerc uses break-blocks=all which requires a blank line after
closing braces. Fix the missing blank line between the else block and
the following working_directory assignment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants