calculate the distance from the detected object to the lidar?
hi
I have a 3D lidar, attached to the top of a vehicle. I want to calculate the distance from the detected object to the lidar. how can I calculate this distance through a python code?
3D lidar provides me point cloud.
ROs1, kinetic, ubuntu 16.04
Thanks
Asked by Delbina on 2022-07-24 03:57:19 UTC
Answers
German translation:
Using Python, I read in 10 times and calculated the average for each position (angle). So I got a value which corresponds to the tolerance of the lidar.
Asked by citkid on 2022-07-24 04:42:18 UTC
Comments
i did not get your point !!!
Asked by Delbina on 2022-07-27 04:28:17 UTC
Sorry, I can't upload any pictures here. With that I could present it much more understandable.
Cloud: I understand by a cloud a quasi arbitrary accumulation of points. I only get them when I scan unsuitable surfaces.
Question: do you get an incomprehensible jumble or a blurred image of your surroundings?
My scans: I don't get a clean line (row of dots) for a wall, but a row of dots, with dots deviating within the tolerance of the laser (approx. +-10cm). If I don't clean up my display, I get a wide line of dots over several scans. This is not helpful for distance measurement. Therefore I make an average over 10 scans for each angle. Now I get an almost straight line of points. These values are suitable for distance measurement.
One more question: do you already have the laser data as a tuple? Each value in the tuple is the distance for the angle, corresponding to the position in the tuple.
Asked by citkid on 2022-07-27 05:43:40 UTC
@citkid I upvoted your answer, I think you can already upload your photo (it's from 10+ karma points, I think)
Asked by ljaniec on 2022-07-27 06:14:13 UTC
I think you want to combine something like this package (multi_object_tracking_lidar
):
with the recorded position of the robot using LiDAR (e.g., from odometry or another localization system).
The length between the position of the robot and the position of the detected object can be taken as the distance you wanted.
Asked by ljaniec on 2022-07-27 06:12:50 UTC
Comments
thanks, i am working with Ros kinetic, the pkg that you mentioned is for melodic and noetic. in the environment i have 3 objects, i want to identify the distance from these object to the vehicle, based on the point cloud received from Lidar.
I get stuck in this phase:(
Asked by Delbina on 2022-08-04 05:13:15 UTC
Are you hard set on using old and unsupported ROS version? Upgrade could be possibly the easiest route. Backporting software to the older environment can break a lot of dependencies. Maybe this package could work?
https://github.com/introlab/find-object (branch: kinetic-devel
, but for a normal 2D camera...)
There is some ancient software called ORK too: https://github.com/wg-perception/ork_tutorials/blob/master/doc/source/tutorial03/tutorial.rst
Asked by ljaniec on 2022-08-04 05:21:43 UTC
I have point cloud coming from a 3D lidar. I do not want to make it so complicated. I just want to identify the distance from the detected object to the lidar from the pointcloud that i have received.
Asked by Delbina on 2022-08-04 05:39:00 UTC
Let's get our definitions straight - what do you mean by "detected object"? In a point cloud you have points, do you want the distance to each of them? Or only to some of them? Do you assume any grouping of them - if so, how? The distance will be a Frobenius (Euclidean) norm of the position
+ (LiDAR offset) vector of the robot (from AMCL, odometry etc.) minus the center point of the object, e.g. (x_object, y_object, z_object)
, but at the moment I don't really know what you mean by "detected object`.
That's why I assumed these steps:
use a library to detect objects in the point cloud and get their positions
use robot position/it's LiDAR position to calculate the distance as a
sqrt((x_lidar-x_object)^2+(y_lidar-y_object)^2+(z_lidar-z_object)^2)
Asked by ljaniec on 2022-08-04 14:37:37 UTC
maybe i did not use a proper word. i wanted to mention the objects that appeared in the pointcloud. i want distance to the object. i donot want distance to each of the points. I think for instance if i could find the middle point (or any other point) in the pointcloud related to the object, then distance can be calculated easily.
from the steps which you mentioned, which library do you propose, which is easy to implement as well?
Asked by Delbina on 2022-08-04 17:26:58 UTC
Comments