#!/usr/bin/env bash

# this script requires a single argument of a scenario file path, runs simple_sim,
# outputs the resulting chum uri to stdout

DRIVING_ROOT=$(eval "git rev-parse --show-toplevel")
source $DRIVING_ROOT/scripts/shell/zooxrc.sh

SCENARIO_NAME=$1
CHUM_ROOT=$2
VARIANT=$3
EXTRA_SIM_ARGS=$4
BAZEL_TARGET="//sim/scenario_editor/web/backend/scenarios:$SCENARIO_NAME"

# run sim
cmd="$DRIVING_ROOT/sim/launch.sh local planner $BAZEL_TARGET \
--output_chum_root=$CHUM_ROOT --output_chum_variant=$VARIANT $EXTRA_SIM_ARGS"
eval $cmd
