Rosject specs (ROS2 Basics in 5 Days Humble C++)

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.

  1. Perform a echo from /laser topic : ros2 topic echo /laser and get one single message.
  2. 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!]
  3. 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.
  4. 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:

Direction Indexes (click this line to expand)

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.


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