[ros-users] questions about nodelets

Jack O'Quin jack.oquin at gmail.com
Tue Nov 9 14:54:48 UTC 2010

I am experimenting with using nodelets for Velodyne 3D LIDAR support
on C-turtle. So far, converting the code has been relatively
straightforward. But, there are some questions I can't answer.

 * How do I launch a nodelet manager and several nodelets with roslaunch?

The example in the tutorial seems to have no interdependencies or timing issues.


But, when I try to launch my driver nodelet along with a point cloud
nodelet that converts the raw scan data into ROS
sensor_msgs/PointCloud format, I seem to get startup sequencing
problems depending on the order in which things initialize. Sometimes
it works and sometimes no point cloud gets published. Here is a simple

  <node pkg="nodelet" type="nodelet" name="velodyne_nodelet_manager"
        args="manager" />
  <node pkg="nodelet" type="nodelet" name="driver_nodelet"
        args="load velodyne_common/DriverNodelet velodyne_nodelet_manager" />
  <node pkg="nodelet" type="nodelet" name="pointcloud_nodelet"
        args="load velodyne_common/PointCloudNodelet
velodyne_nodelet_manager" />

I guess a "nodelet load" command sometimes arrives before the "nodelet
manager" is ready. Since roslaunch makes no guarantees about order, I
wonder how to solve it. I see no similar problems when dealing with
the node-based versions of these programs.

Shutting down this nodelet manager process has also been unreliable.
Sometimes the threads with go away with ^C (INTERRUPT), but they often
hang and require a ^\ (TERMINATE). This may also be an issue with the
order in which the signals get delivered and processed. Shutting down
the node-based version works reliably.

These problems are probably my fault. While doing the conversions it
was not clear to me exactly how onInit() interacts with callbacks and
how the Nodelet class terminates.

 * Is it OK for onInit() to return when initialization finishes? That
looks like the nodelet_tutorial_math example, which runs onInit()
followed by callback invocations. (I assume "yes". My
pointcoud_nodelet works the same way. )

 * Are the callbacks invoked in the nodelet thread (by default),
similar to a node? (I assume "yes".)

 * Is there any special hook for shutting down a nodelet? I don't see
anything like an onExit() method.

 * Can a device driver run its entire main loop in the onInit() method
using "while (ros::ok()) { ... }"?

 * Is it OK that onInit() only returns when ros::ok() becomes false in
that case?

 * Does this loop need to call ros::spinOnce()? Even if it has no subscriptions?

 * What happens if library classes used by both node and nodelet
versions call ROS_INFO() or other ROS services? Are there things to
avoid in those classes?

 * I presume the image_pipeline developers are facing similar
conversion issues. Are there early versions of these programs I should


More information about the ros-users mailing list