-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from hmakelin/add-custom-network
Use Docker bridge networks instead of sharing host network
- Loading branch information
Showing
18 changed files
with
329 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
ARG ROS_VERSION | ||
|
||
FROM px4io/px4-dev-ros2-${ROS_VERSION} | ||
ARG ROS_VERSION | ||
FROM ubuntu:focal | ||
|
||
LABEL maintainer="Harri Makelin <[email protected]>" | ||
|
||
# Update and upgrade packages, then install required packages | ||
RUN apt-get update && \ | ||
apt-get -y dist-upgrade && \ | ||
apt-get -y install ros-${ROS_VERSION}-gazebo-ros-pkgs gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl && \ | ||
apt-get -y upgrade && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -y install git python3-pip lsb-release sudo wget gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
apt clean | ||
|
||
|
@@ -24,13 +21,25 @@ RUN git clone --branch v1.14.0 --single-branch --depth 1 \ | |
submodule update --init --recursive && \ | ||
bash Tools/setup/ubuntu.sh | ||
|
||
# Explicitly add required \ | ||
# Build and install MAVLink router | ||
RUN cd $HOME && \ | ||
git clone --branch v3 --depth 1 https://github.com/mavlink-router/mavlink-router.git && \ | ||
cd mavlink-router && \ | ||
git submodule update --init --recursive && \ | ||
apt install -y git ninja-build pkg-config gcc g++ systemd && \ | ||
pip3 install meson>=0.55 && \ | ||
meson setup build . && \ | ||
ninja -C build && \ | ||
ninja -C build install | ||
|
||
WORKDIR PX4-Autopilot | ||
|
||
COPY merge_xml.py merge_yaml.py dds_topics.yaml iris_hitl_ksql_airport.world 6011_typhoon_h480 . | ||
COPY . . | ||
|
||
# Setup ksql_airport.world for HIL | ||
RUN pip install --no-cache-dir lxml && \ | ||
# empy must be version 3.3.4, see below commit | ||
# https://github.com/PX4/PX4-containers/commit/80df74db476adbf7a71d08c9b392023756cc1bb0 | ||
RUN pip install --no-cache-dir lxml empy==3.3.4 && \ | ||
python3 merge_xml.py iris_hitl_ksql_airport.world Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/hitl_iris.world | ||
|
||
# Configure XRCE-DDS bridge | ||
|
@@ -39,5 +48,16 @@ RUN python3 merge_yaml.py dds_topics.yaml src/modules/uxrce_dds_client/dds_topic | |
# Apply configuration files | ||
#RUN cat 6011_typhoon_h480 >> ROMFS/px4fmu_common/init.d-posix/airframes/6011_gazebo-classic_typhoon_h480 | ||
|
||
# The hostname of the gscam service in the network is assumed to be gisnav-gscam-1 | ||
ENV PX4_VIDEO_HOST_IP=gisnav-gscam-1 | ||
|
||
RUN mkdir -p /etc/mavlink-router && \ | ||
mv etc/mavlink-router/main.conf /etc/mavlink-router/main.conf && \ | ||
chmod +x ./entrypoint.sh | ||
|
||
# Make initial builds (for faster startup in the future) | ||
RUN DONT_RUN=1 make px4_sitl gazebo-classic_typhoon_h480__ksql_airport | ||
|
||
# No health check - if simulation dies makes no sense to restart via autoheal | ||
|
||
ENTRYPOINT ["./entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Use MAVLink router to forward packets to remote QGC and MAVROS | ||
# https://docs.px4.io/main/en/simulation/#use-mavlink-router | ||
# See description of how PX4 uses ports for simulation here: | ||
# https://docs.px4.io/main/en/simulation/#default-px4-mavlink-udp-ports | ||
export QGC_IP=$(getent hosts gisnav-qgc-1 | awk '{ print $1 }') | ||
export MAVROS_IP=$(getent hosts gisnav-mavros-1 | awk '{ print $1 }') | ||
echo "Setting up MAVLink router to QGC host ${QGC_IP:-127.0.0.1}" | ||
mavlink-routerd -e ${QGC_IP:-127.0.0.1}:14550 127.0.0.1:14550 & | ||
echo "Setting up MAVLink router to MAVROS host ${MAVROS_IP:-127.0.0.1}" | ||
mavlink-routerd -e ${MAVROS_IP:-127.0.0.1}:14540 127.0.0.1:14540 & | ||
|
||
# Setup uXRCE agent IP | ||
# PX4 needs the IP as int32 - convert_ip.py script does the conversion | ||
# https://docs.px4.io/main/en/middleware/uxrce_dds.html#starting-the-client | ||
# UDP port 8888 used by default for SITL simulation | ||
export UXRCE_AGENT_IP=$(getent hosts gisnav-micro-ros-agent-1 | awk '{ print $1 }') | ||
export UXRCE_DDS_AG_IP=$(python3 Tools/convert_ip.py $UXRCE_AGENT_IP) | ||
echo "Connecting uXRCE client with agent at ${UXRCE_AGENT_IP:-127.0.0.1} (${UXRCE_DDS_AG_IP})." | ||
#echo "uxrce_dds_client start -h ${UXRCE_AGENT_IP}" >> ROMFS/px4fmu_common/init.d-posix/airframes/6011_gazebo-classic_typhoon_h480 | ||
|
||
# Restart the uXRCE client in the main SITL startup script (rcS) with | ||
# the correct DDS agent IP address (rcS hard codes 127.0.0.1) | ||
echo "uxrce_dds_client stop" >> ROMFS/px4fmu_common/init.d-posix/rcS | ||
echo "uxrce_dds_client start -h ${UXRCE_AGENT_IP}" >> ROMFS/px4fmu_common/init.d-posix/rcS | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[General] | ||
# Disable listening on 5760/TCP | ||
TcpServerPort = 0 |
Oops, something went wrong.