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

What is a nodelet?

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

pgigioli gravatar image

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

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
49

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

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

3

Thank you for explaining this very intuitively!

pgigioli gravatar image pgigioli  ( 2016-04-06 09:05:40 -0600 )edit
1

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

Benyamin Jafari gravatar image Benyamin Jafari  ( 2019-03-28 02:45:15 -0600 )edit
2

The nodelet concept is not implemented in Python.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-28 04:44:18 -0600 )edit
20

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

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

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

1

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

glukon gravatar image glukon  ( 2017-10-24 03:03:11 -0600 )edit
1

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 image Augusto Luis Ballardini  ( 2017-10-24 03:55:55 -0600 )edit
1

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 image glukon  ( 2017-10-24 04:09:58 -0600 )edit
1

How can that be "taken from a book" that is about python, since this nodelet concept works only in C++

Kansai gravatar image Kansai  ( 2020-07-13 06:15:30 -0600 )edit
1

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

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 image EdwardNur  ( 2019-04-01 09:05:32 -0600 )edit
1

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 image Sebastian  ( 2019-04-01 09:23:07 -0600 )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 image EdwardNur  ( 2019-04-01 09:29:25 -0600 )edit
1

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 image Sebastian  ( 2019-04-01 09:34:37 -0600 )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 image EdwardNur  ( 2019-04-01 10:07:24 -0600 )edit

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

Sebastian gravatar image Sebastian  ( 2019-04-01 16:38:55 -0600 )edit
1

I totally agree with @Sebastian. ROS and its nodes actually make things more simple by wrapping them in simple forms. Nodelet is actually a form of thread in C++. If you are a professional in C++ then you don't have to spend time to read about a library which just wraps the library that you already know which is std::thread in this case.

biendltb gravatar image biendltb  ( 2020-08-19 08:15:52 -0600 )edit

Question Tools

1 follower

Stats

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

Seen: 17,585 times

Last updated: Mar 31 '17