0
$\begingroup$

Rosanswers logo

When i used rostopic echo /RosAria/sonar it showed points: which showed x,y,z,data I want to access these x,y,z data with a cpp file. i'm trying msg->points.data()


Originally posted by Himanshu on ROS Answers with karma: 13 on 2016-06-10

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Hello Himanshu, You can access the x,y data of all the channels of sonar in the following manner.

` void sonarCallback(const sensor_msgs::PointCloud::ConstPtr& msg) {

for(i=0;i<16;i++)
{
    datax=msg->points[i].x;
    datay=msg->points[i].y;
    ROS_INFO("[%f]",datax);
    ROS_INFO("[%f]",datay);
}
ROS_INFO("....");

}` you can refer to the sensor_msgs/PointCloud for details.


Originally posted by Anirvan0102 with karma: 28 on 2016-06-17

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.