#!/bin/sh

set +x
set -e

echo "Your Zoox workspace: ${ZOOX_WORKSPACE_ROOT}"

bazel_run //vehicle/ai_monitor/fault_handler:ai_monitor_fault_handler_node -- "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/fault_handler/component_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/fault_handler/transport_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/fault_handler/monitored_component_params.pbtxt" &

bazel_run //vehicle/ai_monitor/heartbeat:ai_monitor_heartbeat_node -- "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/heartbeat/component_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/heartbeat/transport_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/heartbeat/monitored_topic_params.pbtxt" &

bazel_run //vehicle/ai_monitor/trajectory_manager:ai_monitor_trajectory_manager_node -- "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/trajectory_manager/component_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/trajectory_manager/transport_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/trajectory_manager/monitored_request_params.pbtxt" &

bazel_run //vehicle/ai_monitor/trajectory_relay:ai_monitor_trajectory_relay_node -- "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/trajectory_relay/component_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/trajectory_relay/transport_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/trajectory_relay/monitored_request_params.pbtxt" &

bazel_run //vehicle/ai_monitor/master:ai_monitor_master_node -- "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/master/component_params.pbtxt" "${ZOOX_WORKSPACE_ROOT}/vehicle/ai_monitor/master/transport_params.pbtxt" &

echo "... done!"
