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

Revision history [back]

There is no right way to start and stop nodes dynamically. If you're writing the nodes yourself, it's much better to include pause/resume functionality via services.

As @Ricky stated, you can use the system call, however system will block until the command finishes, meaning you have to use the & operator to spin off a new process. Then you have the issue of trying to track down the PID in order to shutdown when necessary.

I would recommend using Qt's QProcess, which will make it easier to manage the state of the process (destructing the object will kill the roslaunch process, thus shutting down the nodes).

There is no right way to start and stop nodes dynamically. If you're writing the nodes yourself, it's much better to include pause/resume functionality via services.

As @Ricky stated, you can use the system call, however system will block until the command finishes, meaning you have to use the & operator to spin off a new process. Then you have the issue of trying to track down the PID in order to shutdown when necessary.

I would recommend using Qt's QProcess, which will make it easier to manage the state of the process (destructing the object will kill the roslaunch process, thus shutting down the nodes).


Poco also has nice looking Process management, if you want to avoid messing with Qt. ROS's class_loader CMakeLists is an example of how to include Poco in your package.

There AFAIK there is no right way to start and stop nodes dynamically. If you're writing the nodes yourself, it's much better to include pause/resume functionality via services.

As @Ricky stated, you can use the system call, however system will block until the command finishes, meaning you have to use the & operator to spin off a new process. Then you have the issue of trying to track down the PID in order to shutdown when necessary.

I would recommend using Qt's QProcess, which will make it easier to manage the state of the process (destructing the object will kill the roslaunch process, thus shutting down the nodes).


Poco also has nice looking Process management, if you want to avoid messing with Qt. ROS's class_loader CMakeLists is an example of how to include Poco in your package.

AFAIK there is no right way to start and stop nodes dynamically. If you're writing the nodes yourself, it's much better to include pause/resume functionality via services.

As @Ricky stated, you can use the system call, however system will block until the command finishes, meaning you have to use the & control operator in the command to spin off a new process. Then you have the issue of trying to track down down/parse the PID in order to shutdown when necessary.

I would recommend using Qt's QProcess, which will make it easier to manage the state of the process (destructing the object will kill the roslaunch process, thus shutting down the nodes).


---- EDIT Poco also has nice looking Process management, if you want to avoid messing with Qt. ROS's class_loader CMakeLists is an example of how to include Poco in your package.

AFAIK there is no right way to start and stop nodes dynamically. If you're writing the nodes yourself, it's much better to include pause/resume functionality via services.

As @Ricky stated, you can use the system call, however system will block until the command finishes, meaning you have to use the & control operator in the command to spin off a new process. Then you have the issue of trying to track down/parse the PID in order to shutdown when necessary.

I would recommend using Qt's QProcess, which will make it easier to manage the state of the process (destructing the object will kill the roslaunch process, thus shutting down the nodes).


---- EDIT EDIT: Poco also has nice looking Process management, if you want to avoid messing with Qt. ROS's class_loader CMakeLists is an example of how to include Poco in your package.