Hi all,
I am writing something using nodelet to process images from kinect, using openni_nodelet under openni_camera package to retrieve images from kinect, and my nodelet to 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
//...
cv::imshow(mat_rgb);
cv::waitKey(5);
}
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)
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.
Thanks for any help.
P.S. Here is my launch file:
<launch>
<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" />
</node>
<include file="$(find openni_camera)/launch/kinect_frames.launch"/>
<node pkg="nodelet" type="nodelet" name="TabletopObj" args="load vision/TableTopObjNodelet nodelet_mgr" output="screen">
</node>
</launch>
--
Regards
University of Science and Technology of China
School of Computer Science and Technology
Multi-Agent System Lab
K.Chen