fix: make autostart script SCRIPT_DIR more robust

This commit is contained in:
ASTRA-SHC
2025-10-26 12:20:16 +00:00
parent 18a7b7e2ab
commit 9516e53f68
3 changed files with 9 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Wait for a network interface to be up (not necessarily online)
while ! ip link show | grep -q "state UP"; do
echo "[INFO] Waiting for active network interface..."
@@ -15,7 +17,7 @@ echo "[INFO] Starting ROS node..."
source /opt/ros/humble/setup.bash
# Source your workspace setup script
source $(dirname $0)/../install/setup.bash
source $SCRIPT_DIR/../install/setup.bash
# Launch the ROS 2 node with the desired mode
ros2 launch anchor_pkg rover.launch.py mode:=anchor