Accesing RosAria Point cloud sensor data
HI and thank you in advance for your help,
I have recently installed RosAria on my computer to communicate to a pioneer robot over usb to serial. I have tested RosAria using rostopic echo RosAria/sonar to ensure connection and check the sonar data which is returned in a pointcloud. I have been trying to subscribe to RosAria/sonar from a c file I have created. I believe that I have succeeded in connecting because the sonars are clicking but I do not get any viable data into my program observed by ROS_INFO_STREAM. I believe that this is because I have not been able to gain access to the specific array holding the distance readings. I was not able to use PointCoud_To_LaseScan because of errors which I believe are due to it requiring pointcloud2 along with camera data which I do not have because I am simply trying to subscribe to the sonar data. I believe the error in my code is caused by the subscription to the data
Sonar_msg.points=msg->points;
because pointcloud has a header file shown below it would seem the above line should be
Sonar_msg.points.x=msg->points.x; or Sonar_msg.points.x=msg->points;
but these cause an error shown below, so what are the members of PointCloud, and how do you access them?
: error: ‘sensor_msgs::PointCloud_<std::allocator<void> >::_points_type’ has no member named ‘x’
rosmsg show sensor_msgs/PointCloud std_msgs/Header header uint32 seq time stamp string frame_id geometry_msgs/Point32[] points float32 x float32 y float32 z sensor_msgs/ChannelFloat32[] channels string name float32[] values, pointclouds
some of the data I have received which I believe should be of type double with no special characters in them.
Please help me find where I'am going wrong subscribing
Thanks
I'm not sure the answer to your specifc question about using the C++ client api to pointcloud data, but I just added a new topic to RosAria which publishes a PointCloud2 message type (sonar_pointcloud2). I just used the conversion function in sensor_msgs in roscpp. Update rosaria git to test.