rplidar_driver.h
Go to the documentation of this file.
00001 /*
00002  *  RPLIDAR SDK
00003  *
00004  *  Copyright (c) 2009 - 2014 RoboPeak Team
00005  *  http://www.robopeak.com
00006  *  Copyright (c) 2014 - 2016 Shanghai Slamtec Co., Ltd.
00007  *  http://www.slamtec.com
00008  *
00009  */
00010 /*
00011  * Redistribution and use in source and binary forms, with or without 
00012  * modification, are permitted provided that the following conditions are met:
00013  *
00014  * 1. Redistributions of source code must retain the above copyright notice, 
00015  *    this list of conditions and the following disclaimer.
00016  *
00017  * 2. Redistributions in binary form must reproduce the above copyright notice, 
00018  *    this list of conditions and the following disclaimer in the documentation 
00019  *    and/or other materials provided with the distribution.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00023  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
00024  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
00025  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
00026  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
00027  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
00028  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
00029  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
00030  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
00031  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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, //2000 ms
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     //  \param timeout       The operation timeout value (in millisecond) for the serial port communication                     
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 }}}


rplidar_ros
Author(s):
autogenerated on Fri Dec 16 2016 03:59:16