Difference between revisions of "ROS Hood Teleop Script"
From wikidb
(→Script) |
|||
Line 60: | Line 60: | ||
== Notes == | == Notes == | ||
+ | * Replace scripts with launch files??? See reference below. TBD | ||
+ | * The teleop.launch file is not in the correct location. | ||
* "motor_control_hc" is too long for a pgrep pattern. Didn't see that coming. | * "motor_control_hc" is too long for a pgrep pattern. Didn't see that coming. | ||
* A kill -9 (SIGKILL) will not dump output buffers. SIGINT (interrupt form keyboard) will. | * A kill -9 (SIGKILL) will not dump output buffers. SIGINT (interrupt form keyboard) will. | ||
Line 68: | Line 70: | ||
== References == | == References == | ||
− | * [http://wiki.ros.org/ROS/Tutorials/Roslaunch%20tips%20for%20larger%20projects ROS Launch] | + | * [http://wiki.ros.org/ROS/Tutorials/Roslaunch%20tips%20for%20larger%20projects ROS Launch] |
* [http://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file Redirect Output to File] | * [http://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file Redirect Output to File] | ||
* [http://stackoverflow.com/questions/160924/how-can-i-kill-a-process-by-name-instead-of-pid Kill Process by Name (pattern)] | * [http://stackoverflow.com/questions/160924/how-can-i-kill-a-process-by-name-instead-of-pid Kill Process by Name (pattern)] | ||
* [http://manpages.ubuntu.com/manpages/hardy/man7/signal.7.html Ubuntu Signals] | * [http://manpages.ubuntu.com/manpages/hardy/man7/signal.7.html Ubuntu Signals] |
Latest revision as of 14:24, 30 December 2015
Master Script
Runs on hood.
#!/bin/bash DATE=$(date '+%Y%m%dT%H%M') LOGDIR=~/log case "$1" in start) echo START roscore > $LOGDIR/roscore$DATE.log & sleep 5 pgrep -a roscore rosrun phidgets motor_control_hc > $LOGDIR/motors$DATE.log & sleep 5 pgrep -a motor_control ;; stop) echo STOP killall -SIGINT motor_control_hc killall -SIGINT roscore killall -SIGINT rosmaster ;; esac echo DONE
Client Script
Runs on Adams
#!/bin/bash DATE=$(date '+%Y%m%dT%H%M') LOGDIR=~/log case "$1" in start) echo START roslaunch ~/catkin_ws/launch/teleop.launch > $LOGDIR/teleop$DATE.log & sleep 5 pgrep -a joy pgrep -a teleop ;; stop) echo STOP killall -SIGINT teleop_node killall -SIGINT joy_node ;; esac echo DONE
Notes
- Replace scripts with launch files??? See reference below. TBD
- The teleop.launch file is not in the correct location.
- "motor_control_hc" is too long for a pgrep pattern. Didn't see that coming.
- A kill -9 (SIGKILL) will not dump output buffers. SIGINT (interrupt form keyboard) will.
- Open - flush output as it is generated.
- Sleeps are required to ensure that the new process initialized before steps that depend on it are executed.
- Logging standard out may not be help. See ~/.ros/log/latest.