Skip to content

Commit 6212fc2

Browse files
committed
WIP: Make NMEA downstream integration work
1 parent 68acbb8 commit 6212fc2

19 files changed

+293
-356
lines changed

docker/docker-compose.commands.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ services:
4949
ubx:
5050
command: "ros2 run ubx_publisher ubx_publisher_node --ros-args --log-level debug -p serial_port:=/dev/pts/0" # pty created in entrypoint script, TODO try to $(readlink /tmp/gisnav-pty-link) instead of hard-coding /dev/pts/0 here
5151

52+
nmea:
53+
command: "ros2 run nmea_publisher nmea_publisher_node --ros-args --log-level debug -p serial_port:=/dev/pts/0" # pty created in entrypoint script, TODO try to $(readlink /tmp/gisnav-pty-link) instead of hard-coding /dev/pts/0 here
54+
5255
fileserver:
5356
command: apache2ctl -D FOREGROUND
5457

docker/docker-compose.dependencies.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ services:
1010
gisnav:
1111
depends_on:
1212
- micro-ros-agent
13-
- ubx
13+
# - ubx
14+
- nmea
1415
- mavros
1516
- gscam
1617
- mapserver

docker/docker-compose.healthcheck.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ services:
2727
]
2828
<<: *settings
2929

30+
nmea:
31+
healthcheck:
32+
test: [ "CMD", "bash", "-c", "
33+
timeout 30 tcpdump -i any -c 1 tcp src port ${SOCAT_BRIDGE_PORT:?empty or not set} > /tmp/tcp_check.log 2>&1 &&
34+
grep -q 'TCP' /tmp/tcp_check.log"
35+
]
36+
<<: *settings
37+
3038
mavros:
3139
healthcheck:
3240
test: ["CMD", "bash", "-c", "

docker/docker-compose.labels.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ services:
7575
homepage.name: UBX agent
7676
homepage.description: UBX to ROS middleware
7777

78+
nmea:
79+
labels:
80+
<<: *labels
81+
homepage.group: Middleware services
82+
homepage.name: NMEA ROS to serial bridge
83+
homepage.description: Publishes ROS NMEA sentences to serial port
84+
7885
qgc:
7986
labels:
8087
<<: *labels

docker/docker-compose.networking.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ services:
3535
GISNAV_FCU_URL: ${GISNAV_FCU_URL:?empty or not set} # todo TCP bridge only for simulation?
3636
extra_hosts:
3737
- "host.docker.internal:host-gateway" # for socat
38+
39+
nmea:
40+
networks:
41+
- dds
42+
ports:
43+
- "${SOCAT_BRIDGE_PORT:?empty or not set}:${SOCAT_BRIDGE_PORT:?empty or not set}/udp"
44+
environment:
45+
SOCAT_BRIDGE_PORT: ${SOCAT_BRIDGE_PORT:?empty or not set}
46+
GISNAV_FCU_URL: ${GISNAV_FCU_URL:?empty or not set} # todo TCP bridge only for simulation?
47+
extra_hosts:
48+
- "host.docker.internal:host-gateway" # for socat
49+
3850
qgc:
3951
network_mode: host
4052

docker/docker-compose.ros.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,9 @@ services:
6363
args:
6464
ROS_DISTRO: humble
6565
<<: *ros
66+
67+
nmea:
68+
build:
69+
args:
70+
ROS_DISTRO: humble
71+
<<: *ros

docker/docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ services:
9595
build:
9696
context: ubx
9797

98+
nmea:
99+
build:
100+
context: nmea
101+
98102
autoheal:
99103
image: willfarrell/autoheal
100104
restart: always

docker/nmea/Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ARG ROS_DISTRO
2+
FROM ros:${ROS_DISTRO}
3+
4+
ARG ROS_DISTRO
5+
ENV ROS_DISTRO=${ROS_DISTRO}
6+
7+
SHELL ["/bin/bash", "-c"]
8+
9+
# tcpdump for health checks
10+
RUN apt-get update && \
11+
apt-get -y dist-upgrade && \
12+
apt-get -y install tcpdump socat python3-pip && \
13+
apt-get clean && \
14+
rm -rf /var/lib/apt/lists/*
15+
16+
COPY opt/ /opt/
17+
18+
WORKDIR /opt/colcon_ws
19+
20+
RUN rosdep update && \
21+
apt-get update && \
22+
rosdep install --from-paths ./src -y -r --ignore-src && \
23+
rm -rf /var/lib/apt/lists/* && \
24+
apt clean
25+
26+
RUN pip3 install ./src/nmea_publisher && \
27+
source /opt/ros/${ROS_DISTRO}/setup.bash && \
28+
colcon build
29+
30+
COPY --chmod=755 entrypoint.sh /
31+
32+
SHELL ["/bin/bash", "-c"]
33+
ENTRYPOINT ["/entrypoint.sh"]

docker/nmea/entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
source "/opt/ros/$ROS_DISTRO/setup.bash"
5+
source "/opt/colcon_ws/install/setup.bash"
6+
7+
echo "Setting up socat bridge from serial output to simulator container over TCP port 15000..."
8+
socat pty,link=/tmp/gisnav-pty-link,raw,echo=0 tcp:${GISNAV_FCU_URL:?empty or not set}:${SOCAT_BRIDGE_PORT:?empty or not set} || (echo "Could not establish serial-to-TCP bridge. Is the SITL simulation container running?"; exit 1) &
9+
sleep 3 # Give socat time to create the pty
10+
echo PTS device created at: `readlink /tmp/gisnav-pty-link`
11+
12+
exec "$@"

docker/nmea/opt/colcon_ws/src/nmea_publisher/nmea_publisher/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)