Files

23 lines
775 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "${ROOT_DIR}/scripts/go2_env.sh" nav
if [[ -f "${ROOT_DIR}/install/setup.bash" ]]; then
_restore_nounset=0
case "$-" in
*u*) _restore_nounset=1; set +u ;;
esac
# colcon-generated setup files may read optional vars such as COLCON_TRACE.
source "${ROOT_DIR}/install/setup.bash"
if [[ "${_restore_nounset}" == "1" ]]; then
set -u
fi
unset _restore_nounset
fi
services="$(ros2 service list)"
if ! grep -Fxq /go2_patrol/start <<<"${services}"; then
echo '[go2_run_patrol] ERROR: /go2_patrol/start is not available. Start scripts/go2_start_patrol_executor.sh first.' >&2
exit 1
fi
exec ros2 service call /go2_patrol/start std_srvs/srv/Trigger '{}'