forked from ecward/car_demo
-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_demo.bash
executable file
·43 lines (38 loc) · 991 Bytes
/
run_demo.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
# Runs a docker container with the image created by build_demo.bash
# Requires
# docker
# nvidia-docker
# an X server
# Recommended
# A joystick mounted to /dev/input/js0 or /dev/input/js1
until sudo nvidia-docker ps
do
echo "Waiting for docker server"
sleep 1
done
# Make sure processes in the container can connect to the x server
# Necessary so gazebo can create a context for OpenGL rendering (even headless)
XAUTH=/tmp/.docker.xauth
if [ ! -f $XAUTH ]
then
xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
if [ ! -z "$xauth_list" ]
then
echo $xauth_list | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi
sudo nvidia-docker run -it \
-e DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY=$XAUTH \
-v "$XAUTH:$XAUTH" \
-v "/tmp/.X11-unix:/tmp/.X11-unix" \
-v "/etc/localtime:/etc/localtime:ro" \
-v "/dev/input:/dev/input" \
--privileged \
--rm=true \
osrf/car_demo