YDLIDAR SDK  V1.3.2
CYdLidar.h
1 
2 #pragma once
3 #include "utils.h"
4 #include "ydlidar_driver.h"
5 #include <math.h>
6 
7 
8 #define PropertyBuilderByName(type, name, access_permission)\
9  access_permission:\
10  type m_##name;\
11  public:\
12  inline void set##name(type v) {\
13  m_##name = v;\
14  }\
15  inline type get##name() {\
16  return m_##name;\
17 }\
18 
19 #define DEG2RAD(x) ((x)*M_PI/180.)
20 
21 class YDLIDAR_API CYdLidar
22 {
23  PropertyBuilderByName(float,MaxRange,private)
24  PropertyBuilderByName(float,MinRange,private)
25  PropertyBuilderByName(float,MaxAngle,private)
26  PropertyBuilderByName(float,MinAngle,private)
27  PropertyBuilderByName(int,ScanFrequency,private)
28 
29  PropertyBuilderByName(bool,Intensities,private)
30  PropertyBuilderByName(bool,FixedResolution,private)
31  PropertyBuilderByName(bool,Exposure,private)
32  PropertyBuilderByName(bool,HeartBeat,private)
33  PropertyBuilderByName(bool,Reversion, private)
34 
35  PropertyBuilderByName(int,SerialBaudrate,private)
36  PropertyBuilderByName(int,SampleRate,private)
37 
38  PropertyBuilderByName(std::string,SerialPort,private)
39  PropertyBuilderByName(std::vector<float>,IgnoreArray,private)
40 
41 
42 public:
43  CYdLidar();
44  virtual ~CYdLidar();
45 
46  bool initialize();
47 
48  // Return true if laser data acquistion succeeds, If it's not
49  bool doProcessSimple(LaserScan &outscan, bool &hardwareError);
50 
51  //Turn on the motor enable
52  bool turnOn();
53  //Turn off the motor enable and close the scan
54  bool turnOff();
55 
57  bool getDeviceHealth() const;
58 
60  bool getDeviceInfo(int &type);
61 
63  bool checkHeartBeat() const;
64 
66  bool checkScanFrequency();
67 
68  //Turn off lidar connection
69  void disconnecting();
70 
71 protected:
76  bool checkCOMMs();
77 
81  bool checkStatus();
82 
86  bool checkHardware();
87 
88 
89 
90 private:
91  bool isScanning;
92  int node_counts ;
93  double each_angle;
94  int show_error;
95 }; // End of class
96 
A struct for returning laser readings from the YDLIDAR.
Definition: ydlidar_driver.h:199
Definition: CYdLidar.h:21