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

How to get the distance in meter from PointCloud Data?

asked 2016-07-04 08:13:51 -0600

rasoo gravatar image

updated 2016-07-04 10:46:24 -0600

Hello, I am pretty new with ROS and Robotino. I am using ROS-Indigo, Ubuntu 14.4 and Robotino by Festo. I am subscribing the ros topic /distance_sensor :

ros::Subscriber sub = n.subscribe("/distance_sensors",1, distacne_sensor_Callback); 
void distacne_sensor_Callback(const sensor_msgs::PointCloudConstPtr& msg) 
{
       for (i=0;i<msg->points.size();i++) {
        ROS_INFO("X : %f",  msg->points[i].x);
        ROS_INFO("Y : %f",  msg->points[i].y);
        ROS_INFO("Z : %f",  msg->points[i].z);
}

I am getting the x,y,z values for each of the 9 distance sensors. How can I get the distance in meter using these data? I need to use these for obstacle detection. Can anyone give me any idea on this issue? Thank is advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-07-04 19:43:18 -0600

janindu gravatar image

points[i] gives you information about the ith point from the frame of the sensor. That is, if

points[i] = {
    x : 0.2
    y : 1.2
    z : 0.6
}

that means that ith point is at (0.2,1.2,0.6) in the frame of the sensor. Assuming the sensor is fixed to the body of your robot, you can use a static transformation to transform that information to your base_link frame. You can read up on transforms here : http://wiki.ros.org/tf

I hope you are clear. If not, let me know.

edit flag offensive delete link more

Comments

Thanks for your response. I already go through the link and understand the point and x,y,z coordinate. But i need to detect obstacle based on distance sensor data. Robotino has 9 sensors in the circle base of the robot. Each of them are 40' angular distance. I need help to calculate the distance.

rasoo gravatar image rasoo  ( 2016-07-05 07:28:29 -0600 )edit

I'm not clear on one thing. When you say PointCloud data are published to the topic /distance_sensors, do you mean it actually publishes the locations of the actual distance senors wrt the robot? If that is the case then there should be a different topic that publishes your distance sensor readings

janindu gravatar image janindu  ( 2016-07-05 23:23:06 -0600 )edit

Does the (x,y,z) coordinates from the point cloud give the real world distances? After reading this,my understanding was the coordinates are used to create a projected image.

skr_robo gravatar image skr_robo  ( 2016-07-19 16:31:25 -0600 )edit

I also read that earlier.I got the obstacle distance from kinect depth image. Actually Z is not the distance. Z is the distance from the camera to the center point of the image plane. That is why we need to calculate the tangent of the point to get the actual distance.

rasoo gravatar image rasoo  ( 2016-07-19 18:30:47 -0600 )edit

I actually tried this same approach to find distance from the distance sensors. But I am not sure if it is appropriate for getting distance from distance sensor. It is working for sensor 7 and but for the other sensor it is not working properly. Expecting help from guys who have worked with robotino

rasoo gravatar image rasoo  ( 2016-07-19 18:33:27 -0600 )edit

Question Tools

Stats

Asked: 2016-07-04 08:13:51 -0600

Seen: 2,972 times

Last updated: Jul 04 '16