From e351e4c991195b11c25769899aa0bb6cc57b64a1 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 26 Oct 2025 06:54:05 -0500 Subject: [PATCH] fix: make auto start scripts work when not in specific dir --- auto_start/auto_start_anchor.sh | 5 +---- auto_start/auto_start_headless_full.sh | 5 +---- auto_start/start_rosbag.sh | 6 +++--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/auto_start/auto_start_anchor.sh b/auto_start/auto_start_anchor.sh index 71cc2e1..f4dc31d 100755 --- a/auto_start/auto_start_anchor.sh +++ b/auto_start/auto_start_anchor.sh @@ -15,10 +15,7 @@ echo "[INFO] Starting ROS node..." source /opt/ros/humble/setup.bash # Source your workspace setup script -source /home/clucky/rover-ros2/install/setup.bash - -# CD to directory -cd /home/clucky/rover-ros2/ +source $(dirname $0)/../install/setup.bash # Launch the ROS 2 node with the desired mode ros2 launch anchor_pkg rover.launch.py mode:=anchor diff --git a/auto_start/auto_start_headless_full.sh b/auto_start/auto_start_headless_full.sh index 870a646..68c9a5f 100755 --- a/auto_start/auto_start_headless_full.sh +++ b/auto_start/auto_start_headless_full.sh @@ -15,10 +15,7 @@ echo "[INFO] Starting ROS node..." source /opt/ros/humble/setup.bash # Source your workspace setup script -source /home/clucky/rover-ros2/install/setup.bash - -# CD to directory -cd /home/clucky/rover-ros2/ +source $(dirname $0)/../install/setup.bash # Launch the ROS 2 node ros2 run headless_pkg headless_full diff --git a/auto_start/start_rosbag.sh b/auto_start/start_rosbag.sh index 786a153..3732bfe 100755 --- a/auto_start/start_rosbag.sh +++ b/auto_start/start_rosbag.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -ANCHOR_WS="/home/clucky/rover-ros2" -AUTONOMY_WS="/home/clucky/rover-Autonomy" -BAG_LOCATION="/home/clucky/bags/autostart" +ANCHOR_WS="$(dirname $0)/.." +AUTONOMY_WS="$ANCHOR_WS/../rover-Autonomy" +BAG_LOCATION="$ANCHOR_WS/../bags/autostart" # Wait for a network interface to be up (not necessarily online) while ! ip link show | grep -q "state UP"; do