Ask Your Question
0

Multiple nodes and nodelets in a single process

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

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

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
4

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 1,086 times

Last updated: Mar 07 '14