Last active
June 16, 2021 19:24
-
-
Save xaxxontech/b70e8f18e4570a07724eca9f9f6f0307 to your computer and use it in GitHub Desktop.
Launching ROS1 commands from Java
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/bash | |
#setup ROS1 environment and execute params as single quoted string | |
# loads ROS environment | |
source $HOME/stuff/cartographer_catkin_ws/install_isolated/setup.bash | |
source $HOME/catkin_ws/devel/setup.bash --extend | |
rosclean purge -y | |
if ! rostopic list | |
then | |
roscore & | |
sleep 5 | |
fi | |
date >> logs/ros.log | |
if [ -z "$@" ]; then | |
exit 1 | |
fi | |
echo $@ >> logs/ros.log | |
stdbuf -o0 $@ >> logs/ros.log 2>&1 & | |
#print PID of last command | |
echo PID: $! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment