RPLIDAR

Hii contributors
Need some guidance on how to use RPlidar for discance measurement for AGV robot

  1. Using arduino mega
  2. Mosfet H bridge motor controller 4 motor
  3. Using QMC 5883 magnetometer compass

On the simple connect example below

void loop() {
if (IS_OK(lidar.waitPoint())) {
float distance = lidar.getCurrentPoint().distance; //distance value in mm unit
float angle = lidar.getCurrentPoint().angle; //anglue value in degree
bool startBit = lidar.getCurrentPoint().startBit; //whether this point is belong to a new scan
byte quality = lidar.getCurrentPoint().quality; //quality of the current measurement

//perform data processing here...

I want to use the RPLidar to check on the path of the robot to avoid obstacle just as we use ultrasonic sensors data.

A. Float distance on above sketch in example, does it orient with the direction of movement
Ie at what angle when lidar is rotatibg from 0 degree to 360
How can i get the distance at various angles ?
I mean if robot is travellibg forward say north, at 45 degree turn can lidar calculate soecific distance at that angle from an obstacle ?

I ran the sample exe file at the slamtec site which shows lidar scan in a grid. This program has a scan ar all angle and distances.
Kindly guide.
Thanks a lot

I got a lot of info from a robot site that got 2 LIDARs from DFRobot. One you have to turn and the RPLIDAR turns itself.

You have the kind that turns itself. When it moves along while turning, the data should show the map relative to the sensor. Move away from a wall and the map should show the wall farther and farther away.

These things are neat but not infallible.

Thanks so much