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

How to run a node as a background process?

asked 2016-06-06 13:43:55 -0600

icepaka89 gravatar image

So I am trying to write a program in which a main publisher node will use the system function to run multiple subscriber nodes. I would like to use something like: "rosrun <pkg_name> <node_name> &", however this doesn't work for me and the subscriber node still runs in the same terminal window. How can I change the command so that it executes in the way i described? I can't seem to figure it out. Thanks!!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-06 15:19:57 -0600

ahendrix gravatar image

Does the system() call block when it executes? If not, then the command is running in the background.

Keep in mind that "background" does not imply spawning a different terminal window or logging to disk by default. The process will use the same terminal as its parent.

edit flag offensive delete link more


No, even when I put the statement in a system call, the output from the node still appears in the terminal window and I cannot run other nodes

icepaka89 gravatar image icepaka89  ( 2016-06-06 16:52:52 -0600 )edit

What do you mean by "cannot run other nodes" ? Does a second system() command fail? Does it stop the other node that's already running? Do you expect to be able to run other nodes in the same terminal?

ahendrix gravatar image ahendrix  ( 2016-06-06 17:34:21 -0600 )edit

Question Tools


Asked: 2016-06-06 13:43:55 -0600

Seen: 2,637 times

Last updated: Jun 06 '16