Skip to content

Commit

Permalink
update automated-testing demo
Browse files Browse the repository at this point in the history
  • Loading branch information
cgeller committed Feb 6, 2024
1 parent ac076da commit 3f146ab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 40 deletions.
20 changes: 14 additions & 6 deletions automated-testing/evaluate-scenarios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 0 additions & 26 deletions automated-testing/template.yml

This file was deleted.

16 changes: 8 additions & 8 deletions utils/scenarios/town10.xosc.opt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="5" laneId="-1" s="1" offset="0"/>
<LanePosition roadId="5" laneId="-1" s="5" offset="0"/>
</Position>
</TeleportAction>
</PrivateAction>
Expand All @@ -86,7 +86,7 @@
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="5" laneId="-2" s="15" offset="0"/>
<LanePosition roadId="5" laneId="-2" s="12" offset="0"/>
</Position>
</TeleportAction>
</PrivateAction>
Expand All @@ -96,7 +96,7 @@
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="5" laneId="-1" s="25" offset="0"/>
<LanePosition roadId="5" laneId="-1" s="30" offset="0"/>
</Position>
</TeleportAction>
</PrivateAction>
Expand All @@ -106,7 +106,7 @@
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="5" laneId="1" s="50" offset="0"/>
<LanePosition roadId="5" laneId="1" s="60" offset="0"/>
</Position>
</TeleportAction>
</PrivateAction>
Expand All @@ -116,7 +116,7 @@
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="5" laneId="2" s="70" offset="0"/>
<LanePosition roadId="5" laneId="2" s="75" offset="0"/>
</Position>
</TeleportAction>
</PrivateAction>
Expand All @@ -136,7 +136,7 @@
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="18" laneId="4" s="5" offset="0"/>
<LanePosition roadId="18" laneId="4" s="10" offset="0"/>
</Position>
</TeleportAction>
</PrivateAction>
Expand All @@ -146,7 +146,7 @@
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="18" laneId="5" s="5" offset="0"/>
<LanePosition roadId="18" laneId="5" s="10" offset="0"/>
</Position>
</TeleportAction>
</PrivateAction>
Expand All @@ -166,7 +166,7 @@
<PrivateAction>
<TeleportAction>
<Position>
<LanePosition roadId="6" laneId="2" s="8" offset="0"/>
<LanePosition roadId="6" laneId="2" s="15" offset="0"/>
</Position>
</TeleportAction>
</PrivateAction>
Expand Down

0 comments on commit 3f146ab

Please sign in to comment.