mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 22:32:11 +08:00
381149fb01
Build all targets / Scan for Board Targets (push) Has been cancelled
Checks / Gate Checks [check_format] (push) Has been cancelled
Checks / Gate Checks [check_newlines] (push) Has been cancelled
Checks / Gate Checks [module_documentation] (push) Has been cancelled
Checks / Gate Checks [shellcheck_all] (push) Has been cancelled
Checks / Gate Checks [validate_module_configs] (push) Has been cancelled
Checks / Unit Tests (push) Has been cancelled
Static Analysis / Clang-Tidy (push) Has been cancelled
MacOS build / build (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:22.04) (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:24.04) (push) Has been cancelled
Container build / Set Tags and Variables (push) Has been cancelled
Failsafe Simulator Build / build (failsafe_web) (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v5x (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v6x (push) Has been cancelled
ITCM check / Checking nxp_mr-tropic (push) Has been cancelled
ITCM check / Checking nxp_tropic-community (push) Has been cancelled
ITCM check / Checking px4_fmu-v5x (push) Has been cancelled
ITCM check / Checking px4_fmu-v6xrt (push) Has been cancelled
MAVROS Tests / MAVROS Mission (push) Has been cancelled
MAVROS Tests / MAVROS Offboard (push) Has been cancelled
Python CI Checks / build (push) Has been cancelled
ROS Integration Tests / build (push) Has been cancelled
ROS Translation Node Tests / Build and test [humble] (push) Has been cancelled
ROS Translation Node Tests / Build and test [jazzy] (push) Has been cancelled
SITL Tests / Testing PX4 iris (push) Has been cancelled
Build all targets / Seed [${{ matrix.chip_family }}] (push) Has been cancelled
Build all targets / Build [${{ matrix.runner }}][${{ matrix.group }}] (push) Has been cancelled
Build all targets / Upload Artifacts (push) Has been cancelled
Container build / Build Container (amd64) (push) Has been cancelled
Container build / Build Container (arm64) (push) Has been cancelled
Container build / Deploy To Registry (push) Has been cancelled
FLASH usage analysis / Publish Results (push) Has been cancelled
Handle stale issues and PRs / stale (push) Has been cancelled
Fuzzing / Fuzzing (push) Has been cancelled
* build(simulation): depend on gz-harmonic meta-package for SITL deb * build(simulation): refresh apt lists before installing px4-gazebo .deb
94 lines
3.8 KiB
Docker
94 lines
3.8 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# PX4 SITL Gazebo Harmonic runtime image
|
|
# Runs PX4 SITL with Gazebo Harmonic. Supports X11 forwarding for GUI.
|
|
#
|
|
# Build:
|
|
# make px4_sitl_default && cd build/px4_sitl_default && cpack -G DEB && cd ../..
|
|
# docker build -f Tools/packaging/Dockerfile.gazebo -t px4io/px4-sitl-gazebo:v1.17.0 build/px4_sitl_default/
|
|
#
|
|
# Run (headless):
|
|
# docker run --rm -it --network host px4io/px4-sitl-gazebo:v1.17.0
|
|
#
|
|
# Run (X11 GUI):
|
|
# xhost +local:docker
|
|
# docker run --rm -it --network host \
|
|
# -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
|
|
# --gpus all px4io/px4-sitl-gazebo:v1.17.0
|
|
#
|
|
# Persist flight logs on the host (ulog files):
|
|
# mkdir -p ./px4-logs
|
|
# docker run --rm -it --network host \
|
|
# -v $(pwd)/px4-logs:/root/.local/share/px4/rootfs/log \
|
|
# px4io/px4-sitl-gazebo:v1.17.0
|
|
|
|
FROM ubuntu:24.04
|
|
LABEL maintainer="PX4 Development Team"
|
|
LABEL description="PX4 SITL with Gazebo Harmonic simulation"
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV RUNS_IN_DOCKER=true
|
|
|
|
# Configure the OSRF Gazebo apt repo so Gazebo Harmonic (a Depends: of the
|
|
# px4-gazebo .deb) resolves from it in the install step below.
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
bc \
|
|
ca-certificates \
|
|
gnupg \
|
|
lsb-release \
|
|
wget \
|
|
&& wget -q https://packages.osrfoundation.org/gazebo.gpg \
|
|
-O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
|
|
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" \
|
|
> /etc/apt/sources.list.d/gazebo-stable.list \
|
|
&& apt-get update
|
|
|
|
# Install px4-gazebo via apt so its Depends (Gazebo Harmonic, OpenCV, GStreamer
|
|
# core libs, gstreamer plugin packages) are resolved automatically. The binary
|
|
# is stripped after install to trim image size (~a few MB).
|
|
COPY px4-gazebo_*.deb /tmp/
|
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
|
apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
/tmp/px4-gazebo_*.deb \
|
|
binutils \
|
|
&& strip /opt/px4-gazebo/bin/px4 \
|
|
&& apt-get purge -y binutils \
|
|
&& apt-get autoremove -y \
|
|
&& rm -f /tmp/px4-gazebo_*.deb \
|
|
&& ln -sf /opt/px4-gazebo/bin/px4-gazebo /usr/bin/px4-gazebo
|
|
|
|
# Create the DART physics engine symlink (avoids needing the -dev package)
|
|
RUN GZ_PHYSICS_DIR=$(find /usr/lib -maxdepth 3 -type d -name "engine-plugins" -path "*/gz-physics-7/*" 2>/dev/null | head -1) \
|
|
&& if [ -n "$GZ_PHYSICS_DIR" ] && [ -d "$GZ_PHYSICS_DIR" ]; then \
|
|
VERSIONED=$(ls "$GZ_PHYSICS_DIR"/libgz-physics*-dartsim-plugin.so.* 2>/dev/null | head -1) \
|
|
&& [ -n "$VERSIONED" ] \
|
|
&& ln -sf "$(basename "$VERSIONED")" "$GZ_PHYSICS_DIR/libgz-physics-dartsim-plugin.so"; \
|
|
fi
|
|
|
|
# Gazebo resource paths
|
|
ENV GZ_SIM_RESOURCE_PATH=/opt/px4-gazebo/share/gz/models:/opt/px4-gazebo/share/gz/worlds
|
|
ENV GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/px4-gazebo/lib/gz/plugins
|
|
ENV GZ_SIM_SERVER_CONFIG_PATH=/opt/px4-gazebo/share/gz/server.config
|
|
ENV PX4_GZ_MODELS=/opt/px4-gazebo/share/gz/models
|
|
ENV PX4_GZ_WORLDS=/opt/px4-gazebo/share/gz/worlds
|
|
|
|
ENV PX4_SIM_MODEL=gz_x500
|
|
ENV HOME=/root
|
|
|
|
# MAVLink, MAVSDK, DDS
|
|
EXPOSE 14550/udp 14540/udp 8888/udp
|
|
|
|
# Platform-adaptive entrypoint: detects Docker Desktop (macOS/Windows) via
|
|
# host.docker.internal and configures MAVLink + DDS to target the host.
|
|
COPY px4-entrypoint.sh /opt/px4-gazebo/bin/px4-entrypoint.sh
|
|
RUN chmod +x /opt/px4-gazebo/bin/px4-entrypoint.sh
|
|
|
|
WORKDIR /root
|
|
|
|
ENTRYPOINT ["/opt/px4-gazebo/bin/px4-entrypoint.sh"]
|
|
CMD []
|