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 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" diff --git a/build/docker-compose_dev_offline.yaml b/build/docker-compose_dev_offline.yaml new file mode 100644 index 00000000..28581b4b --- /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: + - ../:/workspace + environment: + - DISPLAY=${DISPLAY} + network_mode: host + privileged: true + entrypoint: ["/dev_entrypoint.sh"] + command: bash + \ No newline at end of file diff --git a/build/docker/agent-dev/Dockerfile b/build/docker/agent-dev/Dockerfile new file mode 100644 index 00000000..5648d443 --- /dev/null +++ b/build/docker/agent-dev/Dockerfile @@ -0,0 +1,27 @@ +# 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 + +# 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..14f912e3 --- /dev/null +++ b/build/docker/agent-dev/dev_entrypoint.sh @@ -0,0 +1,19 @@ +#!/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 + +# 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 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/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, 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 @@ - + 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 @@ - + 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() 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