Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  1. Whenever a callback is called, it is called with the latest data. But, if your callback takes too much time, and another message arrives when you are processing your current callback, then you will most likely lose the message. Too much processing is discouraged in callback functions. The reason for this should be obvious if you try thinking of callbacks as interrupts. It is essentially an interrupt handler in the context of ROS.
  2. Please paste the entire code. The work of spinOnce can be thought of like this - enable interrupts and call the interrupt handler for one interrupt (or in ROS language - look at the callback queue and fetch the fellow at the start). This means that spinOnce should be used inside a while/for loop for it to be called at periodically. There is a possibility - if your program has a spinOnce() function that is standing alone, it might never trigger callback at all. Please read more on callback queues if you want a deeper understanding. Also, if there is no spinOnce or spin, the callback will never happen.
  3. Simple - put a print statement inside the callback that says, "I was called" or what have you.

Also, what launch are you using to obtain the depth_registered image? Are you running a custom launch which has the parameter depth_registration set to true? If it is set to false, you will see the topic but depth registration won't happen and you can't get a callback at all. Please be sure that depth registration is actually happening.

Please see this: might be useful - http://answers.ros.org/question/11939/activating-openni-depth-registration-by-default/

I have tried my best to answer you. Please tell me if that solves it.

  1. Whenever a callback is called, it is called with the latest data. But, if your callback takes too much time, and another message arrives when you are processing your current callback, then you will most likely lose the message. Too much processing is discouraged in callback functions. The reason for this should be obvious if you try thinking of callbacks as interrupts. It is essentially an interrupt handler in the context of ROS.
  2. Please paste the entire code. The work of spinOnce can be thought of like this - enable interrupts and call the interrupt handler for one interrupt (or in ROS language - look at the callback queue and fetch the fellow at the start). This means that spinOnce should be used inside a while/for loop for it to be called at periodically. There is a possibility - if your program has a spinOnce() function that is standing alone, it might never trigger callback at all. Please read more on callback queues if you want a deeper understanding. Also, if there is no spinOnce or spin, the callback will never happen.
  3. Simple - put a print statement inside the callback that says, "I was called" or what have you.

Also, what launch are you using to obtain the depth_registered image? Are you running a custom launch which has the parameter depth_registration set to true? If it is set to false, you will see the topic but depth registration won't happen and you can't get a callback at all. Please be sure that depth registration is actually happening.

Please see this: might be useful - http://answers.ros.org/question/11939/activating-openni-depth-registration-by-default/

I have tried my best to answer you. Please tell me if that solves it.