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

openni_node internal throttle to limit cpu usage

asked 2011-04-12 20:14:56 -0500

dornhege gravatar image

updated 2016-10-24 09:03:35 -0500

ngrennan gravatar image

When running openni_node on an embedded system I realized the CPU usage is quite high, actually that high, that the rest of the system lags.

The cpu load only goes high, when someone is actually subscribed, so my guess is that the marshalling takes time. Is this the correct assumption?

Switching down the resolution with dynamic_reconfigure already helps, but I'm wondering if there is an option (planned?) to throttle the output in the node internally, so the data is not marshalled, if needed at a lower rate.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-04-12 22:27:40 -0500

tfoote gravatar image

Marshalling does take a good amount of time. The recent driver is already a nodelet in it's implementation and can use the nodelet_throttle. For an example of doing this see the turtlebot_bringup robot.launch

That launch file shows how you can downsample while only passing pointers. The existing settings doesn't throttle the frequency much as we can keep up mostly, but just change the parameters if you need less CPU usage.

PS you may want to experiment with running more things as nodelets on the embedded board for by doing that you can entirely avoid serializing. Depending on what you are doing it may be more efficient to operate on the data in place.

edit flag offensive delete link more


Thanks for this info. I had a look at the launch file and the code of CloudThrottle, but a remaining problem seems to be, that the point cloud will still be computed from depth and pixelwhich will still consume cpu time. But maybe that is insignificant versus the marshalling, I haven't tried yet.
Felix Endres gravatar image Felix Endres  ( 2011-04-19 04:12:18 -0500 )edit
To update the last comment: With an update rate of 1hz the nodelet has about 50% single-core cpu usage on an IntelCore2 Quad CPU Q9650@3.00GHz (instead of ~110% for the non-throttled node). Plus the XnSensorServer with ~20%, but I assume that is independent.
Felix Endres gravatar image Felix Endres  ( 2011-04-19 05:01:47 -0500 )edit

answered 2011-04-12 21:53:27 -0500

AFAIK, there is not. I once had it modified to run slower, but it was pretty hackish. I just added a sleep statement to the imageCallback() and depthCallback() in ni/ni/openni_camera/src/openni_nodelet.cpp

An alternative to get around the marshalling is to use the driver as a nodelet. I have no experience with that though.

edit flag offensive delete link more


I guess, that's why there is a nodelet implementation, unfortunately it's on another machine. I'll hack it myself than.
dornhege gravatar image dornhege  ( 2011-04-12 21:57:12 -0500 )edit

Question Tools

1 follower


Asked: 2011-04-12 20:14:56 -0500

Seen: 1,470 times

Last updated: Apr 12 '11