Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
rebuild and relaunch scripts for C++ ROS projects
#!/bin/sh
WATCH_DIRS=(~/catkin_ws/src/ros-project/src/perception/src ~/catkin_ws/src/ros-project/src/perception/include/perception)
inotifywait -m ${WATCH_DIRS[@]} -e close_write |
while read path action file; do
if [[ "$file" =~ .*cpp$ ]] || [[ "$file" =~ .*h$ ]]; then
echo "$file modified, rebuilding..."
if catkin --force-color build | grep "succeeded!"; then
rosnode kill process_cloud_main
fi
fi
done
#!/bin/sh
PID=""
function get_pid {
PID=`pidof process_cloud_main`
}
function start {
get_pid
if [ -z $PID ]; then
echo "Launching roslaunch"
roslaunch perception perception.launch &
get_pid
fi
}
while true; do
get_pid
if [ -z $PID ]; then
start
fi
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.