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

calculate the distance from the detected object to the lidar?

asked 2022-07-24 03:57:19 -0500

Delbina gravatar image

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

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-07-24 04:42:18 -0500

citkid gravatar image

updated 2022-07-27 05:43:55 -0500

image descriptionGerman 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.

edit flag offensive delete link more

Comments

i did not get your point !!!

Delbina gravatar image Delbina  ( 2022-07-27 04:28:17 -0500 )edit

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

citkid gravatar image citkid  ( 2022-07-27 05:43:40 -0500 )edit

@citkid I upvoted your answer, I think you can already upload your photo (it's from 10+ karma points, I think)

ljaniec gravatar image ljaniec  ( 2022-07-27 06:14:13 -0500 )edit
0

answered 2022-07-27 06:12:50 -0500

ljaniec gravatar image

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.

edit flag offensive delete link more

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

Delbina gravatar image Delbina  ( 2022-08-04 05:13:15 -0500 )edit

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_...

ljaniec gravatar image ljaniec  ( 2022-08-04 05:21:43 -0500 )edit

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.

Delbina gravatar image Delbina  ( 2022-08-04 05:39:00 -0500 )edit

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)

ljaniec gravatar image ljaniec  ( 2022-08-04 14:37:37 -0500 )edit

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?

Delbina gravatar image Delbina  ( 2022-08-04 17:26:58 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-07-24 03:57:19 -0500

Seen: 941 times

Last updated: Jul 27 '22