#!/bin/bash

set -euo pipefail

unset ROS_PACKAGE_PATH
unset PYTHONPATH

scenario="$@"

if [[ -z "$scenario" ]]; then
  IFS=$'\n' options=( $(sim/sim_tests/on_vehicle sim/sim_tests/on_vehicle.spk "echo {filters}" 2>/dev/null) )
  scenario=$(zenity \
      --title="Scenario" \
      --list "${options[@]}" \
      --column="" \
      --width=600 \
      --height=400 \
      --text="Choose a scenario file")
  scenario=$(echo "$scenario" | awk -F\| '{print $1}')
fi

sim/sim_tests/on_vehicle sim/sim_tests/on_vehicle.spk "sim/simple_sim/play_on_vehicle_private" $scenario
