0
$\begingroup$

Rosanswers logo

I have made a bag: 2021-02-15-11-32-28.bag and converted it in the: rplidarA1.csv File. So I have 2 Mb data and the following fields: %time field.header.seq field.header.stamp field.header.frame_id field.angle_min field.angle_max field.angle_increment field.time_increment field.scan_time field.range_min field.range_max field.ranges0 bis field.ranges719 field.intensity

My question: With which of these fields, I can calculate the distance to a object ?

I real appreciate your comments :-)


Originally posted by Tricia279 on ROS Answers with karma: 15 on 2021-02-23

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The Lidar's laserscan/ranges work in this way:

It detects and record in terms of an array in a string of Float32.

So in the lets say the object is 2 meters between the Lidar 0 degree to 3 degree:

Range: [2.0 2.0 2.0 0.0 0.0 0.0 ....]

More on: http://docs.ros.org/en/api/sensor_msgs/html/msg/LaserScan.html

Hope it helps.


Originally posted by loguna with karma: 98 on 2021-02-25

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by drtritm on 2021-02-26:
As @loguna have mentioned, but you should notice that the angle increment play a role in it. In @loguna example, the angle_increment is 1 degree, assumed that the measure unit of angle_increment is degree(but it's rad)

Comment by Tricia279 on 2021-03-02:
@loguna: I have 3 additional questions: The "range" in your example is it the field_range ? range_min or range_max ? I use RViz: How I can set the angle in rad there ? and How I can get these Range: [2.0 2.0 2.0 0.0 0.0 0.0 ....] ?

Comment by loguna on 2021-03-03:
Its in Field range. So the lidar spins 360 degree, it collects signals and place them into an array in meters. So lets say the Lidar collect a signal per degree (Check with your Lidar manufacturer), your array should contain [360] meters values. To obtain the signal, import the LaserScan from sensor_msgs.msg. Than try printing "LaserScan.ranges".

If you wish to detect obstacle at a specific direction: The way i usually do is place an object in front of the Lidar. Next I set a random value like LaserScan.range[180] to see if the lidar did pick up the object. If it didnt, i change the "value" of LaserScan.range[value] until i get a hit.

N usually 360 degree Lidar is use more towards mapping and not really to detect obstacles at a specific direction. Hence in RVIZ, it will show all the points in 360 degree.

$\endgroup$

Your Answer

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