diff --git a/auto_start/auto_start_anchor.sh b/auto_start/auto_start_anchor.sh index fa89ae9..12419bd 100755 --- a/auto_start/auto_start_anchor.sh +++ b/auto_start/auto_start_anchor.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) diff --git a/auto_start/auto_start_core_headless.sh b/auto_start/auto_start_core_headless.sh deleted file mode 100755 index 8e787b8..0000000 --- a/auto_start/auto_start_core_headless.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -# 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..." - sleep 1 -done - -echo "[INFO] Network interface is up!" - -# Your actual ROS node start command goes here -echo "[INFO] Starting ROS node..." - -# Source ROS 2 Humble setup script -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/ - -# Launch the ROS 2 node -ros2 run core_pkg headless diff --git a/auto_start/auto_start_headless_full.sh b/auto_start/auto_start_headless_full.sh index 2d65482..8a014e1 100755 --- a/auto_start/auto_start_headless_full.sh +++ b/auto_start/auto_start_headless_full.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) diff --git a/auto_start/start_rosbag.sh b/auto_start/start_rosbag.sh index 98131eb..dcc07d7 100755 --- a/auto_start/start_rosbag.sh +++ b/auto_start/start_rosbag.sh @@ -1,10 +1,12 @@ #!/usr/bin/env bash +set -e SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -ANCHOR_WS="$SCRIPT_DIR/.." -AUTONOMY_WS="$ANCHOR_WS/../rover-Autonomy" -BAG_LOCATION="$ANCHOR_WS/../bags/autostart" +[[ -z "$ANCHOR_WS" ]] && ANCHOR_WS="$SCRIPT_DIR/.." +[[ -z "$AUTONOMY_WS" ]] && AUTONOMY_WS="$HOME/rover-Autonomy" +BAG_LOCATION="$HOME/bags/autostart" +[[ ! -d "$BAG_LOCATION" ]] && mkdir -p "$BAG_LOCATION" # Wait for a network interface to be up (not necessarily online) while ! ip link show | grep -q "state UP"; do @@ -17,7 +19,7 @@ echo "[INFO] Network interface is up!" source /opt/ros/humble/setup.bash source $ANCHOR_WS/install/setup.bash -[ -f $AUTONOMY_WS/install/setup.bash ] && source $AUTONOMY_WS/install/setup.bash +[[ -f $AUTONOMY_WS/install/setup.bash ]] && source $AUTONOMY_WS/install/setup.bash cd $BAG_LOCATION