ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

how to access rosaria/sonar pointcloud data

asked 2016-06-10 05:03:51 -0600

Himanshu gravatar image

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()

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-06-17 10:21:48 -0600

Anirvan0102 gravatar image

updated 2016-06-17 10:23:18 -0600

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-06-10 05:03:51 -0600

Seen: 587 times

Last updated: Jun 17 '16