Hi everyone.

I’m facing some problems with the ROS2 basic in 5 Days Rosject.

My question is. How can i know the right indexes for the /laser ranges field?

Hi everyone.

I’m facing some problems with the ROS2 basic in 5 Days Rosject.

My question is. How can i know the right indexes for the /laser ranges field?

Hi @LorenzoDagostino ,

I had the same doubt when I first worked on the robot. So I am going to tell you how I figured it out.

- Perform a
`echo`

from`/laser`

topic :`ros2 topic echo /laser`

and get one single message. - Note the values of
`angle_max`

,`angle_min`

and`angle_increment`

. Use these 3 values to calculate the angular range of the scanner - it could be a 360 degree scanner or 180 degree scanner. [The rosject uses a 360 degree scanner, by the way!] - The
`angle_min`

is your initial value in the`ranges`

and`angle_max`

is the final value in your`ranges`

. So for a 360 degree sensor with 720 values in ranges, 0 corresponds to`angle_min`

and 719 corresponds to`angle_max`

.`angle_increment`

is the least count for angle measurement - it could be 0.5 degrees or 1 degree step. - Finally to find where 0 degree starts, place the robot in a corner. 0 degree can be on the front / back / left / right. So start with front facing the wall, and perform one laser scan echo. If laser ranges 0 index gives the minimum value, then front is zero, else not. Now repeat this step with left / right / back facing the wall and scan. Whichever scan value gives the minimum distance for ranges 0 index, that is the laser’s 0th position.

Now, for the quick answer:

360 degree scanner with 720 ranges [0 degrees on the back]:

0 or 719 = back, 180 = right, 360 = front, 540 = left

360 degree laser with 360 ranges [0 degrees on the back]:

0 or 359 = back, 90 = right, 180 = front, 270 = left

I hope this helps.

Regards,

Girish

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.