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


rplidar_ros
Author(s):
autogenerated on Fri Aug 28 2015 12:46:43