Order LiDAR points by angle [closed]

asked 2019-04-23 21:52:02 -0500

RalLpezMartn gravatar image

Is there any form to order all the points (already filtered) from the LiDAR based on the angle of those points with the origin of the LiDAR? I've tried to use numpy.sort in an array with the data from the points plus theta that I calculated, but the definition of the dtypes is failing. Is there any function that could help me with this task? And speaking about performance, how much will it affect my program to check around 30 points on each sample time? What I am trying to achieve is to obtain the range of vision that the LiDAR is actually able to see.

I am programing my nodes in Python.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by RalLpezMartn
close date 2019-04-24 23:28:11.931562

Comments

1

Can you add more details about what you want to achieve please ? Because the angles are already sorted from the lowest to the highest angle of the lidar.

check around 30 points on each sample time

What do you mean by that ? Will you do some processing or just read the data ?

Delb gravatar image Delb  ( 2019-04-24 01:21:22 -0500 )edit

Sorry I didn't explained correctly. I am trying to check the whole area cover by the LiDAR in a 2D approach but using a 3D LiDAR. So using data from a Velodyne of 32 Layers I want to take all the points from one ring (or one height) and order them by ascending or descending angle (yaw). So order all the X,Y,Z points based on the angle the form in the XY space. For example starting from the front of the car check all the data making an horizontal roll. I dont know if that makes easier to understand.

RalLpezMartn gravatar image RalLpezMartn  ( 2019-04-24 02:16:31 -0500 )edit

I am right now just reading but the plan is to process them later. Btw, I am working with Autoware on top of ROS, so I am using the filtered data from that packages and I only have like 30 points from the objects in the surroundings. If an acceptable speed of processing can be achieved I would not mind to use the whole raw pointcloud

RalLpezMartn gravatar image RalLpezMartn  ( 2019-04-24 02:18:45 -0500 )edit
1

Thank you for the precision it's much clearer now.

I've tried to use numpy.sort in an array with the data from the points plus theta that I calculated, but the definition of the dtypes is failing

What is the error exactly ?

Maybe you could try a different approach. You could use 2 arrays : one for the data and the other for the angles calculated. For each { x; y} sharing the same z you can calculate the angle and it'll be easy to find at which index in the array of the angles (by looking for lower and bigger angle) you will insert the angle calculated. This same index will enable you to add the data at the right place in the other array so that you will directly have your array sorted when creating it.

Delb gravatar image Delb  ( 2019-04-24 03:43:10 -0500 )edit

That is one of the methods I already tried. I dont know if there is a problem with numpy arctan2 or the speed of processing but it becomes super messy when I implement that. The angles get confused and there are lines crossing all the area (undesired behaviour), that is why I was trying to use al the data from one of the layers.

RalLpezMartn gravatar image RalLpezMartn  ( 2019-04-24 19:21:27 -0500 )edit

I just had some rookie mistake, sorry for the time wasted. I ended up doing what you said, solving the bug I had before (double assignation of a variable)

RalLpezMartn gravatar image RalLpezMartn  ( 2019-04-24 23:28:05 -0500 )edit

No problem, glad you could solve your issue :)

Delb gravatar image Delb  ( 2019-04-25 03:25:27 -0500 )edit