Skip to content

Commit fd2058b

Browse files
Add support for gz-harmonic on Ubuntu 24.04
1 parent 2b943f3 commit fd2058b

File tree

4 files changed

+47
-49
lines changed

4 files changed

+47
-49
lines changed

Dockerfile

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,62 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:24.04
22

33
ENV WORKSPACE_DIR /root
4-
ENV FIRMWARE_DIR ${WORKSPACE_DIR}/Firmware
4+
ENV FIRMWARE_DIR ${WORKSPACE_DIR}/px4
55
ENV SITL_RTSP_PROXY ${WORKSPACE_DIR}/sitl_rtsp_proxy
66

77
ENV DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
88
ENV DISPLAY :99
99
ENV LANG C.UTF-8
1010

1111
RUN apt-get update && \
12-
apt-get install -y wget lsb-release && \
13-
apt-get -y autoremove && \
14-
apt-get clean autoclean && \
15-
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
16-
17-
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg && \
18-
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" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
19-
20-
21-
RUN apt-get update && \
22-
apt-get install -y bc \
12+
apt-get install -y \
2313
cmake \
24-
gazebo11 \
14+
curl \
2515
git \
16+
gnupg \
2617
gstreamer1.0-plugins-bad \
2718
gstreamer1.0-plugins-base \
2819
gstreamer1.0-plugins-good \
2920
gstreamer1.0-plugins-ugly \
30-
iproute2 \
31-
libeigen3-dev \
32-
libgazebo11-dev \
3321
libgstreamer-plugins-base1.0-dev \
3422
libgstrtspserver-1.0-dev \
35-
libopencv-dev \
36-
libroscpp-dev \
37-
protobuf-compiler \
38-
python3-jsonschema \
39-
python3-numpy \
23+
lsb-release \
4024
python3-pip \
41-
unzip \
42-
xvfb && \
43-
apt-get -y autoremove && \
25+
python3-empy \
26+
python3-future \
27+
python3-jinja2 \
28+
python3-jsonschema \
29+
python3-kconfiglib \
30+
python3-yaml \
31+
xvfb
32+
33+
RUN pip3 install --break-system-packages pyros-genmsg
34+
35+
RUN curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg && \
36+
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" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null && \
37+
apt-get update && \
38+
apt-get install -y gz-harmonic
39+
40+
RUN apt-get -y autoremove && \
4441
apt-get clean autoclean && \
4542
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
4643

47-
RUN pip3 install --upgrade pip && \
48-
pip3 install empy==3.3.4 \
49-
future \
50-
jinja2 \
51-
kconfiglib \
52-
packaging \
53-
pyros-genmsg \
54-
toml \
55-
pyyaml
56-
5744
RUN git clone https://github.com/PX4/PX4-Autopilot.git ${FIRMWARE_DIR}
5845
RUN git -C ${FIRMWARE_DIR} checkout main
5946
RUN git -C ${FIRMWARE_DIR} submodule update --init --recursive
6047

61-
COPY edit_rcS.bash ${WORKSPACE_DIR}
62-
COPY entrypoint.sh /root/entrypoint.sh
63-
RUN chmod +x /root/entrypoint.sh
64-
65-
RUN ["/bin/bash", "-c", " \
66-
cd ${FIRMWARE_DIR} && \
67-
DONT_RUN=1 make px4_sitl gazebo && \
68-
DONT_RUN=1 make px4_sitl gazebo \
69-
"]
48+
COPY fix-cmake-build.patch ${FIRMWARE_DIR}
49+
RUN git -C ${FIRMWARE_DIR} apply fix-cmake-build.patch
7050

7151
COPY sitl_rtsp_proxy ${SITL_RTSP_PROXY}
7252
RUN cmake -B${SITL_RTSP_PROXY}/build -H${SITL_RTSP_PROXY}
7353
RUN cmake --build ${SITL_RTSP_PROXY}/build
7454

55+
RUN cmake -DCONFIG=px4_sitl_default -B${FIRMWARE_DIR}/build -S${FIRMWARE_DIR} && \
56+
cmake --build ${FIRMWARE_DIR}/build
57+
58+
COPY edit_rcS.bash ${WORKSPACE_DIR}
59+
COPY entrypoint.sh /root/entrypoint.sh
60+
RUN chmod +x /root/entrypoint.sh
61+
7562
ENTRYPOINT ["/root/entrypoint.sh"]

edit_rcS.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ else
5353
API_PARAM=${API_PARAM:-"-t ${HOST}"}
5454
fi
5555

56-
CONFIG_FILE=${FIRMWARE_DIR}/build/px4_sitl_default/etc/init.d-posix/px4-rc.mavlink
56+
CONFIG_FILE=${FIRMWARE_DIR}/build/etc/init.d-posix/px4-rc.mavlink
5757

5858
sed -i "s/mavlink start \-x \-u \$udp_gcs_port_local -r 4000000/mavlink start -x -u \$udp_gcs_port_local -r 4000000 ${QGC_PARAM}/" ${CONFIG_FILE}
5959
sed -i "s/mavlink start \-x \-u \$udp_offboard_port_local -r 4000000/mavlink start -x -u \$udp_offboard_port_local -r 4000000 ${API_PARAM}/" ${CONFIG_FILE}

entrypoint.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ function get_ip {
3232

3333
OPTIND=1 # Reset in case getopts has been used previously in the shell.
3434

35-
vehicle=iris
36-
world=empty
35+
vehicle=gz_x500
36+
world=default
3737

3838
while getopts "h?v:w:" opt; do
3939
case "$opt" in
@@ -65,5 +65,4 @@ Xvfb :99 -screen 0 1600x1200x24+32 &
6565
${SITL_RTSP_PROXY}/build/sitl_rtsp_proxy &
6666

6767
source ${WORKSPACE_DIR}/edit_rcS.bash ${IP_API} ${IP_QGC} &&
68-
cd ${FIRMWARE_DIR} &&
69-
HEADLESS=1 make px4_sitl gazebo_${vehicle}__${world}
68+
HEADLESS=1 PX4_SIM_MODEL=${vehicle} PX4_GZ_WORLD=${world} ${FIRMWARE_DIR}/build/bin/px4

fix-cmake-build.patch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/src/lib/events/CMakeLists.txt b/src/lib/events/CMakeLists.txt
2+
index fcdb971f64..cdf366199c 100644
3+
--- a/src/lib/events/CMakeLists.txt
4+
+++ b/src/lib/events/CMakeLists.txt
5+
@@ -57,6 +57,7 @@ add_custom_command(OUTPUT ${generated_events_px4_file}
6+
${PX4_SOURCE_DIR}/Tools/px4events/jsonout.py
7+
${PX4_SOURCE_DIR}/Tools/px4events/srcparser.py
8+
${PX4_SOURCE_DIR}/Tools/px4events/srcscanner.py
9+
+ modules__uxrce_dds_client
10+
prebuild_targets # ensure all generated source files exist
11+
COMMENT "Generating px4 event json file from source"
12+
)

0 commit comments

Comments
 (0)