#!/bin/bash

USAGE="re_mofo_uri <chum_uri> <output_path>"

if [ $# -lt 2 ]; then
  echo "$USAGE"
fi

remofoname=re-mofo-"$1"

echo "Running chum_uri_to_datasets ... "
bazel-run.sh //mapping/distributed_mapping/scripts:chum_uri_to_datasets -- --chum_uri "$1" --datasets_out "$2"/"$1".pb

echo "Running batch_estimator ... "
bazel-run.sh //localization/pose_estimation/sliding_window_filter/tools:batch_estimator -- --chum_uri "$1" --datasets_out "$2"/"$remofoname".pb --config ~/driving/vehicle/localization/pose_estimation/params/pose_estimation_common_offline.pbtxt

echo "Producing output kml ... "
bazel-run.sh //mapping/scripts:generate_kml -- --input "$2"/"$remofoname".pb --output "$2"/"$remofoname".kml
