rplidar_driver_impl.h
Go to the documentation of this file.
1 /*
2  * RPLIDAR SDK
3  *
4  * Copyright (c) 2009 - 2014 RoboPeak Team
5  * http://www.robopeak.com
6  * Copyright (c) 2014 - 2019 Shanghai Slamtec Co., Ltd.
7  * http://www.slamtec.com
8  *
9  */
10 /*
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  *
17  * 2. Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
25  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34 
35 #pragma once
36 
37 namespace rp { namespace standalone{ namespace rplidar {
39 {
40 public:
41 
42  virtual bool isConnected();
43  virtual u_result reset(_u32 timeout = DEFAULT_TIMEOUT);
45  virtual u_result getAllSupportedScanModes(std::vector<RplidarScanMode>& outModes, _u32 timeoutInMs = DEFAULT_TIMEOUT);
46  virtual u_result getTypicalScanMode(_u16& outMode, _u32 timeoutInMs = DEFAULT_TIMEOUT);
47  virtual u_result checkSupportConfigCommands(bool& outSupport, _u32 timeoutInMs = DEFAULT_TIMEOUT);
48 
49  virtual u_result getScanModeCount(_u16& modeCount, _u32 timeoutInMs = DEFAULT_TIMEOUT);
50  virtual u_result getLidarSampleDuration(float& sampleDurationRes, _u16 scanModeID, _u32 timeoutInMs = DEFAULT_TIMEOUT);
51  virtual u_result getMaxDistance(float &maxDistance, _u16 scanModeID, _u32 timeoutInMs = DEFAULT_TIMEOUT);
52  virtual u_result getScanModeAnsType(_u8 &ansType, _u16 scanModeID, _u32 timeoutInMs = DEFAULT_TIMEOUT);
53  virtual u_result getScanModeName(char* modeName, _u16 scanModeID, _u32 timeoutInMs = DEFAULT_TIMEOUT);
54  virtual u_result getLidarConf(_u32 type, std::vector<_u8> &outputBuf, const std::vector<_u8> &reserve = std::vector<_u8>(), _u32 timeout = DEFAULT_TIMEOUT);
55 
56  virtual u_result startScan(bool force, bool useTypicalScan, _u32 options = 0, RplidarScanMode* outUsedScanMode = NULL);
57  virtual u_result startScanExpress(bool force, _u16 scanMode, _u32 options = 0, RplidarScanMode* outUsedScanMode = NULL, _u32 timeout = DEFAULT_TIMEOUT);
58 
59 
60  virtual u_result getHealth(rplidar_response_device_health_t & health, _u32 timeout = DEFAULT_TIMEOUT);
61  virtual u_result getDeviceInfo(rplidar_response_device_info_t & info, _u32 timeout = DEFAULT_TIMEOUT);
62  virtual u_result getSampleDuration_uS(rplidar_response_sample_rate_t & rateInfo, _u32 timeout = DEFAULT_TIMEOUT);
63  virtual u_result setMotorPWM(_u16 pwm);
64  virtual u_result startMotor();
65  virtual u_result stopMotor();
66  virtual u_result checkMotorCtrlSupport(bool & support, _u32 timeout = DEFAULT_TIMEOUT);
67  virtual u_result getFrequency(bool inExpressMode, size_t count, float & frequency, bool & is4kmode);
68  virtual u_result getFrequency(const RplidarScanMode& scanMode, size_t count, float & frequency);
69  virtual u_result startScanNormal(bool force, _u32 timeout = DEFAULT_TIMEOUT);
70  virtual u_result checkExpressScanSupported(bool & support, _u32 timeout = DEFAULT_TIMEOUT);
71  virtual u_result stop(_u32 timeout = DEFAULT_TIMEOUT);
72  virtual u_result grabScanData(rplidar_response_measurement_node_t * nodebuffer, size_t & count, _u32 timeout = DEFAULT_TIMEOUT);
73  virtual u_result grabScanDataHq(rplidar_response_measurement_node_hq_t * nodebuffer, size_t & count, _u32 timeout = DEFAULT_TIMEOUT);
74  virtual u_result ascendScanData(rplidar_response_measurement_node_t * nodebuffer, size_t count);
75  virtual u_result ascendScanData(rplidar_response_measurement_node_hq_t * nodebuffer, size_t count);
76  virtual u_result getScanDataWithInterval(rplidar_response_measurement_node_t * nodebuffer, size_t & count);
78 
79 protected:
80 
81  virtual u_result _sendCommand(_u8 cmd, const void * payload = NULL, size_t payloadsize = 0);
82  void _disableDataGrabbing();
83 
84  virtual u_result _waitResponseHeader(rplidar_ans_header_t * header, _u32 timeout = DEFAULT_TIMEOUT);
85  virtual u_result _cacheScanData();
86  virtual u_result _waitScanData(rplidar_response_measurement_node_t * nodebuffer, size_t & count, _u32 timeout = DEFAULT_TIMEOUT);
87  virtual u_result _waitNode(rplidar_response_measurement_node_t * node, _u32 timeout = DEFAULT_TIMEOUT);
89  virtual u_result _waitCapsuledNode(rplidar_response_capsule_measurement_nodes_t & node, _u32 timeout = DEFAULT_TIMEOUT);
90  virtual void _capsuleToNormal(const rplidar_response_capsule_measurement_nodes_t & capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount);
91  virtual void _dense_capsuleToNormal(const rplidar_response_capsule_measurement_nodes_t & capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount);
92 
93  //FW1.23
95  virtual u_result _waitUltraCapsuledNode(rplidar_response_ultra_capsule_measurement_nodes_t & node, _u32 timeout = DEFAULT_TIMEOUT);
96  virtual void _ultraCapsuleToNormal(const rplidar_response_ultra_capsule_measurement_nodes_t & capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount);
97 
98  virtual u_result _cacheHqScanData();
99  virtual u_result _waitHqNode(rplidar_response_hq_capsule_measurement_nodes_t & node, _u32 timeout = DEFAULT_TIMEOUT);
100  virtual void _HqToNormal(const rplidar_response_hq_capsule_measurement_nodes_t & node_hq, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount);
101 
105 
108 
111 
115 
116  rplidar_response_capsule_measurement_nodes_t _cached_previous_capsuledata;
117  rplidar_response_dense_capsule_measurement_nodes_t _cached_previous_dense_capsuledata;
118  rplidar_response_ultra_capsule_measurement_nodes_t _cached_previous_ultracapsuledata;
119  rplidar_response_hq_capsule_measurement_nodes_t _cached_previous_Hqdata;
122 
123 
124 
128 
129 protected:
132 };
133 }}}
rplidar_response_measurement_node_hq_t node_hq[16]
Definition: rplidar_cmd.h:4
virtual void _capsuleToNormal(const rplidar_response_capsule_measurement_nodes_t &capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount)
rplidar_response_dense_capsule_measurement_nodes_t _cached_previous_dense_capsuledata
_u8 payload[0]
Definition: rplidar_cmd.h:3
virtual u_result checkSupportConfigCommands(bool &outSupport, _u32 timeoutInMs=DEFAULT_TIMEOUT)
virtual u_result _waitCapsuledNode(rplidar_response_capsule_measurement_nodes_t &node, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result startScanNormal(bool force, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result _waitResponseHeader(rplidar_ans_header_t *header, _u32 timeout=DEFAULT_TIMEOUT)
virtual void _dense_capsuleToNormal(const rplidar_response_capsule_measurement_nodes_t &capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount)
virtual u_result grabScanData(rplidar_response_measurement_node_t *nodebuffer, size_t &count, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result reset(_u32 timeout=DEFAULT_TIMEOUT)
virtual void _ultraCapsuleToNormal(const rplidar_response_ultra_capsule_measurement_nodes_t &capsule, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount)
virtual u_result _waitUltraCapsuledNode(rplidar_response_ultra_capsule_measurement_nodes_t &node, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result startScan(bool force, bool useTypicalScan, _u32 options=0, RplidarScanMode *outUsedScanMode=NULL)
rplidar_response_capsule_measurement_nodes_t _cached_previous_capsuledata
virtual u_result startScanExpress(bool force, _u16 scanMode, _u32 options=0, RplidarScanMode *outUsedScanMode=NULL, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result getLidarConf(_u32 type, std::vector< _u8 > &outputBuf, const std::vector< _u8 > &reserve=std::vector< _u8 >(), _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result grabScanDataHq(rplidar_response_measurement_node_hq_t *nodebuffer, size_t &count, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result getSampleDuration_uS(rplidar_response_sample_rate_t &rateInfo, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result getScanDataWithIntervalHq(rplidar_response_measurement_node_hq_t *nodebuffer, size_t &count)
virtual u_result _sendCommand(_u8 cmd, const void *payload=NULL, size_t payloadsize=0)
virtual u_result getHealth(rplidar_response_device_health_t &health, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result getScanModeName(char *modeName, _u16 scanModeID, _u32 timeoutInMs=DEFAULT_TIMEOUT)
uint8_t _u8
Definition: rptypes.h:63
virtual u_result startMotor()
Start RPLIDAR&#39;s motor when using accessory board.
virtual u_result stop(_u32 timeout=DEFAULT_TIMEOUT)
rplidar_response_measurement_node_hq_t _cached_scan_node_hq_buf[8192]
virtual u_result getTypicalScanMode(_u16 &outMode, _u32 timeoutInMs=DEFAULT_TIMEOUT)
Get typical scan mode of lidar.
virtual u_result getFrequency(bool inExpressMode, size_t count, float &frequency, bool &is4kmode)
virtual u_result _waitNode(rplidar_response_measurement_node_t *node, _u32 timeout=DEFAULT_TIMEOUT)
virtual bool isConnected()
Returns TRUE when the connection has been established.
virtual u_result ascendScanData(rplidar_response_measurement_node_t *nodebuffer, size_t count)
_u32 type
Definition: rplidar_cmd.h:2
rplidar_response_hq_capsule_measurement_nodes_t _cached_previous_Hqdata
virtual u_result getDeviceInfo(rplidar_response_device_info_t &info, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result getScanModeCount(_u16 &modeCount, _u32 timeoutInMs=DEFAULT_TIMEOUT)
virtual void _HqToNormal(const rplidar_response_hq_capsule_measurement_nodes_t &node_hq, rplidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount)
uint32_t _u32
Definition: rptypes.h:69
virtual u_result getAllSupportedScanModes(std::vector< RplidarScanMode > &outModes, _u32 timeoutInMs=DEFAULT_TIMEOUT)
Get all scan modes that supported by lidar.
virtual u_result getScanDataWithInterval(rplidar_response_measurement_node_t *nodebuffer, size_t &count)
virtual u_result checkExpressScanSupported(bool &support, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result _waitHqNode(rplidar_response_hq_capsule_measurement_nodes_t &node, _u32 timeout=DEFAULT_TIMEOUT)
virtual u_result getScanModeAnsType(_u8 &ansType, _u16 scanModeID, _u32 timeoutInMs=DEFAULT_TIMEOUT)
virtual u_result stopMotor()
Stop RPLIDAR&#39;s motor when using accessory board.
const std::string header
virtual u_result getLidarSampleDuration(float &sampleDurationRes, _u16 scanModeID, _u32 timeoutInMs=DEFAULT_TIMEOUT)
uint16_t _u16
Definition: rptypes.h:66
rplidar_response_measurement_node_hq_t _cached_scan_node_hq_buf_for_interval_retrieve[8192]
rplidar_response_ultra_capsule_measurement_nodes_t _cached_previous_ultracapsuledata
virtual u_result getMaxDistance(float &maxDistance, _u16 scanModeID, _u32 timeoutInMs=DEFAULT_TIMEOUT)
virtual u_result _waitScanData(rplidar_response_measurement_node_t *nodebuffer, size_t &count, _u32 timeout=DEFAULT_TIMEOUT)
uint32_t u_result
Definition: rptypes.h:100
virtual u_result checkMotorCtrlSupport(bool &support, _u32 timeout=DEFAULT_TIMEOUT)


rplidar_ros
Author(s):
autogenerated on Wed Mar 20 2019 07:54:15