From a573ffd84190020e799b391eb109e4a9ad793125 Mon Sep 17 00:00:00 2001 From: JulianTrommer Date: Thu, 29 Aug 2024 14:38:40 +0200 Subject: [PATCH 01/11] fix: fixed loop rate and typo --- code/acting/src/acting/stanley_controller.py | 2 +- code/test-route/launch/test-route.launch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/acting/src/acting/stanley_controller.py b/code/acting/src/acting/stanley_controller.py index 3151347f..e0cbc190 100755 --- a/code/acting/src/acting/stanley_controller.py +++ b/code/acting/src/acting/stanley_controller.py @@ -80,7 +80,7 @@ def loop(timer_event=None): :return: """ if self.__path is None: - self.logwarn("StanleyController hasn't received a path yet" + self.logwarn("StanleyController hasn't received a path yet " "and can therefore not publish steering") return if self.__position is None: diff --git a/code/test-route/launch/test-route.launch b/code/test-route/launch/test-route.launch index 189d9ace..a0326070 100644 --- a/code/test-route/launch/test-route.launch +++ b/code/test-route/launch/test-route.launch @@ -1,6 +1,6 @@ - + From ccb443aa5fc196b983cb8c30935bcc8921c0e693 Mon Sep 17 00:00:00 2001 From: ll7 Date: Thu, 29 Aug 2024 15:14:55 +0200 Subject: [PATCH 02/11] fix: default route is with scenarios --- build/agent_service.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/agent_service.yaml b/build/agent_service.yaml index d516c753..6362983b 100644 --- a/build/agent_service.yaml +++ b/build/agent_service.yaml @@ -27,9 +27,9 @@ services: - CARLA_SIM_HOST=carla-simulator - ROS_HOSTNAME=agent - XDG_RUNTIME_DIR=/tmp/runtime-carla - # - ROUTE=/opt/leaderboard/data/routes_devtest.xml + - ROUTE=/opt/leaderboard/data/routes_devtest.xml # Simple route without special scenarios - - ROUTE=/workspace/code/routes/routes_simple.xml + # - ROUTE=/workspace/code/routes/routes_simple.xml volumes: - /tmp/.X11-unix:/tmp/.X11-unix # if you change the volume here also change the copy command From 518a81fdc6c7d51a19975b3eba0818d22e635c20 Mon Sep 17 00:00:00 2001 From: ll7 Date: Thu, 29 Aug 2024 15:15:22 +0200 Subject: [PATCH 03/11] fix: dev route is simple_route --- build/docker-compose_dev.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/docker-compose_dev.yaml b/build/docker-compose_dev.yaml index dcd2f518..a71865d3 100644 --- a/build/docker-compose_dev.yaml +++ b/build/docker-compose_dev.yaml @@ -8,4 +8,6 @@ services: extends: file: agent_service.yaml service: agent - command: bash -c "sleep 10 && roslaunch agent/launch/dev.launch" + environment: + - ROUTE=/workspace/code/routes/routes_simple.xml + command: bash -c "sleep 10 && sudo chown -R carla:carla ../code/ && sudo chmod -R a+w ../code/ && python3 /opt/leaderboard/leaderboard/leaderboard_evaluator.py --debug=0 --routes=$${ROUTE} --agent=/workspace/code/agent/src/agent/agent.py --host=$${CARLA_SIM_HOST} --track=MAP" From e3b78e50e19cb36bb6a46fd8280ee2052a3b8c65 Mon Sep 17 00:00:00 2001 From: ll7 Date: Thu, 29 Aug 2024 15:15:35 +0200 Subject: [PATCH 04/11] fix: change radar freq --- code/agent/config/dev_objects.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/agent/config/dev_objects.json b/code/agent/config/dev_objects.json index 9b63e70e..74383815 100644 --- a/code/agent/config/dev_objects.json +++ b/code/agent/config/dev_objects.json @@ -112,7 +112,7 @@ "yaw": 0.0 }, "range": 50, - "rotation_frequency": 10, + "rotation_frequency": 20, "channels": 64, "upper_fov": 10, "lower_fov": -30, From 4b8b6e5383b3b5e40ca974cad8359a6e616e1ab4 Mon Sep 17 00:00:00 2001 From: ll7 Date: Thu, 29 Aug 2024 15:15:52 +0200 Subject: [PATCH 05/11] fix: use correct fixed delta seconds --- code/agent/launch/dev.launch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/agent/launch/dev.launch b/code/agent/launch/dev.launch index ddfae533..73799a1c 100644 --- a/code/agent/launch/dev.launch +++ b/code/agent/launch/dev.launch @@ -15,7 +15,7 @@ - + From db146f3185dfe03e0b931f41d63567c3ba8f4175 Mon Sep 17 00:00:00 2001 From: ll7 Date: Thu, 29 Aug 2024 15:18:37 +0200 Subject: [PATCH 06/11] fix: do not set spectator rotation --- code/test-route/src/test_route.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/code/test-route/src/test_route.py b/code/test-route/src/test_route.py index 72709778..8d0e59a2 100755 --- a/code/test-route/src/test_route.py +++ b/code/test-route/src/test_route.py @@ -115,23 +115,29 @@ def wait_for_hero(self): self.hero = self.hero[0] break - def set_spectator(self): + def set_spectator(self, set_rotation=False): transform = self.hero.get_transform() - location = carla.Location(x=transform.location.x, - y=transform.location.y, - z=transform.location.z + 2) - self.spectator.set_transform( - carla.Transform( - location, carla.Rotation( - pitch=transform.rotation.pitch - 15, - yaw=transform.rotation.yaw, - roll=transform.rotation.roll + location = carla.Location( + x=transform.location.x, + y=transform.location.y, + z=transform.location.z + 2) + + if set_rotation: + self.spectator.set_transform( + carla.Transform( + location, carla.Rotation( + pitch=transform.rotation.pitch - 15, + yaw=transform.rotation.yaw, + roll=transform.rotation.roll + ) ) ) - ) + else: + self.spectator.set_location(location) def run(self): self.loginfo('Test-Route node running') + self.set_spectator(set_rotation=True) def loop(timer_event=None): self.set_spectator() From eeb174e09f188ae11976b664eb80eba8f3a0d9df Mon Sep 17 00:00:00 2001 From: ll7 Date: Thu, 29 Aug 2024 16:16:24 +0200 Subject: [PATCH 07/11] feat: run a compose file --- dc-run-file.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 dc-run-file.sh diff --git a/dc-run-file.sh b/dc-run-file.sh new file mode 100755 index 00000000..c369d196 --- /dev/null +++ b/dc-run-file.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# enable xhost +./xhost_enable.sh + +# run docker compose +if [ $# -eq 0 ]; then + echo "Usage: $0 " + exit 1 +fi + +docker compose -f "$1" up From 3d45c5f36c94e6f20578a8940631822332b50348 Mon Sep 17 00:00:00 2001 From: ll7 Date: Thu, 29 Aug 2024 16:16:52 +0200 Subject: [PATCH 08/11] feat: extend base image --- build/docker/agent-base/Dockerfile | 189 +++++++++++++++++++++++ build/docker/agent-dev/Dockerfile | 30 ++++ build/docker/agent-dev/dev_entrypoint.sh | 24 +++ 3 files changed, 243 insertions(+) create mode 100644 build/docker/agent-base/Dockerfile create mode 100644 build/docker/agent-dev/Dockerfile create mode 100755 build/docker/agent-dev/dev_entrypoint.sh diff --git a/build/docker/agent-base/Dockerfile b/build/docker/agent-base/Dockerfile new file mode 100644 index 00000000..08708636 --- /dev/null +++ b/build/docker/agent-base/Dockerfile @@ -0,0 +1,189 @@ +# Based on https://github.com/ll7/paf21-1/blob/master/components/carla_ros_bridge/Dockerfile + +# This is commented out because of the large image download necessary to build this image otherwise. +# If the PythonAPI/carla version changes, one can comment out the Download Carla PythonAPI line below. +# Then, uncomment this line and the COPY --from=carla line to build the image. +# FROM ghcr.io/nylser/carla:leaderboard as carla +# Use this image to enable instance segmentation cameras +# FROM carlasim/carla:0.9.14 as carla + +# supply the base image with an environment supporting ROS UI via x11 +FROM osrf/ros:noetic-desktop-full-focal + +# COPY --from=carla /home/carla/PythonAPI /opt/carla/PythonAPI + +ARG USERNAME=carla +ARG USER_UID=999 +ARG USER_GID=$USER_UID +ARG DEBIAN_FRONTEND=noninteractive + +# install rendering dependencies for rviz / rqt +RUN apt-get update \ + && apt-get install -y -qq --no-install-recommends \ + libxext6 libx11-6 libglvnd0 libgl1 \ + libglx0 libegl1 freeglut3-dev apt-utils \ + fprintd libfprint-2-2 libpam-fprintd + +# install dependencies for libgit2 and Carla PythonAPI +RUN apt-get install wget unzip + +# Download Carla PythonAPI (alternative to getting it from the Carla-Image, which is commented out above) +# If the PythonAPI/Carla version changes, either update the link, or refer to the comment at the top of this file. +RUN wget https://github.com/una-auxme/paf23/releases/download/v0.0.1/PythonAPI_Leaderboard-2.0.zip -O PythonAPI.zip \ + && unzip PythonAPI.zip \ + && rm PythonAPI.zip \ + && mkdir -p /opt/carla \ + && mv PythonAPI /opt/carla/PythonAPI + +# Workaround/fix for using dpkg for cuda installation +# Only required for the lab PCs +RUN rm -f /var/lib/dpkg/info/fprintd.postinst \ + && rm -f /var/lib/dpkg/info/libfprint*.postinst \ + && rm -f /var/lib/dpkg/info/libpam-fprintd*.postinst \ + && dpkg --configure -a + +# CUDA installation +RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin \ + && mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 \ + && wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb \ + && dpkg -i cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb \ + && cp /var/cuda-repo-ubuntu2004-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/ \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get -y install cuda \ + && rm cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb \ + && apt-get -y remove cuda-repo-ubuntu2004-11-8-local \ + && rm /etc/apt/preferences.d/cuda-repository-pin-600 \ + && rm -rf /var/cuda-repo-ubuntu1804-11-8-local/ \ + && rm /etc/apt/sources.list.d/cuda-ubuntu2004-11-8-local.list \ + && apt-get clean + +ENV CUDA_HOME=/usr/local/cuda-11.8 + +# override python path, carla pip package path didn't exist and was using Python 3.7 instead of 2.7 +ENV PYTHONPATH=/opt/ros/noetic/lib/python3/dist-packages +ENV PYTHONPATH=$PYTHONPATH:/opt/carla/PythonAPI/carla/dist/carla-0.9.14-py3.7-linux-x86_64.egg:/opt/carla/PythonAPI/carla + +# install mlocate, pip, wget, git and some ROS dependencies for building the CARLA ROS bridge +RUN apt-get update && apt-get install -y \ + mlocate python3-pip wget git python-is-python3 \ + ros-noetic-ackermann-msgs ros-noetic-derived-object-msgs \ + ros-noetic-carla-msgs ros-noetic-pcl-conversions \ + ros-noetic-rviz ros-noetic-rqt ros-noetic-pcl-ros ros-noetic-rosbridge-suite ros-noetic-rosbridge-server \ + ros-noetic-robot-pose-ekf ros-noetic-ros-numpy \ + ros-noetic-py-trees-ros ros-noetic-rqt-py-trees ros-noetic-rqt-reconfigure + +SHELL ["/bin/bash", "-c"] + +# Create and apply the non-root user +# -f parameter to work in macos (https://unix.stackexchange.com/a/465014), since gid is already in use there +RUN groupadd --gid $USER_GID $USERNAME -f \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && apt-get update \ + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME +USER $USERNAME + +# create a catkin workspace +WORKDIR /catkin_ws +# make sure the catkin workspace belongs to the user +RUN sudo chown $USERNAME:$USERNAME /catkin_ws && mkdir src + +# install the CARLA ROS bridge +ARG ROS_BRIDGE_GITHUB_URL=https://github.com/carla-simulator/ros-bridge +RUN git clone -b leaderboard-2.0 --recurse-submodules --single-branch $ROS_BRIDGE_GITHUB_URL src/ros-bridge +# apply patch to fix the build of carla_ros_bridge +RUN cd src/ros-bridge/carla_ackermann_control && \ + sed -i '24 i \ carla_msgs' package.xml +RUN source /opt/ros/noetic/setup.bash && \ + rosdep update && rosdep install --from-paths src --ignore-src -r && \ + catkin_make install + +ENV CARLA_ROS_BRIDGE_ROOT=/catkin_ws/src/ros-bridge + +# avoid python warnings about missing bin directory in PATH +# (as we're not running as root, pip installs into ~/.local/bin) +ENV PATH=$PATH:/home/$USERNAME/.local/bin + +# install simple_pid +RUN python -m pip install pip --upgrade \ + && python -m pip install simple_pid pygame transformations roslibpy lxml + +# install the scenario runner from GitHub leaderboard-2.0 branch +ENV CARLA_ROOT=/opt/carla +ENV SCENARIO_RUNNER_ROOT=/opt/scenario_runner +RUN sudo mkdir $SCENARIO_RUNNER_ROOT && sudo chown $USERNAME:$USERNAME $SCENARIO_RUNNER_ROOT +RUN git clone -b leaderboard-2.0 --single-branch https://github.com/carla-simulator/scenario_runner.git $SCENARIO_RUNNER_ROOT +RUN echo 'pexpect' >> $SCENARIO_RUNNER_ROOT/requirements.txt && \ + python -m pip install -r $SCENARIO_RUNNER_ROOT/requirements.txt + +# install the leaderboard from GitHub leaderboard-2.0 branch +ENV LEADERBOARD_ROOT=/opt/leaderboard +RUN sudo mkdir $LEADERBOARD_ROOT && sudo chown $USERNAME:$USERNAME $LEADERBOARD_ROOT +RUN git clone -b leaderboard-2.0 --single-branch https://github.com/una-auxme/leaderboard $LEADERBOARD_ROOT +RUN python -m pip install -r $LEADERBOARD_ROOT/requirements.txt +RUN sudo mkdir /opt/leaderboard-py3 && sudo chown $USERNAME:$USERNAME /opt/leaderboard-py3 && \ + ln -s $LEADERBOARD_ROOT/leaderboard /opt/leaderboard-py3/leaderboard && \ + ln -s $SCENARIO_RUNNER_ROOT/srunner /opt/leaderboard-py3/srunner + +# environment variables for the leaderboard_evaluator +ENV ROUTES=$LEADERBOARD_ROOT/data/routes_devtest.xml +ENV REPETITIONS=1 +ENV DEBUG_CHALLENGE=1 +#ENV TEAM_AGENT=$LEADERBOARD_ROOT/leaderboard/autoagents/human_agent.py +ENV TEAM_AGENT=/workspace/code/agent/src/agent/agent.py +ENV CHECKPOINT_ENDPOINT=/workspace/code/simulation_results.json +ENV CHALLENGE_TRACK=MAP + +ENV CARLA_SIM_HOST=localhost +ENV CARLA_SIM_WAIT_SECS=15 +ENV SCENARIO_RUNNER_PATH=/opt/scenario_runner + +# setup python path for PyCharm integration +RUN echo /catkin_ws/install/lib/python3/dist-packages >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ + echo /catkin_ws/devel/lib/python3/dist-packages >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ + echo /opt/ros/noetic/lib/python3/dist-packages >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ + echo /opt/ros/noetic/lib/python3/dist-packages >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ + echo /opt/leaderboard-py3 >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ + echo /opt/carla/PythonAPI/carla/dist/carla-0.9.14-py3.7-linux-x86_64.egg >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ + echo /opt/carla/PythonAPI/carla >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth + +RUN sudo mkdir /workspace && sudo chown $USERNAME:$USERNAME /workspace + +RUN echo "export CUDA_HOME=/usr/local/cuda-11" >> ~/.bashrc \ + && echo "export PATH=$PATH:$CUDA_HOME/bin" >> ~/.bashrc + +COPY --chown=$USERNAME:$USERNAME ./code/requirements.txt /workspace/ +ENV TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0 7.5 8.0 8.6 8.7 8.9+PTX" +ENV IABN_FORCE_CUDA=1 + +RUN source ~/.bashrc && pip install -r /workspace/requirements.txt + +# Add agent code +COPY --chown=$USERNAME:$USERNAME ./code /workspace/code/ + +# Link code into catkin workspace +RUN ln -s /workspace/code /catkin_ws/src + +# re-make the catkin workspace +RUN source /opt/ros/noetic/setup.bash && catkin_make + +ADD ./build/docker/agent/entrypoint.sh /entrypoint.sh + + + +# set the default working directory to the code +WORKDIR /workspace/code + +RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc + +# ENTRYPOINT ["/entrypoint.sh"] +# CMD ["bash", "-c", "sleep 10 && \ +# python3 /opt/leaderboard/leaderboard/leaderboard_evaluator.py \ +# --debug=${DEBUG_CHALLENGE} \ +# --repetitions=${REPETITIONS} \ +# --checkpoint=${CHECKPOINT_ENDPOINT} \ +# --track=${CHALLENGE_TRACK} \ +# --agent=${TEAM_AGENT} \ +# --routes=${ROUTES} \ +# --host=${CARLA_SIM_HOST}"] diff --git a/build/docker/agent-dev/Dockerfile b/build/docker/agent-dev/Dockerfile new file mode 100644 index 00000000..fef9cec3 --- /dev/null +++ b/build/docker/agent-dev/Dockerfile @@ -0,0 +1,30 @@ +# syntax = edrevo/dockerfile-plus + +INCLUDE+ ./build/docker/agent/Dockerfile + +# Add development tools +RUN sudo apt-get update && sudo apt-get install -y \ + vim \ + nano \ + tmux \ + git \ + curl \ + htop + +# Create a development entry point script +# RUN echo '#!/bin/bash\n\ +# source /opt/ros/noetic/setup.bash\n\ +# source /catkin_ws/devel/setup.bash\n\ +# exec "$@"' > /dev_entrypoint.sh && \ +# chmod +x /dev_entrypoint.sh + +ADD ./build/docker/agent-dev/dev_entrypoint.sh /dev_entrypoint.sh + +RUN chmod +x /dev_entrypoint.sh + + +# Set the development entry point +ENTRYPOINT ["/dev_entrypoint.sh"] + +# Default to bash if no command is provided +CMD ["bash"] \ No newline at end of file diff --git a/build/docker/agent-dev/dev_entrypoint.sh b/build/docker/agent-dev/dev_entrypoint.sh new file mode 100755 index 00000000..8790b0d8 --- /dev/null +++ b/build/docker/agent-dev/dev_entrypoint.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Source ROS setup +source /opt/ros/noetic/setup.bash + +# Source the catkin workspace setup +source /catkin_ws/devel/setup.bash + +# Set up any additional environment variables if needed +export CARLA_ROOT=/opt/carla +export SCENARIO_RUNNER_ROOT=/opt/scenario_runner +export LEADERBOARD_ROOT=/opt/leaderboard + +# Print a welcome message +echo "Welcome to the CARLA development environment!" +echo "ROS Noetic and CARLA dependencies are set up." +echo "Your workspace is at /workspace/code" + +# Execute the command passed to the script, or start a bash session if no command was given +if [ $# -eq 0 ]; then + exec bash +else + exec "$@" +fi \ No newline at end of file From 40a343cc78adb70055aee74a55f72b1add197006 Mon Sep 17 00:00:00 2001 From: ll7 Date: Thu, 29 Aug 2024 16:17:06 +0200 Subject: [PATCH 09/11] feat: use docker compose to run dev offline --- build/docker-compose_dev_offline.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 build/docker-compose_dev_offline.yaml diff --git a/build/docker-compose_dev_offline.yaml b/build/docker-compose_dev_offline.yaml new file mode 100644 index 00000000..95bbdd18 --- /dev/null +++ b/build/docker-compose_dev_offline.yaml @@ -0,0 +1,26 @@ +services: + agent-dev: + build: + dockerfile: build/docker/agent-dev/Dockerfile + context: ../ + args: + - USER_UID=${DOCKER_HOST_UNIX_UID:-1000} + - USER_GID=${DOCKER_HOST_UNIX_GID:-1000} + init: true + tty: true + shm_size: 2gb + deploy: + resources: + reservations: + devices: + - driver: nvidia + capabilities: [ gpu ] + volumes: + - ./code:/workspace/code + environment: + - DISPLAY=${DISPLAY} + network_mode: host + privileged: true + entrypoint: ["/dev_entrypoint.sh"] + command: bash + \ No newline at end of file From 0cc7c1e50d21883c9eed01479deadd6c2d177c94 Mon Sep 17 00:00:00 2001 From: JulianTrommer Date: Thu, 29 Aug 2024 17:04:59 +0200 Subject: [PATCH 10/11] fix: Changed volume & entrypoint permissions --- build/docker-compose_dev_offline.yaml | 2 +- build/docker/agent-dev/Dockerfile | 3 --- build/docker/agent-dev/dev_entrypoint.sh | 5 ----- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/build/docker-compose_dev_offline.yaml b/build/docker-compose_dev_offline.yaml index 95bbdd18..28581b4b 100644 --- a/build/docker-compose_dev_offline.yaml +++ b/build/docker-compose_dev_offline.yaml @@ -16,7 +16,7 @@ services: - driver: nvidia capabilities: [ gpu ] volumes: - - ./code:/workspace/code + - ../:/workspace environment: - DISPLAY=${DISPLAY} network_mode: host diff --git a/build/docker/agent-dev/Dockerfile b/build/docker/agent-dev/Dockerfile index fef9cec3..5648d443 100644 --- a/build/docker/agent-dev/Dockerfile +++ b/build/docker/agent-dev/Dockerfile @@ -20,9 +20,6 @@ RUN sudo apt-get update && sudo apt-get install -y \ ADD ./build/docker/agent-dev/dev_entrypoint.sh /dev_entrypoint.sh -RUN chmod +x /dev_entrypoint.sh - - # Set the development entry point ENTRYPOINT ["/dev_entrypoint.sh"] diff --git a/build/docker/agent-dev/dev_entrypoint.sh b/build/docker/agent-dev/dev_entrypoint.sh index 8790b0d8..14f912e3 100755 --- a/build/docker/agent-dev/dev_entrypoint.sh +++ b/build/docker/agent-dev/dev_entrypoint.sh @@ -11,11 +11,6 @@ export CARLA_ROOT=/opt/carla export SCENARIO_RUNNER_ROOT=/opt/scenario_runner export LEADERBOARD_ROOT=/opt/leaderboard -# Print a welcome message -echo "Welcome to the CARLA development environment!" -echo "ROS Noetic and CARLA dependencies are set up." -echo "Your workspace is at /workspace/code" - # Execute the command passed to the script, or start a bash session if no command was given if [ $# -eq 0 ]; then exec bash From ab8720ea4478ea4a059871887a183715889d3ad3 Mon Sep 17 00:00:00 2001 From: JulianTrommer Date: Thu, 29 Aug 2024 17:07:12 +0200 Subject: [PATCH 11/11] fix: Removed agent-base --- build/docker/agent-base/Dockerfile | 189 ----------------------------- 1 file changed, 189 deletions(-) delete mode 100644 build/docker/agent-base/Dockerfile diff --git a/build/docker/agent-base/Dockerfile b/build/docker/agent-base/Dockerfile deleted file mode 100644 index 08708636..00000000 --- a/build/docker/agent-base/Dockerfile +++ /dev/null @@ -1,189 +0,0 @@ -# Based on https://github.com/ll7/paf21-1/blob/master/components/carla_ros_bridge/Dockerfile - -# This is commented out because of the large image download necessary to build this image otherwise. -# If the PythonAPI/carla version changes, one can comment out the Download Carla PythonAPI line below. -# Then, uncomment this line and the COPY --from=carla line to build the image. -# FROM ghcr.io/nylser/carla:leaderboard as carla -# Use this image to enable instance segmentation cameras -# FROM carlasim/carla:0.9.14 as carla - -# supply the base image with an environment supporting ROS UI via x11 -FROM osrf/ros:noetic-desktop-full-focal - -# COPY --from=carla /home/carla/PythonAPI /opt/carla/PythonAPI - -ARG USERNAME=carla -ARG USER_UID=999 -ARG USER_GID=$USER_UID -ARG DEBIAN_FRONTEND=noninteractive - -# install rendering dependencies for rviz / rqt -RUN apt-get update \ - && apt-get install -y -qq --no-install-recommends \ - libxext6 libx11-6 libglvnd0 libgl1 \ - libglx0 libegl1 freeglut3-dev apt-utils \ - fprintd libfprint-2-2 libpam-fprintd - -# install dependencies for libgit2 and Carla PythonAPI -RUN apt-get install wget unzip - -# Download Carla PythonAPI (alternative to getting it from the Carla-Image, which is commented out above) -# If the PythonAPI/Carla version changes, either update the link, or refer to the comment at the top of this file. -RUN wget https://github.com/una-auxme/paf23/releases/download/v0.0.1/PythonAPI_Leaderboard-2.0.zip -O PythonAPI.zip \ - && unzip PythonAPI.zip \ - && rm PythonAPI.zip \ - && mkdir -p /opt/carla \ - && mv PythonAPI /opt/carla/PythonAPI - -# Workaround/fix for using dpkg for cuda installation -# Only required for the lab PCs -RUN rm -f /var/lib/dpkg/info/fprintd.postinst \ - && rm -f /var/lib/dpkg/info/libfprint*.postinst \ - && rm -f /var/lib/dpkg/info/libpam-fprintd*.postinst \ - && dpkg --configure -a - -# CUDA installation -RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin \ - && mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 \ - && wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb \ - && dpkg -i cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb \ - && cp /var/cuda-repo-ubuntu2004-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/ \ - && apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get -y install cuda \ - && rm cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb \ - && apt-get -y remove cuda-repo-ubuntu2004-11-8-local \ - && rm /etc/apt/preferences.d/cuda-repository-pin-600 \ - && rm -rf /var/cuda-repo-ubuntu1804-11-8-local/ \ - && rm /etc/apt/sources.list.d/cuda-ubuntu2004-11-8-local.list \ - && apt-get clean - -ENV CUDA_HOME=/usr/local/cuda-11.8 - -# override python path, carla pip package path didn't exist and was using Python 3.7 instead of 2.7 -ENV PYTHONPATH=/opt/ros/noetic/lib/python3/dist-packages -ENV PYTHONPATH=$PYTHONPATH:/opt/carla/PythonAPI/carla/dist/carla-0.9.14-py3.7-linux-x86_64.egg:/opt/carla/PythonAPI/carla - -# install mlocate, pip, wget, git and some ROS dependencies for building the CARLA ROS bridge -RUN apt-get update && apt-get install -y \ - mlocate python3-pip wget git python-is-python3 \ - ros-noetic-ackermann-msgs ros-noetic-derived-object-msgs \ - ros-noetic-carla-msgs ros-noetic-pcl-conversions \ - ros-noetic-rviz ros-noetic-rqt ros-noetic-pcl-ros ros-noetic-rosbridge-suite ros-noetic-rosbridge-server \ - ros-noetic-robot-pose-ekf ros-noetic-ros-numpy \ - ros-noetic-py-trees-ros ros-noetic-rqt-py-trees ros-noetic-rqt-reconfigure - -SHELL ["/bin/bash", "-c"] - -# Create and apply the non-root user -# -f parameter to work in macos (https://unix.stackexchange.com/a/465014), since gid is already in use there -RUN groupadd --gid $USER_GID $USERNAME -f \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ - && apt-get update \ - && apt-get install -y sudo \ - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ - && chmod 0440 /etc/sudoers.d/$USERNAME -USER $USERNAME - -# create a catkin workspace -WORKDIR /catkin_ws -# make sure the catkin workspace belongs to the user -RUN sudo chown $USERNAME:$USERNAME /catkin_ws && mkdir src - -# install the CARLA ROS bridge -ARG ROS_BRIDGE_GITHUB_URL=https://github.com/carla-simulator/ros-bridge -RUN git clone -b leaderboard-2.0 --recurse-submodules --single-branch $ROS_BRIDGE_GITHUB_URL src/ros-bridge -# apply patch to fix the build of carla_ros_bridge -RUN cd src/ros-bridge/carla_ackermann_control && \ - sed -i '24 i \ carla_msgs' package.xml -RUN source /opt/ros/noetic/setup.bash && \ - rosdep update && rosdep install --from-paths src --ignore-src -r && \ - catkin_make install - -ENV CARLA_ROS_BRIDGE_ROOT=/catkin_ws/src/ros-bridge - -# avoid python warnings about missing bin directory in PATH -# (as we're not running as root, pip installs into ~/.local/bin) -ENV PATH=$PATH:/home/$USERNAME/.local/bin - -# install simple_pid -RUN python -m pip install pip --upgrade \ - && python -m pip install simple_pid pygame transformations roslibpy lxml - -# install the scenario runner from GitHub leaderboard-2.0 branch -ENV CARLA_ROOT=/opt/carla -ENV SCENARIO_RUNNER_ROOT=/opt/scenario_runner -RUN sudo mkdir $SCENARIO_RUNNER_ROOT && sudo chown $USERNAME:$USERNAME $SCENARIO_RUNNER_ROOT -RUN git clone -b leaderboard-2.0 --single-branch https://github.com/carla-simulator/scenario_runner.git $SCENARIO_RUNNER_ROOT -RUN echo 'pexpect' >> $SCENARIO_RUNNER_ROOT/requirements.txt && \ - python -m pip install -r $SCENARIO_RUNNER_ROOT/requirements.txt - -# install the leaderboard from GitHub leaderboard-2.0 branch -ENV LEADERBOARD_ROOT=/opt/leaderboard -RUN sudo mkdir $LEADERBOARD_ROOT && sudo chown $USERNAME:$USERNAME $LEADERBOARD_ROOT -RUN git clone -b leaderboard-2.0 --single-branch https://github.com/una-auxme/leaderboard $LEADERBOARD_ROOT -RUN python -m pip install -r $LEADERBOARD_ROOT/requirements.txt -RUN sudo mkdir /opt/leaderboard-py3 && sudo chown $USERNAME:$USERNAME /opt/leaderboard-py3 && \ - ln -s $LEADERBOARD_ROOT/leaderboard /opt/leaderboard-py3/leaderboard && \ - ln -s $SCENARIO_RUNNER_ROOT/srunner /opt/leaderboard-py3/srunner - -# environment variables for the leaderboard_evaluator -ENV ROUTES=$LEADERBOARD_ROOT/data/routes_devtest.xml -ENV REPETITIONS=1 -ENV DEBUG_CHALLENGE=1 -#ENV TEAM_AGENT=$LEADERBOARD_ROOT/leaderboard/autoagents/human_agent.py -ENV TEAM_AGENT=/workspace/code/agent/src/agent/agent.py -ENV CHECKPOINT_ENDPOINT=/workspace/code/simulation_results.json -ENV CHALLENGE_TRACK=MAP - -ENV CARLA_SIM_HOST=localhost -ENV CARLA_SIM_WAIT_SECS=15 -ENV SCENARIO_RUNNER_PATH=/opt/scenario_runner - -# setup python path for PyCharm integration -RUN echo /catkin_ws/install/lib/python3/dist-packages >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ - echo /catkin_ws/devel/lib/python3/dist-packages >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ - echo /opt/ros/noetic/lib/python3/dist-packages >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ - echo /opt/ros/noetic/lib/python3/dist-packages >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ - echo /opt/leaderboard-py3 >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ - echo /opt/carla/PythonAPI/carla/dist/carla-0.9.14-py3.7-linux-x86_64.egg >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth && \ - echo /opt/carla/PythonAPI/carla >> /home/$USERNAME/.local/lib/python3.8/site-packages/carla.pth - -RUN sudo mkdir /workspace && sudo chown $USERNAME:$USERNAME /workspace - -RUN echo "export CUDA_HOME=/usr/local/cuda-11" >> ~/.bashrc \ - && echo "export PATH=$PATH:$CUDA_HOME/bin" >> ~/.bashrc - -COPY --chown=$USERNAME:$USERNAME ./code/requirements.txt /workspace/ -ENV TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0 7.5 8.0 8.6 8.7 8.9+PTX" -ENV IABN_FORCE_CUDA=1 - -RUN source ~/.bashrc && pip install -r /workspace/requirements.txt - -# Add agent code -COPY --chown=$USERNAME:$USERNAME ./code /workspace/code/ - -# Link code into catkin workspace -RUN ln -s /workspace/code /catkin_ws/src - -# re-make the catkin workspace -RUN source /opt/ros/noetic/setup.bash && catkin_make - -ADD ./build/docker/agent/entrypoint.sh /entrypoint.sh - - - -# set the default working directory to the code -WORKDIR /workspace/code - -RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc - -# ENTRYPOINT ["/entrypoint.sh"] -# CMD ["bash", "-c", "sleep 10 && \ -# python3 /opt/leaderboard/leaderboard/leaderboard_evaluator.py \ -# --debug=${DEBUG_CHALLENGE} \ -# --repetitions=${REPETITIONS} \ -# --checkpoint=${CHECKPOINT_ENDPOINT} \ -# --track=${CHALLENGE_TRACK} \ -# --agent=${TEAM_AGENT} \ -# --routes=${ROUTES} \ -# --host=${CARLA_SIM_HOST}"]