ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
2022-10-17 06:18:01 -0500 | received badge | ● Good Question (source) |
2013-10-30 01:22:12 -0500 | received badge | ● Nice Question (source) |
2012-10-22 07:41:43 -0500 | received badge | ● Famous Question (source) |
2012-05-11 08:17:49 -0500 | received badge | ● Notable Question (source) |
2012-02-18 10:32:17 -0500 | received badge | ● Popular Question (source) |
2012-02-16 02:56:26 -0500 | received badge | ● Student (source) |
2011-10-31 20:51:10 -0500 | received badge | ● Editor (source) |
2011-10-31 20:50:09 -0500 | asked a question | Problems of NaN positions when converting PointCloud2 to pcl::PointCloud PointXYZRGB Hello I have tried to convert PointCloud2 message from openni_kinect to pcl::PointCloud<pcl::pointxyzrgb>. And I have some critical problem when I check position information of PointXYZRGB. All position data is written as 'nan'. OS: Ubuntu Linux 10.04 The procedure of my code is like bellow: A. get sensor_msg(camera/depth_registered/points) from openni_launch B. convert sensor_msgs::PointCloud2 data (=pc2) to pcl::PointCloud<pcl::pointxyzrgb> data (=pcl_pc) as at this time, I check the data of pcl_pc data like bellow C. I convert inversely from pcl::PointCloud<pcl::pointxyzrgb> data (=pcl_pc) to convert sensor_msgs::PointCloud2 data (=pc2) for publishing to rviz a and I can make certain that point clouds data displayed correctly on rviz. D. Moreover Moreover I saved pcl::PointCloud<pcl::pointxyzrgb> into pcd format. the values of position in this case also 'nan' like below:
I guess this problem is associated with conversion of data format. Because the type of PointCloud2.data is unsigned char and the type of PointXYZRGB.points is float. Inside of function pcl::fromROSMsg, they copy data between these two data structure using memcpy. That's the reason that it displays correctly on rviz when I convert inversely because the function toROSMsg also use memcpy between float data(pcl::PointCloud.points) and corresponding 4 unsigned char data (PointCloud2.data). Is there any idea about this problem?? or this only happen to me ?? |