Created
August 1, 2017 00:17
-
-
Save thomasweng15/db12693f957ecafb6eed3bb011db37a3 to your computer and use it in GitHub Desktop.
rebuild and relaunch scripts for C++ ROS projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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