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

Multiple nodes and nodelets in a single process

asked 2014-01-14 07:51:34 -0600

updated 2014-01-28 17:19:02 -0600

ngrennan gravatar image

I'm trying to include ros into an existing application, which is able to load extensions. Therefore I wrote my own extension (using roscpp library) containing a rosnode. Everything works as it is supposed to be. I'm able to publish and subscripe to messages.

Now I'm used to append more than only one ROS-based extensions into that application. Each extension creates a node by calling ros::init(argc, argv, name) where name is a unique identifier.

My problem is, that besides multiple nodes have been created (at least their topics are all listed), rosnode list lists only the first created node. After reading a little bit, my understanding right now is, that only one node will reside per process. Is this correct?

After that it found the nodelet package, which seems to be the solution for my problem. But it's a windows application and it's not possible to use catkin to rebuild the whole software. Moreover, I don't want to call any other executables out of a extension. Therefore, I tried to understand the idea behind nodelets and it's functionality.

My understanding right now is, that I have to write a nodelet_manager, which loads nodelets dynamically and all my extensions have to be derived from class nodelet::Nodelet. Am I right?

Furthermore, it seems that nodelets uses one process and multiple threads for each nodelet. If so, could I just move my existing nodes into different threads?

Are my sugestions right and would there be a better solution. I would be happy to receive some feedback.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-07 08:09:52 -0600

Dirk Thomas gravatar image

roscpp only allows a single ROS node per process. Running mulitple nodes in different threads will not work as you would like it to be. It would still be a single ROS node.

You need to modify your nodes to actually become nodelets. You don't have to write your own nodelet manager though. There is an existing nodelet manager you may use or even extend for customizing it to your needs.

edit flag offensive delete link more

Question Tools



Asked: 2014-01-14 07:51:34 -0600

Seen: 2,123 times

Last updated: Mar 07 '14