mirror of
https://github.com/SHC-ASTRA/rover-ros2.git
synced 2026-02-11 09:20:40 +00:00
feat: start rosbag on boot
This commit is contained in:
22
auto_start/start_rosbag.sh
Normal file
22
auto_start/start_rosbag.sh
Normal 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
|
||||||
14
systemd/astra_rosbag.service
Normal file
14
systemd/astra_rosbag.service
Normal 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
|
||||||
Reference in New Issue
Block a user