Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #pragma once
00036
00037
00038 #ifndef __cplusplus
00039 #error "The RPlidar SDK requires a C++ compiler to be built"
00040 #endif
00041
00042 namespace rp { namespace standalone{ namespace rplidar {
00043
00044 class RPlidarDriver {
00045 public:
00046 enum {
00047 DEFAULT_TIMEOUT = 2000,
00048 };
00049
00050 enum {
00051 DRIVER_TYPE_SERIALPORT = 0x0,
00052 };
00053 public:
00058 static RPlidarDriver * CreateDriver(_u32 drivertype = DRIVER_TYPE_SERIALPORT);
00059
00062 static void DisposeDriver(RPlidarDriver * drv);
00063
00064
00065 public:
00077 virtual u_result connect(const char * port_path, _u32 baudrate, _u32 flag = 0) = 0;
00078
00079
00081 virtual void disconnect() = 0;
00082
00084 virtual bool isConnected() = 0;
00085
00089
00090 virtual u_result reset(_u32 timeout = DEFAULT_TIMEOUT) = 0;
00091
00098 virtual u_result getHealth(rplidar_response_device_health_t & health, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00099
00105 virtual u_result getDeviceInfo(rplidar_response_device_info_t & info, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00106
00112 virtual u_result getSampleDuration_uS(rplidar_response_sample_rate_t & rateInfo, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00113
00117 virtual u_result setMotorPWM(_u16 pwm) = 0;
00118
00120 virtual u_result startMotor() = 0;
00121
00123 virtual u_result stopMotor() = 0;
00124
00131 virtual u_result checkMotorCtrlSupport(bool & support, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00132
00144 virtual u_result getFrequency(bool inExpressMode, size_t count, float & frequency, bool & is4kmode) = 0;
00145
00155 virtual u_result startScan(bool force = false, bool autoExpressMode = true) = 0;
00156 virtual u_result startScanNormal(bool force, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00157 virtual u_result startScanExpress(bool fixedAngle, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00158
00164 virtual u_result checkExpressScanSupported(bool & support, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00165
00169 virtual u_result stop(_u32 timeout = DEFAULT_TIMEOUT) = 0;
00170
00171
00189 virtual u_result grabScanData(rplidar_response_measurement_node_t * nodebuffer, size_t & count, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00190
00198 virtual u_result ascendScanData(rplidar_response_measurement_node_t * nodebuffer, size_t count) = 0;
00199
00200 protected:
00201 RPlidarDriver() {}
00202 virtual ~RPlidarDriver() {}
00203 };
00204
00205
00206 }}}