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
00036
00037 #pragma once
00038
00039
00040 #ifndef __cplusplus
00041 #error "The RPlidar SDK requires a C++ compiler to be built"
00042 #endif
00043
00044 namespace rp { namespace standalone{ namespace rplidar {
00045
00046 class RPlidarDriver {
00047 public:
00048 enum {
00049 DEFAULT_TIMEOUT = 2000,
00050 };
00051
00052 enum {
00053 DRIVER_TYPE_SERIALPORT = 0x0,
00054 };
00055 public:
00060 static RPlidarDriver * CreateDriver(_u32 drivertype = DRIVER_TYPE_SERIALPORT);
00061
00064 static void DisposeDriver(RPlidarDriver * drv);
00065
00066
00067 public:
00079 virtual u_result connect(const char * port_path, _u32 baudrate, _u32 flag = 0) = 0;
00080
00081
00083 virtual void disconnect() = 0;
00084
00086 virtual bool isConnected() = 0;
00087
00091
00092 virtual u_result reset(_u32 timeout = DEFAULT_TIMEOUT) = 0;
00093
00100 virtual u_result getHealth(rplidar_response_device_health_t & health, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00101
00107 virtual u_result getDeviceInfo(rplidar_response_device_info_t & info, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00108
00109
00118
00119 virtual u_result getFrequency(rplidar_response_measurement_node_t * nodebuffer, size_t count, float & frequency) = 0;
00120
00128 virtual u_result startScan(bool force = false, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00129
00130
00134 virtual u_result stop(_u32 timeout = DEFAULT_TIMEOUT) = 0;
00135
00136
00154 virtual u_result grabScanData(rplidar_response_measurement_node_t * nodebuffer, size_t & count, _u32 timeout = DEFAULT_TIMEOUT) = 0;
00155
00163 virtual u_result ascendScanData(rplidar_response_measurement_node_t * nodebuffer, size_t count) = 0;
00164
00165 virtual u_result stopMotor() = 0;
00166 virtual u_result startMotor() = 0;
00167
00168 protected:
00169 RPlidarDriver() {}
00170 virtual ~RPlidarDriver() {}
00171 };
00172
00173
00174 }}}