From daf2255f217aeec3654f2747c56dba298ec23c93 Mon Sep 17 00:00:00 2001 From: JulianTrommer Date: Tue, 15 Oct 2024 15:56:49 +0200 Subject: [PATCH] Refactored repo with linters --- .vscode/settings.json | 1 - build/agent_service.yaml | 4 ++ build/docker-compose.dev.yaml | 4 +- build/docker/agent-dev/dev_entrypoint.sh | 16 +---- build/docker/agent/Dockerfile | 3 +- build/docker/agent/Dockerfile_Submission | 35 ++++----- build/docker/agent/entrypoint.sh | 4 +- code/__init__.py | 0 code/perception/launch/perception.launch | 4 +- .../traffic_light_training.py | 8 +-- code/perception/src/traffic_light_node.py | 4 +- code/perception/src/vision_node.py | 4 +- code/planning/__init__.py | 1 - code/planning/src/behavior_agent/__init__.py | 0 .../src/behavior_agent/behavior_tree.py | 72 ++++++++----------- .../src/behavior_agent/behaviours/__init__.py | 3 - .../behavior_agent/behaviours/intersection.py | 12 ++-- .../behavior_agent/behaviours/lane_change.py | 2 +- .../behavior_agent/behaviours/maneuvers.py | 2 +- .../src/behavior_agent/behaviours/overtake.py | 3 +- .../src/local_planner/motion_planning.py | 7 +- doc/development/templates/template_class.py | 17 +++-- .../templates/template_class_no_comments.py | 8 +-- .../object-detection-model_evaluation/pt.py | 4 +- 24 files changed, 101 insertions(+), 117 deletions(-) delete mode 100644 code/__init__.py delete mode 100755 code/planning/__init__.py delete mode 100755 code/planning/src/behavior_agent/__init__.py mode change 100755 => 100644 code/planning/src/behavior_agent/behaviours/__init__.py diff --git a/.vscode/settings.json b/.vscode/settings.json index 817fbe31..260ba70c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,6 @@ { "githubIssues.issueBranchTitle": "${issueNumber}-${sanitizedIssueTitle}", "githubIssues.queries": [ - { "label": "My Issues", "query": "default" diff --git a/build/agent_service.yaml b/build/agent_service.yaml index 8266fe9d..13d8bab1 100644 --- a/build/agent_service.yaml +++ b/build/agent_service.yaml @@ -3,6 +3,10 @@ services: build: dockerfile: build/docker/agent/Dockerfile context: ../ + args: + USERNAME: ${USERNAME} + USER_UID: ${USER_UID} + USER_GID: ${USER_GID} init: true tty: true shm_size: 2gb diff --git a/build/docker-compose.dev.yaml b/build/docker-compose.dev.yaml index 95d06f11..ab21bf03 100644 --- a/build/docker-compose.dev.yaml +++ b/build/docker-compose.dev.yaml @@ -1,5 +1,8 @@ # compose file for the development without a driving vehicle # "interactive" development without a car +include: + - roscore_service.yaml + services: agent-dev: build: @@ -24,5 +27,4 @@ services: - DISPLAY=${DISPLAY} network_mode: host privileged: true - entrypoint: ["/dev_entrypoint.sh"] command: bash -c "sudo chown -R ${USER_UID}:${USER_GID} ../ && sudo chmod -R a+w ../ && bash" diff --git a/build/docker/agent-dev/dev_entrypoint.sh b/build/docker/agent-dev/dev_entrypoint.sh index 14f912e3..2626fcb9 100755 --- a/build/docker/agent-dev/dev_entrypoint.sh +++ b/build/docker/agent-dev/dev_entrypoint.sh @@ -1,19 +1,7 @@ #!/bin/bash +set -e -# 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 - -# 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 +exec "$@" diff --git a/build/docker/agent/Dockerfile b/build/docker/agent/Dockerfile index c8c05ceb..dff54814 100644 --- a/build/docker/agent/Dockerfile +++ b/build/docker/agent/Dockerfile @@ -170,12 +170,11 @@ 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 +RUN echo "source /catkin_ws/devel/setup.bash" >> ~/.bashrc ENTRYPOINT ["/entrypoint.sh"] CMD ["bash", "-c", "sleep 10 && \ diff --git a/build/docker/agent/Dockerfile_Submission b/build/docker/agent/Dockerfile_Submission index 128a8bd8..8128266e 100644 --- a/build/docker/agent/Dockerfile_Submission +++ b/build/docker/agent/Dockerfile_Submission @@ -19,7 +19,7 @@ ARG DEBIAN_FRONTEND=noninteractive # install rendering dependencies for rviz / rqt RUN apt-get update \ - && apt-get install -y -qq --no-install-recommends \ + && apt-get install -y -qq --no-install-recommends \ libxext6 libx11-6 libglvnd0 libgl1 \ libglx0 libegl1 freeglut3-dev @@ -27,10 +27,10 @@ RUN apt-get update \ RUN apt-get install wget unzip RUN wget https://github.com/una-auxme/paf/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 + && unzip PythonAPI.zip \ + && rm PythonAPI.zip \ + && mkdir -p /opt/carla \ + && mv PythonAPI /opt/carla/PythonAPI # build libgit2 RUN wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.0.tar.gz -O libgit2-1.5.0.tar.gz \ @@ -67,12 +67,12 @@ ENV PYTHONPATH=$PYTHONPATH:/opt/carla/PythonAPI/carla/dist/carla-0.9.14-py3.7-li # 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 + 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"] @@ -178,12 +178,13 @@ ADD ./build/docker/agent/entrypoint.sh /entrypoint.sh WORKDIR /workspace/code RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc +RUN echo "source /catkin_ws/devel/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}"] + --repetitions=${REPETITIONS} \ + --checkpoint=${CHECKPOINT_ENDPOINT} \ + --track=${CHALLENGE_TRACK} \ + --agent=${TEAM_AGENT} \ + --routes=${ROUTES} \ + --host=${CARLA_SIM_HOST}"] diff --git a/build/docker/agent/entrypoint.sh b/build/docker/agent/entrypoint.sh index 61e51dc4..2626fcb9 100755 --- a/build/docker/agent/entrypoint.sh +++ b/build/docker/agent/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e -source "/opt/ros/noetic/setup.bash" -source "/catkin_ws/devel/setup.bash" +source /opt/ros/noetic/setup.bash +source /catkin_ws/devel/setup.bash exec "$@" diff --git a/code/__init__.py b/code/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/code/perception/launch/perception.launch b/code/perception/launch/perception.launch index 45d970be..8d6072e7 100644 --- a/code/perception/launch/perception.launch +++ b/code/perception/launch/perception.launch @@ -41,8 +41,8 @@