Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • the openni2_launch should be started on the local ROS master (otherwise it may crash due to network issues)
  • the detection & control nodes should be started on the Baxter's ROS master

Starting Multiple Processes

The main script looks as follows: demo.sh. The script creates 2 background processes (one for each ROS master):

  • roslaunch openni2_launch openni2.launch&
    • The & at the end specifies that the command is run as a background process (the main process continues, it does not wait for the command to complete).
  • ${SHELL} demo_baxter.sh&
    • The demo_baxter.sh script is a modified version of baxter.sh (from the Baxter SDK). The original (baxter.sh) script prepares the environment for running nodes on the Baxter ROS system. The modified script does the same preparation, and then starts the detection & control nodes (roslaunch baxter_smach demo.launch).

Termination

In order to be able to stop & restart the demo, the script waits until a kill signal is received (CTRL+C). When the kill signal appears, it kills the background processes. The kill signal handler is set using the command: "trap terminate SIGINT SIGTERM" (when a SIGINT or SIGTERM signal occurs, call the terminate procedure). In order to kill a background process, we need to know its process id. So, after starting each background process, we saved its process id using the "$!" command.