diff --git a/automated-testing/evaluate-scenarios.sh b/automated-testing/evaluate-scenarios.sh index fba73e1..791eae3 100755 --- a/automated-testing/evaluate-scenarios.sh +++ b/automated-testing/evaluate-scenarios.sh @@ -30,24 +30,32 @@ restart-simulator() { docker compose -f $COMPOSE_TEMPLATE_PATH up -d carla-simulator } -export SCENARIO_DIRECTORY="${1:-"../utils/scenarios"}" -export COMPOSE_TEMPLATE_PATH="${2:-"./template.yml"}" -echo $SCENARIO_DIRECTORY +export SIMULATOR_IMAGE=rwthika/carla-simulator:server +export SCENARIO_RUNNER_IMAGE=rwthika/carla-scenario-runner:latest -scenarios=($(find $SCENARIO_DIRECTORY -maxdepth 1 -type f -name "*.xosc*" -exec basename {} \;)) +export SCENARIO_FOLDER_PATH=$(realpath ${1:-"../utils/scenarios"}) +export COMPOSE_TEMPLATE_PATH="${2:-"../.github/actions/evaluate-scenario/files/template.yml"}" + +echo "Searching for scenarios in $SCENARIO_FOLDER_PATH ..." +scenarios=($(find $SCENARIO_FOLDER_PATH -maxdepth 1 -type f -name "*.xosc*" -exec basename {} \;)) if [ ${#scenarios[@]} -eq 0 ]; then echo "No scenarios found. Exiting..." exit 1 fi + +if [ "$SIMULATOR_OFFSCREEN" = true ]; then + export SIMULATOR_FLAGS="-RenderOffScreen" +fi + xhost +local: echo "Starting simulator..." docker compose -f $COMPOSE_TEMPLATE_PATH up -d carla-simulator for scenario in "${scenarios[@]}"; do echo "Evaluating $scenario ..." - - export SCENARIO_NAME=$scenario + export SCENARIO_FILE_NAME=$scenario + docker compose -f $COMPOSE_TEMPLATE_PATH run --rm carla-scenario-runner || true if [ "$RESTART_SIMULATOR" = true ]; then diff --git a/automated-testing/template.yml b/automated-testing/template.yml deleted file mode 100644 index 7e1c798..0000000 --- a/automated-testing/template.yml +++ /dev/null @@ -1,26 +0,0 @@ -services: - - carla-simulator: - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - environment: - DISPLAY: $DISPLAY - volumes: - - /tmp/.X11-unix:/tmp/.X11-unix - privileged: True - image: rwthika/carla-simulator:server - command: bash -ic './CarlaUE4.sh -nosound $SIMULATOR_FLAGS 2>/dev/null' - - carla-scenario-runner: - depends_on: - carla-simulator: - condition: service_healthy - volumes: - - $SCENARIO_DIRECTORY:/scenarios - image: rwthika/carla-scenario-runner:latest - command: bash -ic "python ./scenario_runner.py --host carla-simulator --openscenario /scenarios/$SCENARIO_NAME --output" diff --git a/utils/scenarios/town10.xosc.opt b/utils/scenarios/town10.xosc.opt index fbae4c0..7780cf4 100644 --- a/utils/scenarios/town10.xosc.opt +++ b/utils/scenarios/town10.xosc.opt @@ -76,7 +76,7 @@ - + @@ -86,7 +86,7 @@ - + @@ -96,7 +96,7 @@ - + @@ -106,7 +106,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -146,7 +146,7 @@ - + @@ -166,7 +166,7 @@ - +