From eea3bffeaf7377cfc07e28afc5cc80078902e05b Mon Sep 17 00:00:00 2001 From: Christian Geller Date: Tue, 15 Apr 2025 11:10:17 +0200 Subject: [PATCH 1/8] add carla-essentials and rename carla-server --- .github/workflows/automated-testing.yml | 1 - README.md | 8 ++-- automated-testing/README.md | 2 +- automated-testing/carla-sim.yml | 18 ------- automated-testing/evaluate-scenarios.sh | 14 +++--- automated-testing/template.yml | 6 +-- data-driven-development/docker-compose.yml | 47 ++++++++----------- data-driven-development/launch/demo.launch.py | 2 +- .../scripts/simulation_controller.py | 4 +- .../scripts/spawned_vehicle_check.py | 4 +- .../scripts/time_controller.py | 4 +- software-prototyping/README.md | 6 +-- .../carla-ros-bridge.launch.py | 2 +- software-prototyping/docker-compose.yml | 17 +++---- .../README.md} | 18 +++---- .../carla-services.yml} | 42 +++++++++++++---- utils/tutorial/README.md | 36 ++++++-------- utils/tutorial/docker-compose.yml | 26 ++++------ 18 files changed, 120 insertions(+), 137 deletions(-) delete mode 100644 automated-testing/carla-sim.yml rename utils/{components.md => carla-essentials/README.md} (75%) rename utils/{components.yml => carla-essentials/carla-services.yml} (65%) diff --git a/.github/workflows/automated-testing.yml b/.github/workflows/automated-testing.yml index fb195ab..d22da46 100644 --- a/.github/workflows/automated-testing.yml +++ b/.github/workflows/automated-testing.yml @@ -66,7 +66,6 @@ jobs: - uses: ika-rwth-aachen/carlos-ci-action@v0.1.1 continue-on-error: true with: - composefile-path: automated-testing/carla-sim.yml scenario-folder-path: ${{ matrix.filedir }} scenario-file-name: ${{ matrix.filename }} - shell: bash diff --git a/README.md b/README.md index b7f2cd5..156f2ce 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,9 @@ Each link below provides a detailed description of a provided use case and instr | Use Case | Integrated Components | Description | | ------ | ------ | ------ -| [***software-prototyping***](./software-prototyping/README.md) | carla-simulator, carla-ros-bridge, rviz | Transfers simulation data into the ROS ecosystem. | -| [***data-driven-development***](./data-driven-development/README.md) | carla-simulator, carla-ros-bridge, carla-scenario-runner | Automated simulation configuration to capture sensor data at large scale. | -| [***automated-testing***](./automated-testing/README.md) | carla-simulator, carla-scenario-runner | Sequential simulation of multiple scenarios in OpenSCENARIO format with automated evaluation. | +| [***software-prototyping***](./software-prototyping/README.md) | carla-server, carla-ros-bridge, rviz | Transfers simulation data into the ROS ecosystem. | +| [***data-driven-development***](./data-driven-development/README.md) | carla-server, carla-ros-bridge, carla-scenario-runner | Automated simulation configuration to capture sensor data at large scale. | +| [***automated-testing***](./automated-testing/README.md) | carla-server, carla-scenario-runner | Sequential simulation of multiple scenarios in OpenSCENARIO format with automated evaluation. | ## Simulation Architecture @@ -134,7 +134,7 @@ To enable scenario-based testing and evaluation, the carla-scenario-runner is us > [!NOTE] -> For all provided use case examples we use predefined Docker services, listed in [carla-components.yml](./utils/components.yml) and further described in the [carla-components overview](./utils/components.md). +> For all provided use case examples we use predefined Docker services, listed in [carla-services.yml](./utils/carla-essentials/carla-services.yml) and further described in the [carla-components overview](./utils/carla-essentials/README.md). ## Citation We hope that our simulation framework CARLOS can help your research. If this is the case, please cite it using the following metadata. diff --git a/automated-testing/README.md b/automated-testing/README.md index ff92b95..ce4a4f1 100644 --- a/automated-testing/README.md +++ b/automated-testing/README.md @@ -16,7 +16,7 @@ The subsequent demonstration showcases *automated testing* and specifically addr > Make sure that all [system requirements](../utils/requirements.md) are fulfilled. > Additionally, the CI related part of this demo requires a [self-hosted GitHub Runner](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners) to execute scenarios within a [GitHub workflow](https://docs.github.com/en/actions/using-workflows/about-workflows). The specific requirements for such a runner are listed [below](#self-hosted-github-runner). -This demo aims to automatically evaluate predefined test scenarios. For this purpose, a test catalog can be defined using OpenSCENARIO files as contained in the [scenarios](../utils/scenarios) folder. These scenarios can be simulated and evaluated using the [carla-scenario-runner](https://github.com/ika-rwth-aachen/carla-scenario-runner). Thus, a basic [docker-compose template](../.github/actions/evaluate-scenario/files/template.yml) only includes the `carla-simulator` and a `carla-scenario-runner` Docker service. So, in general, the demo enables the efficient execution of multiple scenario-based tests with CARLA, both in local environments and within an automated GitHub CI process. +This demo aims to automatically evaluate predefined test scenarios. For this purpose, a test catalog can be defined using OpenSCENARIO files as contained in the [scenarios](../utils/scenarios) folder. These scenarios can be simulated and evaluated using the [carla-scenario-runner](https://github.com/ika-rwth-aachen/carla-scenario-runner). Thus, a basic [docker-compose template](../.github/actions/evaluate-scenario/files/template.yml) only includes the `carla-server` and a `carla-scenario-runner` Docker service. So, in general, the demo enables the efficient execution of multiple scenario-based tests with CARLA, both in local environments and within an automated GitHub CI process. ### Manual Testing Pipeline diff --git a/automated-testing/carla-sim.yml b/automated-testing/carla-sim.yml deleted file mode 100644 index 11cb028..0000000 --- a/automated-testing/carla-sim.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: carlos-ci-action -services: - - carla-simulator: - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - privileged: True - environment: - DISPLAY: $DISPLAY - volumes: - - /tmp/.X11-unix:/tmp/.X11-unix - image: rwthika/carla-simulator:server - command: bash -ic './CarlaUE4.sh -nosound 2>/dev/null' \ No newline at end of file diff --git a/automated-testing/evaluate-scenarios.sh b/automated-testing/evaluate-scenarios.sh index 46a85f4..6d84304 100755 --- a/automated-testing/evaluate-scenarios.sh +++ b/automated-testing/evaluate-scenarios.sh @@ -2,6 +2,10 @@ set -e +DEFAULT_SIMULATOR_IMAGE="rwthika/carla-simulator:server" +DEFAULT_SCENARIO_RUNNER_IMAGE="rwthika/carla-scenario-runner:latest" +COMPOSE_TEMPLATE_PATH="./template.yml" + usage() { echo "Usage: $0 [-o][-p][-n] [COMPOSE_TEMPLATE_PATH] [SCENARIO_FOLDER_PATH]" echo "COMPOSE_TEMPLATE_PATH : Location of Compose file which can be customized through environment variables" @@ -23,7 +27,7 @@ restart-simulator() { echo "Restarting simulator..." docker compose -f $COMPOSE_TEMPLATE_PATH kill docker compose -f $COMPOSE_TEMPLATE_PATH down - docker compose -f $COMPOSE_TEMPLATE_PATH up -d carla-simulator + docker compose -f $COMPOSE_TEMPLATE_PATH up -d carla-server } update-simulator() { @@ -31,8 +35,6 @@ update-simulator() { docker compose -f $COMPOSE_TEMPLATE_PATH pull } -COMPOSE_TEMPLATE_PATH="./template.yml" - while getopts "hopn" flag; do case "$flag" in h) @@ -54,8 +56,8 @@ done shift $(($OPTIND-1)) # return to usual handling of positional args # default settings if no external overrides provided -export SIMULATOR_IMAGE=${SIMULATOR_IMAGE:-"rwthika/carla-simulator:server"} -export SCENARIO_RUNNER_IMAGE=${SCENARIO_RUNNER_IMAGE:-"rwthika/carla-scenario-runner:latest"} +export SIMULATOR_IMAGE=${SIMULATOR_IMAGE:-DEFAULT_SIMULATOR_IMAGE} +export SCENARIO_RUNNER_IMAGE=${SCENARIO_RUNNER_IMAGE:-DEFAULT_SCENARIO_RUNNER_IMAGE} export COMPOSE_TEMPLATE_PATH=$(realpath ${1:-$COMPOSE_TEMPLATE_PATH}) export SCENARIO_FOLDER_PATH=$(realpath ${2:-"../utils/scenarios"}) @@ -93,7 +95,7 @@ fi xhost +local: echo "Starting simulator..." -docker compose -f $COMPOSE_TEMPLATE_PATH up -d carla-simulator +docker compose -f $COMPOSE_TEMPLATE_PATH up -d carla-server for scenario in "${scenarios[@]}"; do echo "Evaluating $scenario ..." diff --git a/automated-testing/template.yml b/automated-testing/template.yml index c6ad179..ac7bbb4 100644 --- a/automated-testing/template.yml +++ b/automated-testing/template.yml @@ -1,6 +1,6 @@ services: - carla-simulator: + carla-server: deploy: resources: reservations: @@ -18,9 +18,9 @@ services: carla-scenario-runner: depends_on: - carla-simulator: + carla-server: condition: service_healthy volumes: - $SCENARIO_FOLDER_PATH:/scenarios image: $SCENARIO_RUNNER_IMAGE - command: bash -ic "python ./scenario_runner.py --host carla-simulator --openscenario /scenarios/$SCENARIO_FILE_NAME --output" \ No newline at end of file + command: bash -ic "python ./scenario_runner.py --host carla-server --openscenario /scenarios/$SCENARIO_FILE_NAME --output" \ No newline at end of file diff --git a/data-driven-development/docker-compose.yml b/data-driven-development/docker-compose.yml index ccb9319..520a6e4 100644 --- a/data-driven-development/docker-compose.yml +++ b/data-driven-development/docker-compose.yml @@ -7,18 +7,15 @@ services: # --- core services ---------------------------------------------------------- - carla-simulator: + carla-server: extends: - file: ../utils/components.yml - service: carla-simulator-offscreen + file: ../utils/carla-essentials/carla-services.yml + service: carla-server-offscreen carla-ros-bridge: extends: - file: ../utils/components.yml + file: ../utils/carla-essentials/carla-services.yml service: carla-ros-bridge - depends_on: - carla-simulator: - condition: service_healthy volumes: - *sensors-mount - ./launch/demo.launch.py:/demo.launch.py @@ -27,38 +24,32 @@ services: # ---------------------------------------------------------------------------- # --- checking services ------------------------------------------------------ + time-health-check: + extends: + file: ../utils/carla-essentials/carla-services.yml + service: carla-client + volumes: + - ./src/time_controller.py:/opt/carla/PythonAPI/time_controller.py + command: bash -ic "python time_controller.py --host carla-server ${max_simulation_time} ${max_real_time}" + spawned-vehicle-check: extends: - file: ../utils/components.yml + file: ../utils/carla-essentials/carla-services.yml service: carla-client - depends_on: - carla-simulator: - condition: service_healthy volumes: - ./scripts/spawned_vehicle_check.py:/opt/carla/PythonAPI/spawned_vehicle_check.py command: sleep infinity healthcheck: - test: ["CMD-SHELL", "bash -ic \"python spawned_vehicle_check.py --host carla-simulator --role_name_list ${role_names}\""] + test: ["CMD-SHELL", "bash -ic \"python spawned_vehicle_check.py --host carla-server --role_name_list ${role_names}\""] interval: 1s start_period: 10s retries: 3 - time-health-check: - extends: - file: ../utils/components.yml - service: carla-client - depends_on: - spawned-vehicle-check: - condition: service_healthy - volumes: - - ./scripts/time_controller.py:/opt/carla/PythonAPI/time_controller.py - command: bash -ic "python time_controller.py --host carla-simulator ${max_simulation_time} ${max_real_time}" - # ---------------------------------------------------------------------------- # --- Option A: apply random permutation setups ------------------------------ carla-simulation-controller: extends: - file: ../utils/components.yml + file: ../utils/carla-essentials/carla-services.yml service: carla-client depends_on: spawned-vehicle-check: @@ -67,25 +58,25 @@ services: - ./scripts/simulation_controller.py:/opt/carla/PythonAPI/simulation_controller.py - ./scripts/set_environment.py:/opt/carla/PythonAPI/set_environment.py - *sensors-mount - command: bash -ic "python -u simulation_controller.py --host carla-simulator ${controller_args}" + command: bash -ic "python -u simulation_controller.py --host carla-server ${controller_args}" # --- Option B: apply concrete scenario setups ------------------------------- carla-scenario-runner: extends: - file: ../utils/components.yml + file: ../utils/carla-essentials/carla-services.yml service: carla-scenario-runner depends_on: spawned-vehicle-check: condition: service_healthy volumes: - *scenario-mount - command: bash -ic "python ./scenario_runner.py --host carla-simulator --openscenario /scenarios/${scenario_file} --waitForEgo --output" + command: bash -ic "python ./scenario_runner.py --host carla-server --openscenario /scenarios/${scenario_file} --waitForEgo --output" # ---------------------------------------------------------------------------- # --- recording services ----------------------------------------------------- rosbag-record: extends: - file: ../utils/components.yml + file: ../utils/carla-essentials/carla-services.yml service: ros-monitoring-offscreen depends_on: spawned-vehicle-check: diff --git a/data-driven-development/launch/demo.launch.py b/data-driven-development/launch/demo.launch.py index a251036..32b30b0 100644 --- a/data-driven-development/launch/demo.launch.py +++ b/data-driven-development/launch/demo.launch.py @@ -10,7 +10,7 @@ def generate_launch_description(): # CARLA Args host_launch_arg = launch.actions.DeclareLaunchArgument( name='host', - default_value='carla-simulator' + default_value='carla-server' ) port_launch_arg = launch.actions.DeclareLaunchArgument( diff --git a/data-driven-development/scripts/simulation_controller.py b/data-driven-development/scripts/simulation_controller.py index a61907f..7240bef 100644 --- a/data-driven-development/scripts/simulation_controller.py +++ b/data-driven-development/scripts/simulation_controller.py @@ -16,8 +16,8 @@ def main(): argparser.add_argument( '--host', metavar='H', - default='carla-simulator', - help='IP of the host server (default: carla-simulator)') + default='carla-server', + help='IP of the host server (default: carla-server)') argparser.add_argument( '--spawn_point', metavar='S', diff --git a/data-driven-development/scripts/spawned_vehicle_check.py b/data-driven-development/scripts/spawned_vehicle_check.py index 38d4b2a..ce0e576 100644 --- a/data-driven-development/scripts/spawned_vehicle_check.py +++ b/data-driven-development/scripts/spawned_vehicle_check.py @@ -20,8 +20,8 @@ def main(): argparser.add_argument( '--host', metavar='H', - default='carla-simulator', - help='IP of the host server (default: carla-simulator)') + default='carla-server', + help='IP of the host server (default: carla-server)') argparser.add_argument('--role_name', metavar='R', default='ego_vehicle', diff --git a/data-driven-development/scripts/time_controller.py b/data-driven-development/scripts/time_controller.py index dda60ad..5bba5ce 100644 --- a/data-driven-development/scripts/time_controller.py +++ b/data-driven-development/scripts/time_controller.py @@ -16,8 +16,8 @@ def main(): argparser.add_argument( '--host', metavar='H', - default='carla-simulator', - help='IP of the host server (default: carla-simulator)') + default='carla-server', + help='IP of the host server (default: carla-server)') argparser.add_argument( '--max_simulation_time', metavar='T', diff --git a/software-prototyping/README.md b/software-prototyping/README.md index 0132804..489a8a9 100644 --- a/software-prototyping/README.md +++ b/software-prototyping/README.md @@ -24,13 +24,13 @@ Directly start the use case demonstration using the top-level `run-demo.sh` scri This example demonstrates a basic CARLA simulation in tandem with the widely used Robot Operations System ([ROS](https://www.ros.org/)). We only cover ROS 2 with this demo. In addition to a CARLA simulation core, a ROS bridge enables communication between CARLA and ROS by translating simulation outputs (e.g. sensor data) to ROS topics. In addition, RViz is used as a visualization component. Specifically, there are three main components used in the `software-prototyping` demo: -- [carla-simulator](https://github.com/ika-rwth-aachen/carla-simulator) +- [carla-server](https://github.com/ika-rwth-aachen/carla-simulator) - [carla-ros-bridge](https://github.com/ika-rwth-aachen/carla-ros-bridge) -- [ros-monitoring](https://github.com/ika-rwth-aachen/carlos/blob/main/utils/components.md#ros-monitoring) +- [ros-monitoring](https://github.com/ika-rwth-aachen/carlos/blob/main/utils/carla-essentials/README.md#ros-monitoring) - A containerized image segmentation ROS node that serves as an example on how to attached a custom function to the simulation. > [!NOTE] -> A detailed description of the individual components can be found in [components guide](../utils/components.md). +> A detailed description of the individual components can be found in [components guide](../utils/carla-essentials/README.md). ### Quick Start After starting the `software-prototyping` demo, a CARLA GUI opens up where you can look around using WASD, holding the left or right mouse button and moving the mouse in the desired direction. diff --git a/software-prototyping/carla-ros-bridge.launch.py b/software-prototyping/carla-ros-bridge.launch.py index 4a0ae46..49bbdfe 100644 --- a/software-prototyping/carla-ros-bridge.launch.py +++ b/software-prototyping/carla-ros-bridge.launch.py @@ -21,7 +21,7 @@ def generate_launch_description(): # carla-simualtor args host_launch_arg = launch.actions.DeclareLaunchArgument( name='host', - default_value='carla-simulator' + default_value='carla-server' ) port_launch_arg = launch.actions.DeclareLaunchArgument( diff --git a/software-prototyping/docker-compose.yml b/software-prototyping/docker-compose.yml index a8dcaa1..9c2e50f 100644 --- a/software-prototyping/docker-compose.yml +++ b/software-prototyping/docker-compose.yml @@ -6,18 +6,15 @@ x-rviz-config-mount: &rviz-config-mount ./config.rviz:/config.rviz services: - carla-simulator: + carla-server: extends: - file: ../utils/components.yml - service: carla-simulator + file: ../utils/carla-essentials/carla-services.yml + service: carla-server carla-ros-bridge: extends: - file: ../utils/components.yml + file: ../utils/carla-essentials/carla-services.yml service: carla-ros-bridge - depends_on: - carla-simulator: - condition: service_healthy volumes: - *launch-mount - *sensors-mount @@ -25,10 +22,10 @@ services: ros-monitoring: extends: - file: ../utils/components.yml + file: ../utils/carla-essentials/carla-services.yml service: ros-monitoring depends_on: - carla-simulator: + carla-server: condition: service_healthy volumes: - *rviz-config-mount @@ -36,7 +33,7 @@ services: image-segmentation: depends_on: - carla-simulator: + carla-server: condition: service_healthy image: rwthika/carlos-image-segmentation command: ros2 launch image_segmentation image_segmentation_launch.py image_topic:=/carla/ego_vehicle/rgb_front/image diff --git a/utils/components.md b/utils/carla-essentials/README.md similarity index 75% rename from utils/components.md rename to utils/carla-essentials/README.md index 47f1731..a1e86ba 100644 --- a/utils/components.md +++ b/utils/carla-essentials/README.md @@ -1,31 +1,31 @@ # Components -This document aims to give a brief overview of the various Docker services provided by [components.yml](./components.yml) and utilized within the CARLOS use cases. +This document aims to give a brief overview of the various Docker services provided by [carla-services.yml](./carla-services.yml) and utilized within the CARLOS use cases. ## Component List | Service Name | Repository | Docker Image | | --- | --- | --- | -| `carla-simulator` | [ika-rwth-aachen/carla](https://github.com/ika-rwth-aachen/carla) | rwthika/carla-simulator:server | -| `carla-client` | [ika-rwth-aachen/carla](https://github.com/ika-rwth-aachen/carla) | rwthika/carla-simulator:client | -| `carla-ros-bridge` | [ika-rwth-aachen/ros-bridge](https://github.com/ika-rwth-aachen/ros-bridge) | rwthika/carla-ros-bridge | -| `carla-scenario-runner` | [ika-rwth-aachen/carla_scenario_runner_ros](https://github.com/ika-rwth-aachen/carla_scenario_runner_ros) | rwthika/carla-scenario-runner | +| `carla-server` | [ika-rwth-aachen/carla-simulator](https://github.com/ika-rwth-aachen/carla-simulator) | rwthika/carla-simulator:server | +| `carla-client` | [ika-rwth-aachen/carla-simulator](https://github.com/ika-rwth-aachen/carla-simulator) | rwthika/carla-simulator:client | +| `carla-ros-bridge` | [ika-rwth-aachen/carla-ros-bridge](https://github.com/ika-rwth-aachen/ros-bridge) | rwthika/carla-ros-bridge | +| `carla-scenario-runner` | [ika-rwth-aachen/carla-scenario-runner](https://github.com/ika-rwth-aachen/carla-scenario-runner) | rwthika/carla-scenario-runner | | `ros-monitoring` | [ika-rwth-aachen/docker-ros-ml-images](https://github.com/ika-rwth-aachen/docker-ros-ml-images?tab=readme-ov-file#rwthikaros2-cuda-ros-2--cuda) | rwthika/ros2-cuda:humble-desktop-full | -## carla-simulator +## carla-server This Docker service represents a single instance of a [CARLA](http://carla.org/) simulator and constitutes the central element of the framework that aim to simulate and test automated driving features. -Starting this service (e.g. by `docker compose up carla-simulator` in this folder) should open up a new GUI window in which you can move around the currently loaded map and follow what is happening in simulations. +Starting this service (e.g. by `docker compose up carla-server` in this folder) should open up a new GUI window in which you can move around the currently loaded map and follow what is happening in simulations. In addition, the Docker services provides a continuous health check monitoring if the CARLA server is running and connection can be established. Since the health of this service depends on the availability of the CARLA simulator, other services can depend on this services health to ensure a correct startup and shutdown order and thus preventing them from attempting to connect to the simulator before it is started or after it is stopped. **Note:** This only helps with startup and shutdown order. Your applications still need to have their own logic for handling connection fails during operation -### carla-simulator-offscreen -This Docker service is a variation of the previous carla-simulator service, with the exception that no GUI window is opened and thus one cannot directly follow what is happening on the map. +### carla-server-offscreen +This Docker service is a variation of the previous carla-server service, with the exception that no GUI window is opened and thus one cannot directly follow what is happening on the map. The upside to this is that this service is a bit lighter on the GPU and does not clutter up your screen as much. Especially useful when only interested in simulation without direct graphical output. diff --git a/utils/components.yml b/utils/carla-essentials/carla-services.yml similarity index 65% rename from utils/components.yml rename to utils/carla-essentials/carla-services.yml index 42e493d..d11a43c 100644 --- a/utils/components.yml +++ b/utils/carla-essentials/carla-services.yml @@ -1,32 +1,41 @@ services: - carla-simulator: + carla-server: extends: service: gpu-x11-service privileged: True image: rwthika/carla-simulator:server command: bash -ic './CarlaUE4.sh -nosound 2>/dev/null' - carla-simulator-offscreen: + carla-server-offscreen: extends: - service: carla-simulator + service: carla-server command: bash -ic './CarlaUE4.sh -nosound -RenderOffScreen 2>/dev/null' carla-client: extends: service: gpu-x11-service + depends_on: + carla-server: + condition: service_healthy image: rwthika/carla-simulator:client command: sleep infinity - carla-scenario-runner: + carla-ros-bridge: extends: - service: gpu-x11-service - image: rwthika/carla-scenario-runner + service: ros-x11-service + depends_on: + carla-server: + condition: service_healthy + image: rwthika/carla-ros-bridge - carla-ros-bridge: + carla-scenario-runner: extends: service: gpu-x11-service - image: rwthika/carla-ros-bridge + depends_on: + carla-server: + condition: service_healthy + image: rwthika/carla-scenario-runner ros-monitoring: extends: @@ -53,4 +62,19 @@ services: environment: DISPLAY: $DISPLAY volumes: - - /tmp/.X11-unix:/tmp/.X11-unix \ No newline at end of file + - /tmp/.X11-unix:/tmp/.X11-unix + + ros-service: + environment: + - DOCKER_UID + - DOCKER_GID + + ros-x11-service: + extends: + service: ros-service + environment: + DISPLAY: $DISPLAY + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix + + diff --git a/utils/tutorial/README.md b/utils/tutorial/README.md index acb3af8..238c58c 100644 --- a/utils/tutorial/README.md +++ b/utils/tutorial/README.md @@ -23,42 +23,36 @@ x-rviz-config-mount: &rviz-config-mount ./config.rviz:/config.rviz services: - # starts a CARLA simulator instance named 'carla-simulator' with a GUI window - carla-simulator: + # starts a CARLA server instance named 'carla-server' with a GUI window + carla-server: extends: - file: ../components.yml - service: carla-simulator + file: ../carla-essentials/carla-services.yml + service: carla-server # starts a client instance named 'carla-client' to connect with CARLA via PythonAPI carla-client: extends: - file: ../components.yml + file: ../carla-essentials/carla-services.yml service: carla-client - depends_on: - carla-simulator: - condition: service_healthy command: sleep infinity # starts the carla-ros-bridge carla-ros-bridge: extends: - file: ../components.yml + file: ../carla-essentials/carla-services.yml service: carla-ros-bridge - depends_on: - carla-simulator: - condition: service_healthy # ...and then execute them. Note the -ic flag for an interactive bash! # Without an interactive bash, many important env vars wouldn't be working or even set - command: bash -ic 'ros2 launch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch.py host:=carla-simulator' - # .. note that the host name is explictly set to the name of the carla-simulator Docker service! + command: bash -ic 'ros2 launch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch.py host:=carla-server' + # .. note that the host name is explictly set to the name of the carla-server Docker service! # starts rviz with a GUI window named 'ros-monitoring' ros-monitoring: extends: - file: ../components.yml + file: ../carla-essentials/carla-services.yml service: ros-monitoring depends_on: - carla-simulator: + carla-server: condition: service_healthy volumes: # you can mount custom rviz configs... @@ -92,8 +86,8 @@ In the first example, we are starting a CARLA serveralong with a Python API clie Then, you can launch the two containers using the `docker compose up` command: ```bash -# launch compose setup including carla-simulator and carla-client -docker compose up carla-simulator carla-client +# launch compose setup including carla-server and carla-client +docker compose up carla-server carla-client ``` This should bring up a CARLA server GUI running a map called [Town 10](https://carla.readthedocs.io/en/latest/map_town10/). You can look around by using WASD, holding the left or right mousebutton and moving the mouse in the desired direction. @@ -128,17 +122,17 @@ Now, use `docker-run` to directly attach to the running `carla-client` container docker-run --name tutorial-carla-client-1 ``` -Inside of the container, we can interact with the `carla-simulator` container: +Inside of the container, we can interact with the `carla-server` container: ```bash # changes weather settings dynamically -./examples/dynamic_weather.py --host carla-simulator +./examples/dynamic_weather.py --host carla-server ``` [

](../images/tutorial-dynamic-weather.png) This example script changes the weather settings of the CARLA server dynamically. It's a simple example for an interaction between the CARLA server and a Python client communicating over two separate Docker containers. The processes can be stopped using CTRL+C. -The running `carla-simulator` and `carla-client` containers can be stopped by terminating the Docker Compose setup with CTRL+C in the first terminal. In addition, remove the stopped containers with +The running `carla-server` and `carla-client` containers can be stopped by terminating the Docker Compose setup with CTRL+C in the first terminal. In addition, remove the stopped containers with ```bash # stops all specified services and removes their containers completely docker compose down diff --git a/utils/tutorial/docker-compose.yml b/utils/tutorial/docker-compose.yml index aae3819..6f9e19e 100644 --- a/utils/tutorial/docker-compose.yml +++ b/utils/tutorial/docker-compose.yml @@ -5,41 +5,35 @@ x-rviz-config-mount: &rviz-config-mount ./config.rviz:/config.rviz services: - # starts a CARLA simulator instance named 'carla-simulator' with a GUI window - carla-simulator: + # starts a CARLA simulator instance named 'carla-server' with a GUI window + carla-server: extends: - file: ../components.yml - service: carla-simulator + file: ../carla-essentials/carla-services.yml + service: carla-server carla-client: extends: - file: ../components.yml + file: ../carla-essentials/carla-services.yml service: carla-client - depends_on: - carla-simulator: - condition: service_healthy command: sleep infinity # starts the carla-ros-bridge carla-ros-bridge: extends: - file: ../components.yml + file: ../carla-essentials/carla-services.yml service: carla-ros-bridge - depends_on: - carla-simulator: - condition: service_healthy # ...and then execute them. Note the -ic flag for an interactive bash! # Without an interactive bash, many important env vars wouldn't be working or even set - command: bash -ic 'ros2 launch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch.py host:=carla-simulator' - # .. note that the host name is explictly set to the name of the carla-simulator Docker service! + command: bash -ic 'ros2 launch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch.py host:=carla-server' + # .. note that the host name is explictly set to the name of the carla-server Docker service! # starts rviz with a GUI window named 'ros-monitoring' ros-monitoring: extends: - file: ../components.yml + file: ../carla-essentials/carla-services.yml service: ros-monitoring depends_on: - carla-simulator: + carla-server: condition: service_healthy volumes: # you can mount custom rviz configs... From 7051784c563555a07e5fd296619d1d0ec80c3763 Mon Sep 17 00:00:00 2001 From: Christian Geller Date: Wed, 16 Apr 2025 11:15:56 +0200 Subject: [PATCH 2/8] fix renaming --- .../data-driven-development-demo-permutation-execution.yml | 2 +- .../config/data-driven-development-demo-scenario-execution.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data-driven-development/config/data-driven-development-demo-permutation-execution.yml b/data-driven-development/config/data-driven-development-demo-permutation-execution.yml index e2cf9e7..6abe4db 100644 --- a/data-driven-development/config/data-driven-development-demo-permutation-execution.yml +++ b/data-driven-development/config/data-driven-development-demo-permutation-execution.yml @@ -2,7 +2,7 @@ general_settings: max_simulation_time: 60 max_real_time: 300 simulation_services: - - carla-simulator + - carla-server - time-health-check - spawned-vehicle-check - carla-ros-bridge diff --git a/data-driven-development/config/data-driven-development-demo-scenario-execution.yml b/data-driven-development/config/data-driven-development-demo-scenario-execution.yml index 1cbf897..30bb4dd 100644 --- a/data-driven-development/config/data-driven-development-demo-scenario-execution.yml +++ b/data-driven-development/config/data-driven-development-demo-scenario-execution.yml @@ -2,7 +2,7 @@ general_settings: max_simulation_time: 60 max_real_time: 300 simulation_services: - - carla-simulator + - carla-server - time-health-check - spawned-vehicle-check - carla-ros-bridge From 25acf9b9ac8def7f676e815c58b9a9f6650caf2b Mon Sep 17 00:00:00 2001 From: Benedikt Haas <45701381+BenediktHaas96@users.noreply.github.com> Date: Wed, 16 Apr 2025 11:48:53 +0200 Subject: [PATCH 3/8] remove composefile-path input from required-scenarios job --- .github/workflows/automated-testing.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/automated-testing.yml b/.github/workflows/automated-testing.yml index d22da46..a0fc0a8 100644 --- a/.github/workflows/automated-testing.yml +++ b/.github/workflows/automated-testing.yml @@ -29,7 +29,6 @@ jobs: xhost +local: - uses: ika-rwth-aachen/carlos-ci-action@v0.1.1 with: - composefile-path: automated-testing/carla-sim.yml scenario-folder-path: ${{ matrix.filedir }} scenario-file-name: ${{ matrix.filename }} - shell: bash From 15bfea62b506016c990f050c46335c371184484d Mon Sep 17 00:00:00 2001 From: Benedikt Haas <45701381+BenediktHaas96@users.noreply.github.com> Date: Wed, 16 Apr 2025 11:58:10 +0200 Subject: [PATCH 4/8] use updated carlos-ci-action --- .github/workflows/automated-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/automated-testing.yml b/.github/workflows/automated-testing.yml index a0fc0a8..e3e8cda 100644 --- a/.github/workflows/automated-testing.yml +++ b/.github/workflows/automated-testing.yml @@ -27,7 +27,7 @@ jobs: - shell: bash run: | xhost +local: - - uses: ika-rwth-aachen/carlos-ci-action@v0.1.1 + - uses: ika-rwth-aachen/carlos-ci-action@v0.1.2 with: scenario-folder-path: ${{ matrix.filedir }} scenario-file-name: ${{ matrix.filename }} @@ -62,7 +62,7 @@ jobs: - shell: bash run: | xhost +local: - - uses: ika-rwth-aachen/carlos-ci-action@v0.1.1 + - uses: ika-rwth-aachen/carlos-ci-action@v0.1.2 continue-on-error: true with: scenario-folder-path: ${{ matrix.filedir }} From 2336e2382938815ac6310efdcc4e25ef1cb93604 Mon Sep 17 00:00:00 2001 From: Christian Geller Date: Wed, 16 Apr 2025 13:14:53 +0200 Subject: [PATCH 5/8] fix bugfix in evaluate-scenario.sh --- automated-testing/evaluate-scenarios.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automated-testing/evaluate-scenarios.sh b/automated-testing/evaluate-scenarios.sh index 6d84304..436cd4b 100755 --- a/automated-testing/evaluate-scenarios.sh +++ b/automated-testing/evaluate-scenarios.sh @@ -56,8 +56,8 @@ done shift $(($OPTIND-1)) # return to usual handling of positional args # default settings if no external overrides provided -export SIMULATOR_IMAGE=${SIMULATOR_IMAGE:-DEFAULT_SIMULATOR_IMAGE} -export SCENARIO_RUNNER_IMAGE=${SCENARIO_RUNNER_IMAGE:-DEFAULT_SCENARIO_RUNNER_IMAGE} +export SIMULATOR_IMAGE=${SIMULATOR_IMAGE:-$DEFAULT_SIMULATOR_IMAGE} +export SCENARIO_RUNNER_IMAGE=${SCENARIO_RUNNER_IMAGE:-$DEFAULT_SCENARIO_RUNNER_IMAGE} export COMPOSE_TEMPLATE_PATH=$(realpath ${1:-$COMPOSE_TEMPLATE_PATH}) export SCENARIO_FOLDER_PATH=$(realpath ${2:-"../utils/scenarios"}) From 5efe7b8ae97c7b2ed6d4aad771912ff518421466 Mon Sep 17 00:00:00 2001 From: Christian Geller Date: Wed, 16 Apr 2025 13:27:35 +0200 Subject: [PATCH 6/8] fix bug in volume mount --- data-driven-development/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-driven-development/docker-compose.yml b/data-driven-development/docker-compose.yml index 520a6e4..63b30c2 100644 --- a/data-driven-development/docker-compose.yml +++ b/data-driven-development/docker-compose.yml @@ -29,7 +29,7 @@ services: file: ../utils/carla-essentials/carla-services.yml service: carla-client volumes: - - ./src/time_controller.py:/opt/carla/PythonAPI/time_controller.py + - ./scripts/time_controller.py:/opt/carla/PythonAPI/time_controller.py command: bash -ic "python time_controller.py --host carla-server ${max_simulation_time} ${max_real_time}" spawned-vehicle-check: From 74983daf7e92c2b6a65f745b4d46a9653b829c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amarin=20Kl=C3=B6ker?= Date: Wed, 16 Apr 2025 15:51:06 +0200 Subject: [PATCH 7/8] Fix newlines at end of files --- .../data-driven-development-demo-permutation-execution.yml | 2 +- .../config/data-driven-development-demo-scenario-execution.yml | 2 +- utils/carla-essentials/carla-services.yml | 2 -- utils/tutorial/docker-compose.yml | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/data-driven-development/config/data-driven-development-demo-permutation-execution.yml b/data-driven-development/config/data-driven-development-demo-permutation-execution.yml index 6abe4db..058b2ed 100644 --- a/data-driven-development/config/data-driven-development-demo-permutation-execution.yml +++ b/data-driven-development/config/data-driven-development-demo-permutation-execution.yml @@ -34,4 +34,4 @@ run_settings: - "50" weather: - ClearSunset - - WetCloudyNoon \ No newline at end of file + - WetCloudyNoon diff --git a/data-driven-development/config/data-driven-development-demo-scenario-execution.yml b/data-driven-development/config/data-driven-development-demo-scenario-execution.yml index 30bb4dd..f8794ad 100644 --- a/data-driven-development/config/data-driven-development-demo-scenario-execution.yml +++ b/data-driven-development/config/data-driven-development-demo-scenario-execution.yml @@ -23,4 +23,4 @@ run_settings: - ../utils/scenarios/town01.xosc - ../utils/scenarios/town10.xosc sensors_file: - - ./config/sensors/rgb_segmentation_camera.json \ No newline at end of file + - ./config/sensors/rgb_segmentation_camera.json diff --git a/utils/carla-essentials/carla-services.yml b/utils/carla-essentials/carla-services.yml index d11a43c..be3e1ca 100644 --- a/utils/carla-essentials/carla-services.yml +++ b/utils/carla-essentials/carla-services.yml @@ -76,5 +76,3 @@ services: DISPLAY: $DISPLAY volumes: - /tmp/.X11-unix:/tmp/.X11-unix - - diff --git a/utils/tutorial/docker-compose.yml b/utils/tutorial/docker-compose.yml index 6f9e19e..5f81698 100644 --- a/utils/tutorial/docker-compose.yml +++ b/utils/tutorial/docker-compose.yml @@ -39,4 +39,4 @@ services: # you can mount custom rviz configs... - *rviz-config-mount # ...and then use them when starting up rviz with the -d flag - command: bash -ic 'rviz2 -d /config.rviz --ros-args -p use_sim_time:=true &> /dev/null' \ No newline at end of file + command: bash -ic 'rviz2 -d /config.rviz --ros-args -p use_sim_time:=true &> /dev/null' From f317878a7fd16d472cebcf0e6cd1a67c898384d1 Mon Sep 17 00:00:00 2001 From: Christian Geller Date: Wed, 16 Apr 2025 15:57:39 +0200 Subject: [PATCH 8/8] add depends_on for the time-health-check --- data-driven-development/docker-compose.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data-driven-development/docker-compose.yml b/data-driven-development/docker-compose.yml index 63b30c2..cdac09e 100644 --- a/data-driven-development/docker-compose.yml +++ b/data-driven-development/docker-compose.yml @@ -28,6 +28,9 @@ services: extends: file: ../utils/carla-essentials/carla-services.yml service: carla-client + depends_on: + spawned-vehicle-check: + condition: service_healthy volumes: - ./scripts/time_controller.py:/opt/carla/PythonAPI/time_controller.py command: bash -ic "python time_controller.py --host carla-server ${max_simulation_time} ${max_real_time}"