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

Sequentially get the IR and RGB data from openni_node

asked 2011-05-24 03:13:31 -0600

walonchiu gravatar image

updated 2016-10-24 08:59:37 -0600

ngrennan gravatar image

Hello, all,

Since I want to do the processing toward the IR and RGB data from Kinect in one node, I need to build two subscribers and then iteratively subscribing the IR and RGB data published by openni_node within the openni_camera_unstable package. (Due to the limitation of Kinect:Cannot stream RGB and IR at the same time.) But I have no idea how to code that out. Is there anyone would like to give me any advice or samples? Thanks a lot!

edit retag flag offensive close merge delete

Comments

Hi walonchiu, I wanna ask you if you can send me the code that you use to subscribe to IR camera topic ? Thank you

ROSkinect gravatar image ROSkinect  ( 2014-06-23 08:18:42 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2011-06-17 13:07:18 -0600

Wim gravatar image

updated 2011-08-03 17:59:16 -0600

The openni driver does not allow streaming both ir and rgb at the same time, but there is a way to switch between ir mode and rgb mode. The driver looks at the number of subscribers on the rgb and ir topics, and based on the number of subscribers decides to enable ir mode or rgb mode. When you have one or more subscribers to the rgb topic, the driver will be in rgb mode, independent of the number of subscribers to the ir topic. When you have zero subscribers to the rgb topic and one or more subscribers to the ir topic, the driver will be in ir mode.

To implement this, you can use the ros::topcic::WaitForMessage method. This method will subscribe to a topic, receive one message, and then unsubscribe from the topic. So you can call this method sequentially on the rgb and the ir topic to switch between rgb/ir mode and receive rgb/ir images.

edit flag offensive delete link more
0

answered 2012-07-28 12:33:24 -0600

ranqi gravatar image

Did anyone get this work? I tried both WaitForMessage, or sub.shutdown(). Seems none of them would unsubscribe the rgb topic so that ir can get data.

edit flag offensive delete link more
0

answered 2011-06-17 12:20:34 -0600

Mac gravatar image

Take a look at ros::Time; it provides ways of waiting. Then, you could have a loop that subscribed to one topic,spun for some amount of time, unsubscribed, subscribed to the other, and so on.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-05-24 03:13:31 -0600

Seen: 1,751 times

Last updated: Jul 28 '12