ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What you are describing is called "running a child process". The most common way to do this is to use the system() or popen() calls. Google for how to use these.

However, you need to careful when using system() call in ros because the call blocks execution of your node until the child process exits. This means you get really bad performance if you call it directly from a subscribe callback. What you need to do instead is: inside the subscribe callback you launch a new thread, then call system() from inside the thread.

What you are describing is called "running a child process". The most common way to do this in c++ is to use the system() or popen() calls. Google for how to use these.

However, you need to careful when using system() call in ros because the call blocks execution of your node until the child process exits. This means you get really bad performance if you call it directly from a subscribe callback. What you need to do instead is: inside the subscribe callback you launch a new thread, then call system() from inside the thread.