From 32f10b1c89d6847973576fcb1427c2de42c25c7e Mon Sep 17 00:00:00 2001 From: Zhengyi Jiang Date: Wed, 8 Nov 2023 21:03:24 +0000 Subject: [PATCH] added inifite loop so ros gets restarted after exit --- autostart/scripts/launch/launch_auxiliary.sh | 8 ++++++-- autostart/scripts/launch/launch_camera.sh | 8 ++++++-- autostart/scripts/launch/launch_reach.sh | 8 ++++++-- autostart/scripts/launch/launch_slam.sh | 8 ++++++-- autostart/scripts/launch/launch_unitree_base.sh | 8 ++++++-- autostart/scripts/launch_roscore.sh | 9 +++++++-- 6 files changed, 37 insertions(+), 12 deletions(-) diff --git a/autostart/scripts/launch/launch_auxiliary.sh b/autostart/scripts/launch/launch_auxiliary.sh index e77016d..c542c04 100755 --- a/autostart/scripts/launch/launch_auxiliary.sh +++ b/autostart/scripts/launch/launch_auxiliary.sh @@ -6,6 +6,10 @@ log() { } log "Launching unitree_auxiliary..." -roslaunch ice9_unitree unitree_auxiliary.launch -log "Error! unitree_auxiliary exited." +while true; do + roslaunch ice9_unitree unitree_auxiliary.launch + log "Error! unitree_auxiliary exited." + log "Restarting unitree_auxiliary..." + sleep 1 +done log "Ended." diff --git a/autostart/scripts/launch/launch_camera.sh b/autostart/scripts/launch/launch_camera.sh index 651ea8c..e97c593 100755 --- a/autostart/scripts/launch/launch_camera.sh +++ b/autostart/scripts/launch/launch_camera.sh @@ -19,6 +19,10 @@ else fi log "Launching mjpeg_cam..." -roslaunch ice9_unitree mjpeg_cam.launch device_name:=/dev/video1 -log "Error! mjpeg_cam exited." +while true; do + roslaunch ice9_unitree mjpeg_cam.launch device_name:=/dev/video1 + log "Error! mjpeg_cam exited." + log "Restarting mjpeg_cam..." + sleep 1 +done log "Ended." diff --git a/autostart/scripts/launch/launch_reach.sh b/autostart/scripts/launch/launch_reach.sh index 5fcbcfe..4e49726 100755 --- a/autostart/scripts/launch/launch_reach.sh +++ b/autostart/scripts/launch/launch_reach.sh @@ -6,6 +6,10 @@ log() { } log "Launching reach_ros..." -roslaunch ice9_unitree reach_ros.launch -log "Error! reach_ros exited." +while true; do + roslaunch ice9_unitree reach_ros.launch + log "Error! reach_ros exited." + log "Restarting reach_ros..." + sleep 1 +done log "Ended." diff --git a/autostart/scripts/launch/launch_slam.sh b/autostart/scripts/launch/launch_slam.sh index 5da9071..2132e31 100755 --- a/autostart/scripts/launch/launch_slam.sh +++ b/autostart/scripts/launch/launch_slam.sh @@ -5,6 +5,10 @@ log() { echo $1 } log "Launching slam_planner_online..." -roslaunch slam_planner slam_planner_online.launch -log "Error! slam_planner_online exited." +while true; do + roslaunch slam_planner slam_planner_online.launch + log "Error! slam_planner_online exited." + log "Restarting slam_planner_online..." + sleep 1 +done log "Ended." diff --git a/autostart/scripts/launch/launch_unitree_base.sh b/autostart/scripts/launch/launch_unitree_base.sh index 86a3977..45c1bc7 100755 --- a/autostart/scripts/launch/launch_unitree_base.sh +++ b/autostart/scripts/launch/launch_unitree_base.sh @@ -6,6 +6,10 @@ log() { } log "Launching unitree_legged_real..." -roslaunch unitree_legged_real real.launch -log "Error! unitree_legged_real exited." +while true; do + roslaunch unitree_legged_real real.launch + log "Error! unitree_legged_real exited." + log "Restarting unitree_legged_real..." + sleep 1 +done log "Ended." diff --git a/autostart/scripts/launch_roscore.sh b/autostart/scripts/launch_roscore.sh index 0fa19db..88367df 100755 --- a/autostart/scripts/launch_roscore.sh +++ b/autostart/scripts/launch_roscore.sh @@ -15,9 +15,14 @@ if [ ${is_nano_15} ]; then done log "Husarnet ready, starting roscore..." sleep 1 + source ${HOME}/Unitree_GPS_Integration/autostart/scripts/ros_setup.bash - roscore - log "Error! roscore exited." + while true; do + roscore + log "Error! roscore exited." + log "Restarting roscore..." + sleep 1 + done else log "Not Nano 15, skipped." fi