Skip to content

Commit 146d6c7

Browse files
committed
Automatically start gps at /dev/pts/1 in px4 service to receive NMEA comms
Ideally we would not hard code the PTY path here but based on testing the /dev/pts/1 port should be the one that socat allocates for bridging incoming communication from TCP port 15000
1 parent 4e76b6e commit 146d6c7

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

docker/px4/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ RUN cat 6011_typhoon_h480 >> ROMFS/px4fmu_common/init.d-posix/airframes/6011_gaz
6161

6262
# TODO: configure GPS serial ports in environment variables
6363
# Cube Orange: GPS 1 -> ttyS2, GPS 2 --> ttyS5
64-
RUN echo "gps start -d /dev/ttyS2 -e /dev/ttyS5 -p ubx" >> ROMFS/px4fmu_common/init.d-posix/rcS \
65-
&& echo "CONFIG_BOARD_SERIAL_GPS1=\"/dev/pts/0\"" >> boards/px4/sitl/default.px4board # TODO use dynamically allocated PTY device, not hard-coded pts/0
64+
RUN echo "gps start -d /dev/pts/1 -b 9600 -p nmea" >> ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator \
65+
&& echo "CONFIG_BOARD_SERIAL_GPS1=\"/dev/pts/1\"" >> boards/px4/sitl/default.px4board # TODO use dynamically allocated PTY device, not hard-coded pts/1
6666
#&& echo "CONFIG_BOARD_SERIAL_GPS1=\"/dev/ttyS2\"" >> boards/px4/sitl/default.px4board \
6767
#&& echo "CONFIG_BOARD_SERIAL_GPS2=\"/dev/ttyS5\"" >> boards/px4/sitl/default.px4board
6868

docker/px4/entrypoint.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,11 @@ mavlink-routerd -e ${GISNAV_COMPANION_IP:?empty or not set}:${GISNAV_CMP_MAVROS_
1313
# px4 container (simulation host). Bridging serial ports over TCP is easier with
1414
# Docker than e.g. bridging via virtual serial ports (pseudo-ttys) on Docker
1515
# host
16-
#socat tcp-listen:15000 pty,link=/dev/ACM0 &
1716
# TODO: do not hard code /dev/ttyS2, use .env file
1817
echo "Setting up socat bridge at from TCP port ${SOCAT_BRIDGE_PORT:?empty or not set} to /tmp/gisnav-pty-link"
1918
socat tcp-listen:${SOCAT_BRIDGE_PORT:?empty or not set},reuseaddr,fork pty,raw,echo=0,link=/tmp/gisnav-pty-link &
2019
echo "PTY device created at (might not show up until client connects at ${SOCAT_BRIDGE_PORT}): $(readlink /tmp/gisnav-pty-link)"
2120

22-
# Start socat and capture the PTY name
23-
#echo "Setting up socat bridge at from TCP port ${SOCAT_BRIDGE_PORT:?empty or not set} to PTY"
24-
#socat tcp-listen:${SOCAT_BRIDGE_PORT},reuseaddr,fork pty,link=/tmp/gisnav-pty-link,raw,echo=0 || (echo "Could not establish TCP-to-serial bridge."; exit 1) &
25-
#echo "PTS device created at (might not show up until client connects at ${SOCAT_BRIDGE_PORT}): $(readlink /tmp/gisnav-pty-link)"
26-
2721
# Setup uXRCE agent IP
2822
# PX4 needs the IP as int32 - convert_ip.py script does the conversion
2923
# https://docs.px4.io/main/en/middleware/uxrce_dds.html#starting-the-client

0 commit comments

Comments
 (0)