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

Callback never called on c++

asked 2011-10-24 20:09:02 -0600

CaptainTrunky gravatar image

updated 2014-01-28 17:10:38 -0600

ngrennan gravatar image

Hi! I have a little project on C++. When it was very simple (take frame from Kinect, convert to cv::Mat and show it in window), everything works well. Some days ago I add classificator and after it, in some reasons, callback never calls, as I understand. I can't get, why it so, because of code not changed in general. Can somebody helps me with it? Thanks!

Here link to archive -

edit retag flag offensive close merge delete


Have you checked if the Kinect messages are getting published at all (Using rostopic hz /camera/depth/image)? Some people (including me) are having problems with the current openni driver sometimes not publishing the desired messages:
Ben_S gravatar image Ben_S  ( 2011-10-24 20:58:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-10-24 20:45:16 -0600

updated 2011-10-24 20:50:59 -0600

You do a lot of work in your callback, and your subscribe queue is limited to one image. It is not surprising that frames get dropped while your callback is busy with your classifier.

As I see it, you have three options:

  1. Ignore the frame drops, and process just those frames you can actually handle.

  2. Increase the queue size. This will only work if you can keep up with the frame rate most of the time. Otherwise, your queue will just fill up and your node will lag behind accordingly.

  3. Do less work in your callback. Improve the speed of your classifier.

edit flag offensive delete link more


Thank you very much. Both advices were very useful! Everything works fine.

CaptainTrunky gravatar image CaptainTrunky  ( 2011-10-26 00:08:59 -0600 )edit

Question Tools


Asked: 2011-10-24 20:09:02 -0600

Seen: 689 times

Last updated: Oct 26 '11