[ros-users] Nodelet multi-threading example

Jack O'Quin jack.oquin at gmail.com
Sun Dec 18 16:47:18 UTC 2011


This would make a good answers.ros.org question:

On Sun, Dec 18, 2011 at 6:37 AM, K Chen <chk0105 at gmail.com> wrote:
>
> I am finding a way to separate some heavy load process into some standalone
> threads so that I could get other callbacks in time using nodelet. I looked
> at the nodelet wiki page but it has few description about its
> multi-threading model and usage, so I am wondering where I could find such
> usage examples or projects already doing this?

Multiple nodelets can run in parallel on different threads within the
same address space. There is a shared pool of nodelet threads.
Callbacks for a single nodelet may be limited to a single thread, or
may be multithreaded.

 http://www.ros.org/wiki/nodelet#Threading_Model

> BTW, is creating my own threads using boost inside a nodelet a bad idea?

That works fine. Create a boost::shared_ptr to a boost::thread in your
onInit() method.
-- 
 joq



More information about the ros-users mailing list