diff --git a/Dockerfile b/Dockerfile index 822649f..031d623 100644 --- a/Dockerfile +++ b/Dockerfile @@ -243,15 +243,20 @@ catkin_make -DCMAKE_BUILD_TYPE=Release && \ source ~/catkin_ws/devel/setup.bash +RUN cd /home/$USERNAME && \ + git clone https://github.com/carla-simulator/scenario_runner.git -b v${CARLA_VERSION} + RUN echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc && \ - echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc + echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc && \ + echo "export SCENARIO_RUNNER_PATH=/home/$USERNAME/scenario_runner" >> ~/.bashrc USER root WORKDIR /root RUN echo "alias m='cd /home/$USERNAME ; su $USERNAME'" >> /root/.bashrc -COPY run.sh /run.sh +COPY startup.sh /startup.sh +COPY scripts/ /home/$USERNAME/scripts/ EXPOSE 5900 EXPOSE 8081 -CMD ["bash", "/run.sh"] +CMD ["bash", "/startup.sh"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..c556400 --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ ! -e ./cuda-repo-ubuntu1804-11-2-local_11.2.2-460.32.03-1_amd64.deb ]; then + wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda-repo-ubuntu1804-11-2-local_11.2.2-460.32.03-1_amd64.deb +fi +if [ ! -e ./AdditionalMaps_0.9.10.1.tar.gz ]; then + wget https://carla-releases.s3.eu-west-3.amazonaws.com/Linux/AdditionalMaps_0.9.10.1.tar.gz +fi + +docker build -t carla0910a . && \ diff --git a/run.sh b/run.sh index 1d22c35..b545c1c 100755 --- a/run.sh +++ b/run.sh @@ -1,30 +1,15 @@ -# inside docker script -trap 'kill $(jobs -p)' EXIT - -# 0. generate xorg.conf -BUS_ID=$(nvidia-xconfig --query-gpu-info | grep 'PCI BusID' | sed -r 's/\s*PCI BusID : PCI:(.*)/\1/') -nvidia-xconfig -a --virtual=$RESOLUTION --allow-empty-initial-configuration --enable-all-gpus --busid $BUS_ID --use-display-device="DFP-0" --connected-monitor="DFP-0" - -# 1. launch X server -Xorg :0 & -sleep 1 # wait for the server gets ready - -# 2. start x11 and vnc connection -# to inspect logs in detail, use --verbose -x11vnc -display :0 -passwd $VNCPASS -forever -rfbport 5900 -ncache 10 & -sleep 2 # wait for the server gets ready - -# 2.5 start audio -# this is not required. -# pulseaudio --start -# sleep 2 - -# 3. start noVNC -/noVNC-1.2.0/utils/launch.sh --vnc localhost:5900 --listen 8081 & -sleep 2 - -echo 'running noVNC at http://docker_ip:6080/vnc_lite.html' - -# 3. start simulator -export DISPLAY=:0 -openbox +# docker run --device=/dev/tty0:rw -it --rm --gpus all \ +docker run --privileged -it --rm --gpus all \ + -p 6080:8081 \ + -p 5901:5901 \ + -p 2000-2002:2000-2002 \ + -v /dev/shm:/dev/shm \ + -e NVIDIA_VISIBLE_DEVICES=all \ + -e NVIDIA_DRIVER_CAPABILITIES=compute,graphics,display \ + -e QT_X11_NO_MITSHM=1 \ + -e SDL_VIDEODRIVER=x11 \ + -e VNCPASS=pass \ + -e RESOLUTION=1920x1080 \ + --shm-size=512mb \ + --net bridge \ + --name carla0910a carla0910a diff --git a/scripts/carla_ad_agent.sh b/scripts/carla_ad_agent.sh new file mode 100755 index 0000000..a78be5f --- /dev/null +++ b/scripts/carla_ad_agent.sh @@ -0,0 +1,2 @@ +export SCENARIO_RUNNER_PATH=~/scenario_runner +roslaunch carla_ad_agent carla_ad_agent.launch diff --git a/scripts/carla_ad_demo.sh b/scripts/carla_ad_demo.sh new file mode 100755 index 0000000..6d78b32 --- /dev/null +++ b/scripts/carla_ad_demo.sh @@ -0,0 +1,2 @@ +export SCENARIO_RUNNER_PATH=~/scenario_runner +roslaunch carla_ad_demo carla_ad_demo_with_scenario.launch diff --git a/scripts/carla_ad_demo0.sh b/scripts/carla_ad_demo0.sh new file mode 100755 index 0000000..4634301 --- /dev/null +++ b/scripts/carla_ad_demo0.sh @@ -0,0 +1,2 @@ +export SCENARIO_RUNNER_PATH=~/scenario_runner +roslaunch carla_ad_demo carla_ad_demo.launch diff --git a/scripts/launchcarla.sh b/scripts/launchcarla.sh new file mode 100755 index 0000000..171f267 --- /dev/null +++ b/scripts/launchcarla.sh @@ -0,0 +1 @@ +roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch vehicle_filter:='vehicle.toyota.prius*' diff --git a/scripts/launchcarla0.sh b/scripts/launchcarla0.sh new file mode 100755 index 0000000..f156094 --- /dev/null +++ b/scripts/launchcarla0.sh @@ -0,0 +1 @@ +roslaunch carla_ros_bridge carla_ros_bridge.launch diff --git a/scripts/launchcarla1.sh b/scripts/launchcarla1.sh new file mode 100755 index 0000000..853bce7 --- /dev/null +++ b/scripts/launchcarla1.sh @@ -0,0 +1 @@ +roslaunch carla_ros_bridge carla_ros_bridge_with_rviz.launch vehicle_filter:='vehicle.toyota.prius*' diff --git a/scripts/setcarla.sh b/scripts/setcarla.sh new file mode 100755 index 0000000..7fca5b1 --- /dev/null +++ b/scripts/setcarla.sh @@ -0,0 +1,2 @@ +cd /home/$USERNAME/CARLA_0.9.10.1/PythonAPI +python util/config.py -m Town03 diff --git a/scripts/setcarla01.sh b/scripts/setcarla01.sh new file mode 100755 index 0000000..7760119 --- /dev/null +++ b/scripts/setcarla01.sh @@ -0,0 +1,2 @@ +cd /home/$USERNAME/CARLA_0.9.10.1/PythonAPI +python util/config.py -m Town01 diff --git a/scripts/setcarla02.sh b/scripts/setcarla02.sh new file mode 100755 index 0000000..28045f5 --- /dev/null +++ b/scripts/setcarla02.sh @@ -0,0 +1,2 @@ +cd /home/$USERNAME/CARLA_0.9.10.1/PythonAPI +python util/config.py -m Town02 diff --git a/scripts/setcarla04.sh b/scripts/setcarla04.sh new file mode 100755 index 0000000..8cbd8ba --- /dev/null +++ b/scripts/setcarla04.sh @@ -0,0 +1,2 @@ +cd /home/$USERNAME/CARLA_0.9.10.1/PythonAPI +python util/config.py -m Town04 diff --git a/scripts/setcarla05.sh b/scripts/setcarla05.sh new file mode 100755 index 0000000..541e55e --- /dev/null +++ b/scripts/setcarla05.sh @@ -0,0 +1,2 @@ +cd /home/$USERNAME/CARLA_0.9.10.1/PythonAPI +python util/config.py -m Town05 diff --git a/scripts/setcarla06.sh b/scripts/setcarla06.sh new file mode 100755 index 0000000..a0257ac --- /dev/null +++ b/scripts/setcarla06.sh @@ -0,0 +1,2 @@ +cd /home/$USERNAME/CARLA_0.9.10.1/PythonAPI +python util/config.py -m Town06 diff --git a/scripts/setcarla07.sh b/scripts/setcarla07.sh new file mode 100755 index 0000000..ecb7105 --- /dev/null +++ b/scripts/setcarla07.sh @@ -0,0 +1,2 @@ +cd /home/$USERNAME/CARLA_0.9.10.1/PythonAPI +python util/config.py -m Town07 diff --git a/scripts/setcarla10.sh b/scripts/setcarla10.sh new file mode 100755 index 0000000..543254c --- /dev/null +++ b/scripts/setcarla10.sh @@ -0,0 +1,2 @@ +cd /home/$USERNAME/CARLA_0.9.10.1/PythonAPI +python util/config.py -m Town10HD diff --git a/scripts/startcarla.sh b/scripts/startcarla.sh new file mode 100755 index 0000000..738207f --- /dev/null +++ b/scripts/startcarla.sh @@ -0,0 +1,4 @@ +cd /home/$USERNAME/CARLA_0.9.10.1 +./CarlaUE4.sh -windowed -ResX=160 -ResY=120 -opengl +#SDL_VIDEODRIVER=offscreen ./CarlaUE4.sh -opengl -quality-level=Low +#SDL_VIDEODRIVER=offscreen ./CarlaUE4.sh -opengl diff --git a/server.sh b/server.sh deleted file mode 100755 index 1fcd21b..0000000 --- a/server.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -if [ ! -e ./cuda-repo-ubuntu1804-11-2-local_11.2.2-460.32.03-1_amd64.deb ]; then - wget https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda-repo-ubuntu1804-11-2-local_11.2.2-460.32.03-1_amd64.deb -fi -if [ ! -e ./AdditionalMaps_0.9.10.1.tar.gz ]; then - wget https://carla-releases.s3.eu-west-3.amazonaws.com/Linux/AdditionalMaps_0.9.10.1.tar.gz -fi - -docker build -t sim . && \ -# docker run --device=/dev/tty0:rw -it --rm --gpus all \ -docker run --privileged -it --rm --gpus all \ - -p 6080:8081 \ - -p 5901:5901 \ - -p 2000-2002:2000-2002 \ - -v /dev/shm:/dev/shm \ - -e NVIDIA_VISIBLE_DEVICES=all \ - -e NVIDIA_DRIVER_CAPABILITIES=compute,graphics,display \ - -e QT_X11_NO_MITSHM=1 \ - -e SDL_VIDEODRIVER=x11 \ - -e VNCPASS=pass \ - -e RESOLUTION=1920x1080 \ - --shm-size=512mb \ - --net bridge \ - --name sim sim diff --git a/startup.sh b/startup.sh new file mode 100755 index 0000000..1d22c35 --- /dev/null +++ b/startup.sh @@ -0,0 +1,30 @@ +# inside docker script +trap 'kill $(jobs -p)' EXIT + +# 0. generate xorg.conf +BUS_ID=$(nvidia-xconfig --query-gpu-info | grep 'PCI BusID' | sed -r 's/\s*PCI BusID : PCI:(.*)/\1/') +nvidia-xconfig -a --virtual=$RESOLUTION --allow-empty-initial-configuration --enable-all-gpus --busid $BUS_ID --use-display-device="DFP-0" --connected-monitor="DFP-0" + +# 1. launch X server +Xorg :0 & +sleep 1 # wait for the server gets ready + +# 2. start x11 and vnc connection +# to inspect logs in detail, use --verbose +x11vnc -display :0 -passwd $VNCPASS -forever -rfbport 5900 -ncache 10 & +sleep 2 # wait for the server gets ready + +# 2.5 start audio +# this is not required. +# pulseaudio --start +# sleep 2 + +# 3. start noVNC +/noVNC-1.2.0/utils/launch.sh --vnc localhost:5900 --listen 8081 & +sleep 2 + +echo 'running noVNC at http://docker_ip:6080/vnc_lite.html' + +# 3. start simulator +export DISPLAY=:0 +openbox