Rosanswers logo

I watched a tutorial for converting laser scan data to point cloud.

But I could not understand how this conversion works.

What is the difference between the scan and point-cloud data and what are these codes doing? The tutorials were not in detail for theoretical parts and everything I could read was just focused on the results.

Originally posted by kiru on ROS Answers with karma: 13 on 2022-05-18

Post score: 1


1 Answer 1


Rosanswers logo

I hope I'll be able to explain it enough.

First, I think it's important to look at the LaserScan message. The first part after the header gives you the min and max angle + the distance between each measurement.

So imagine a circle with a midpoint. The midpoint is your lidar_link so it has a 'front' (the direction of the x axis). The front is your 0 rad.

If you have a min_angle of pi (-90 degrees, I'm going to stick with degrees from here on, but it's actually rads) you know where to start. Your float32[] ranges is a list of ranges. The first range is at -90 degrees. If your angle_increment is 1 degree, then the second range is at -89 the third at -88 etc.

That's kinda like one of those hand fans where each of the blades is 1 range.

In a way, that means the LaserScan message is not really 2D. It's a list of 1D lengths that you make 2D by plotting them out on a circle.

Now for pointclouds. If somebody has more experience with them, please correct me. However, I have always understood it as being an actual 2(or3)D pointcloud.

Looking back at the lidar_link (or pointcloud_link if you will), it doesn't just have a 'front'. It has an x, y and z axis. It is a 3D origin. If you have a point (2, 0, 1) that's a point 2 meter in front of the link and 1 meter up. A pointcloud uses a grid to express each point.

Now for the final part of your question, how the conversion works. If you've got a lidar message, basically have vectors with a magnitude and length (hopefully khanacademy helps explaining what I mean). In the link I posted, they went from a point (a,b) to a magnitude and direction. However, for a lidar to pointcloud conversion you would of course do the opposite. You go from a magnitude and direction to a coordinate.

I hope this helped you a bit with understanding the difference.

Originally posted by Joe28965 with karma: 1124 on 2022-05-19

This answer was ACCEPTED on the original site

Post score: 3

Original comments

Comment by gvdhoorn on 2022-05-19:
A good summary I've always found is that a laser scan is essentially a set of points in a polar coordinate system (length and direction), while a point cloud stores points in a Cartesian coordinate system.

Conceptually, there is also the difference that a laser scan is the result of a radial measurement (ie: single sensor in the middle), while a point cloud is typically the result of many sensors in parallel (ie: line or square of sensors).

This implies a laser scan also typically is not composed of measurements measured at the same time, but the first point will be captured at an earlier time than the last (and this can be a significant amount of time).

The points in a point cloud are typically considered to be captured all at the same time (there is often a non-zero delta-t between the first and last points, but it's (considered) negligible with many sensors).

Of course: conversions between laser scans and pointclouds exist, but you lose the above semantics a bit.


Your Answer

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