Skip to content

Cheatsheet

RPLidar A2

Image rplidar a2

This is LiDAR we use at Unimakers club

Cheatsheet - Hardware

Image rplidar a2 Image rplidar a2 Image rplidar wiring Image rplidar a2

Cheatsheet - Software

namespace lidar {

// starts lidar service
void startService(Lidar &lidar);

struct LidarPoint {
  float distance;
  float angle;
  uint8_t quality;
  bool startBit;
};

struct LidarConfig {
  // Hardware Serial, Serial1 or Serial2
  HardwareSerial &serial;

  // GPIO PIN
  int motor_pin;

  // 0 -> 360
  int motor_speed;

  //point aquisition timeout,
  // might affect freshness of the points
  int timeout;
};

class Lidar {
 public:
  Lidar();
  ~Lidar();

  // setup the lidar object
  void setup(LidarConfig &config);

  // get last processed point
  const LidarPoint &getCurrentPoint();
};
}