Ask Your Question
10

What is a nodelet?

asked 2016-04-04 14:35:55 -0500

pgigioli gravatar image

updated 2016-04-06 00:10:16 -0500

Can anyone explain conceptually what a nodelet is and what the motivation is for using one? The documentation says that nodelets are "designed to provide a way to run multiple algorithms in the same process with zero copy transport between algorithms" but I don't understand what this really means.

Are nodelets just a way of making your nodes more efficient?

Thanks!

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
-3

answered 2017-03-31 21:31:22 -0500

Sebastian gravatar image

I recommend you don't use nodelet. If you're thinking of using it, you might want to first consider just launching two threads in a single node, instead of two nodes. I think you will probably find that easier than trying to understand the nodelet library.

edit flag offensive delete link more

Comments

Lol and this guy, who actually recommends on not saving memory says something about ROS not being efficient. Such a pathetic person who has no knowledge in C++ whatsoever

EdwardNur gravatar imageEdwardNur ( 2019-04-01 09:05:32 -0500 )edit

If you create two threads in a single node, it will be more memory efficient than launching two "nodelets" in ROS. My recommendation is simpler, saves memory and is faster.

Sebastian gravatar imageSebastian ( 2019-04-01 09:23:07 -0500 )edit

omg... It is not the threads that saves the memory but the actual data. Nodelet uses much less data size and if you were to know anything about the memory management you would know that smaller data are closer to CPU (caches) and are executed faster in magnitude

EdwardNur gravatar imageEdwardNur ( 2019-04-01 09:29:25 -0500 )edit

Nodelet transfers less data than typical ROS nodes. It is not more efficient than two threads, though. If you have two threads, they can both share a reference to the same data, so there is no need to copy anything. This is a basic and common C++ technique. Nodelet is a more complicated way of doing the same thing.

Sebastian gravatar imageSebastian ( 2019-04-01 09:34:37 -0500 )edit

Efficient = Faster = less memory usage. The whole goal of any low level programming language is to minimize the time required to access and write to the memory, that is the whole point... If the same two threads can read and write into the memory much faster it is the definition of efficiency

EdwardNur gravatar imageEdwardNur ( 2019-04-01 10:07:24 -0500 )edit

You aren't making sense. My point is that nodelet is less efficient than 2 std::thread. Understand?

Sebastian gravatar imageSebastian ( 2019-04-01 16:38:55 -0500 )edit
22

answered 2016-04-06 08:08:19 -0500

Airuno2L gravatar image

Like Augusto pointed out, regular nodes use TCP. This works fine for a lot of things.

But if you have multiple processes that need to use messages that contain large amounts of data (like images or point clouds) packaging the message, sending it, then unpacking it can take a bit of time. If the two processes are on the same computer, it is quicker to just send a pointer to that data rather than sending the data itself over TCP.

This only works for processes (aka nodelets) on the same computer though since a pointer for one computer doesn't make sense for another computer. Nodes on the other hand can work over networked computers since you're sending the actual data.

So nodelets don't make the processes quicker, but it is a quicker way to get information from one process to another. A good rule of thumb would be to always use nodes (because they are easier to use, and more flexible) unless you get in a situation where the message passing is too slow for your application and causing problems, then you would consider using nodelets.

edit flag offensive delete link more

Comments

2

Thank you for explaining this very intuitively!

pgigioli gravatar imagepgigioli ( 2016-04-06 09:05:40 -0500 )edit

Can we use it over Python and rospy? or it is compatible with C++?

Benyamin Jafari gravatar imageBenyamin Jafari ( 2019-03-28 02:45:15 -0500 )edit
1

The nodelet concept is not implemented in Python.

gvdhoorn gravatar imagegvdhoorn ( 2019-03-28 04:44:18 -0500 )edit
6

answered 2016-04-06 03:40:44 -0500

updated 2016-04-06 03:43:05 -0500

Maybe something like this image could be useful :-)

image description

To answer to your question:

Are nodelets just a way of making your nodes more efficient?

It really depends on how your nodes communicate each other, and the reason for that communication. Sorry for the "it depends", but without any clue about your issue, no one can tell you more than this :-)

Have a look also here http://wiki.ros.org/roscpp/Overview/P...

edit flag offensive delete link more

Comments

90% is taken from the book - Learning Robotics Using Python by Lentin Joseph. Please refer!

glukon gravatar imageglukon ( 2017-10-24 03:03:11 -0500 )edit

as far as I know (and remember), I used as source http://wiki.ros.org/ROS/Concepts and http://wiki.ros.org/nodelet and the linked address, which have been published before the book you're linking. maybe I am wrong, but I'm not used to copy from books ;-) (without any citation)

Augusto Luis Ballardini gravatar imageAugusto Luis Ballardini ( 2017-10-24 03:55:55 -0500 )edit

Sorry, you're right. Pretty much taken from the ros wiki. btw.. kinda nice way to earn money by publishing wiki books right :-P

glukon gravatar imageglukon ( 2017-10-24 04:09:58 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-04-04 14:35:55 -0500

Seen: 8,114 times

Last updated: Mar 31 '17