fwt_software/scripts/run.sh

24 lines
932 B
Bash
Executable File

#!/usr/bin/env bash
# Launch fire_gimbal_control, resolving the binary relative to this script so it
# works regardless of where the repo is checked out. Extra args are forwarded.
#
# scripts/run.sh --init --start # homes first
# scripts/run.sh --mock-serial --mock-camera --no-mqtt --start # dev, no hardware
#
# --init homes the gimbal. The firmware keeps nothing across a power cycle, so
# without it the axes stay in RESET and refuse every move.
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
bin=""
for cand in "$here/../build/fire_gimbal_control" "$here/fire_gimbal_control" \
"$here/../fire_gimbal_control"; do
if [[ -x "$cand" ]]; then bin="$cand"; break; fi
done
if [[ -z "$bin" ]]; then
echo "fire_gimbal_control binary not found. Build it first:" >&2
echo " cmake -B build && cmake --build build" >&2
exit 1
fi
exec "$bin" "$@"