feat: start rosbag on boot

This commit is contained in:
David
2025-09-11 15:56:20 -05:00
parent 9370b91c7e
commit 64405e3a0b
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#!/bin/bash
ANCHOR_WS="/home/clucky/rover-ros2"
AUTONOMY_WS="/home/clucky/rover-Autonomy"
BAG_LOCATION="/home/clucky/bags/autostart"
# 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!"
source /opt/ros/humble/setup.bash
source $ANCHOR_WS/install/setup.bash
[ -f $AUTONOMY_WS/install/setup.bash ] && source $AUTONOMY_WS/install/setup.bash
cd $BAG_LOCATION
ros2 bag record -a

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Record a rosbag on boot to /home/clucky/bags/
After=systemd-user-sessions.service
Requires=systemd-user-sessions.service
[Service]
ExecStart=/home/clucky/rover-ros2/auto_start/start_rosbag.sh
Restart=always
RestartSec=5
User=clucky
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=multi-user.target