Skip to content

Instantly share code, notes, and snippets.

@drnic
Last active November 29, 2022 11:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drnic/c17d8f98f425c6fb479ef2937f813b88 to your computer and use it in GitHub Desktop.
Save drnic/c17d8f98f425c6fb479ef2937f813b88 to your computer and use it in GitHub Desktop.

References:

socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &

Test that Docker/X11 is working by running Firefox within Docker, but its windows appear on your host machine:

IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}'); echo $IP
xhost + $IP
docker run -d --name firefox -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox

Fetch the pre-built ardupilot/SITL image (see Dockerfile):

docker pull drnic/ardupilot-sitl

To run SITL:

IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}'); echo $IP
xhost + $IP
docker run -ti -e HOST_IP=$IP -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix -p 14550:14550 drnic/ardupilot-sitl bash

Inside, run:

$ Tools/autotest/sim_vehicle.py --no-rebuild --console --map --out=$HOST_IP:14550 -v APMrover2 -L Kingaroy --no-rebuild

MAVProxy can now connect to the SITL from the host machine:

mavproxy.py --master=0.0.0.0:14550
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment