[Ros-kinect] Images from openni_nodelet sometimes cannot be retrieved within a nodelet mgr

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Ros-kinect] Images from openni_nodelet sometimes cannot be retrieved within a nodelet mgr

K Chen

I am writing something using nodelet to process images from kinect, using openni_nodelet under openni_camera package to provide images from kinect, and my nodelet subscribe it.

I wrote a launch file to start the nodelet_mgr, openni_nodelet and my nodelet, and I use openCV windows to display images got from openni_nodelet, I wrote something like this as the callback:

onRGBDImage(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr& cloud_msg)
    cv::Mat mat_rgb;
    // Convert from cloud_msg to cv::Mat

But when I start all nodes using the launch file, sometimes it can display images properly, but sometimes it cannot, and the openCV window goes grey(Not responding because no call to cv::waitKey() for some time). So it appears sometimes I can get the messages from openni_nodelet, but sometimes I cannot. Each time I just run the launch file and exit it by Ctrl-C, but the results are different.

I don't know whether there exists some rules that I should follow when using nodelet, e.g. subscribers should start after publishers? How can I make it work every time?

I am using electric under ubuntu 10.10.

P.S. Here is my launch file:

  <node pkg="nodelet" type="nodelet" name="nodelet_mgr"  args="manager" output="screen"/>

  <!-- openni_camera nodelet -->
  <node pkg="nodelet" type="nodelet" name="openni_camera" args="load openni_camera/OpenNINodelet nodelet_mgr">
    <param name="device_id" value="#1"/> <!-- this line uses first enumerated device -->
    <rosparam command="load" file="$(find openni_camera)/info/openni_params.yaml" />
    <param name="rgb_frame_id" value="/openni_rgb_optical_frame" />
    <param name="depth_frame_id" value="/openni_depth_optical_frame" />
    <param name="depth_registration" value="true" />
    <param name="image_mode" value="2" />
    <param name="depth_mode" value="2" />
    <param name="debayering" value="2" />
    <param name="depth_time_offset" value="0" />
    <param name="image_time_offset" value="0" />
  <include file="$(find openni_camera)/launch/kinect_frames.launch"/>

  <node pkg="nodelet" type="nodelet" name="TabletopObj" args="load vision/TableTopObjNodelet nodelet_mgr" output="screen">

Thanks for any help.


University of Science and Technology of China
School of Computer Science and Technology
Multi-Agent System Lab


Ros-kinect mailing list
[hidden email]