forked from ika-rwth-aachen/carlos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Benedikt Haas
committed
Feb 5, 2024
1 parent
499eead
commit 000f3c2
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
usage() { | ||
echo "Usage: $0 [-d maxdepth] [-e exclude-path] STARTING-POINT QUERY-STRING" | ||
echo "STARTING-POINT : Location from where search should start" | ||
echo "QUERY-STRING : UNIX pattern used for matching and selecting results. Needs to be \"quoted\"" | ||
echo "max-depth : Descend at most max-depth levels from STARTING-POINT" | ||
echo "exclude-string : Exclude paths matching this UNIX pattern from final result. Needs to be \"quoted\"" | ||
echo "-----" | ||
echo "Example: $0 -d 3 . \"*.xosc\"" | ||
} | ||
|
||
trap cleanup EXIT | ||
trap cleanup 0 | ||
|
||
cleanup() { | ||
echo "Cleaning up..." | ||
docker compose -f $COMPOSE_TEMPLATE_PATH kill | ||
docker compose -f $COMPOSE_TEMPLATE_PATH down | ||
xhost -local: | ||
echo "Done cleaning up." | ||
} | ||
|
||
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 | ||
} | ||
|
||
export SCENARIO_DIRECTORY="${1:-"../utils/scenarios"}" | ||
export COMPOSE_TEMPLATE_PATH="${2:-"./template.yml"}" | ||
echo $SCENARIO_DIRECTORY | ||
|
||
scenarios=($(find $SCENARIO_DIRECTORY -maxdepth 1 -type f -name "*.xosc*" -exec basename {} \;)) | ||
|
||
if [ ${#scenarios[@]} -eq 0 ]; then | ||
echo "No scenarios found. Exiting..." | ||
exit 1 | ||
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 | ||
docker compose -f $COMPOSE_TEMPLATE_PATH run --rm carla-scenario-runner || true | ||
|
||
if [ "$RESTART_SIMULATOR" = true ]; then | ||
restart-simulator | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
services: | ||
|
||
carla-simulator: | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
count: 1 | ||
capabilities: [gpu] | ||
environment: | ||
DISPLAY: $DISPLAY | ||
XAUTHORITY: /.Xauthority | ||
volumes: | ||
- /tmp/.X11-unix:/tmp/.X11-unix | ||
- $XAUTHORITY:/.Xauthority:ro | ||
privileged: True | ||
image: carla-health # TODO: Change to 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" |