Ask Your Question

Revision history [back]

As the message definition for sensor_msgs/LaserScan specifies, angle_min is the start angle of the scan, i.e. equivalent to ranges[0].

However, i.e. all w.r.t. the frame in which the laser scan is published. For the RPLiDAR A2 (and assuming you are using the rplidar_ros package), you can see the frame orientation on this GitHub wiki page. Also, angle_min is set to 0.0, i.e. along the x-axis.

As to your question: your function is (at least) missing the angle with which your lidar is mounted on your robot. This would allow you to transform this accordingly.

But also note that angle_min is actually implementation defined, depending on how you want to send out messages and how the communication with the lidar is specified. most 360°-Lidars actually have angle_min as -M_PI, RPLiDAR being the exception...