#include <sl_lidar_driver_impl.h>
Public Types | |
enum | { LEGACY_SAMPLE_DURATION = 476 } |
enum | { NORMAL_CAPSULE = 0, DENSE_CAPSULE = 1 } |
enum | { A2A3_LIDAR_MINUM_MAJOR_ID = 2, TOF_LIDAR_MINUM_MAJOR_ID = 6 } |
![]() | |
enum | { DEFAULT_TIMEOUT = 2000 } |
Public Member Functions | |
sl_result | ascendScanData (sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t count) |
sl_result | ascendScanData (sl_lidar_response_measurement_node_t *nodebuffer, size_t count) |
sl_result | checkMotorCtrlSupport (MotorCtrlSupport &support, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | connect (IChannel *channel) |
DEPRECATED (sl_result grabScanData(sl_lidar_response_measurement_node_t *nodebuffer, size_t &count, sl_u32 timeout=DEFAULT_TIMEOUT)) | |
void | disconnect () |
sl_result | getAllSupportedScanModes (std::vector< LidarScanMode > &outModes, sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
Get all scan modes that supported by lidar. More... | |
sl_result | getDeviceInfo (sl_lidar_response_device_info_t &info, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | getDeviceMacAddr (sl_u8 *macAddrArray, sl_u32 timeoutInMs) |
sl_result | getFrequency (const LidarScanMode &scanMode, const sl_lidar_response_measurement_node_hq_t *nodes, size_t count, float &frequency) |
sl_result | getHealth (sl_lidar_response_device_health_t &health, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | getLidarIpConf (sl_lidar_ip_conf_t &conf, sl_u32 timeout) |
sl_result | getScanDataWithIntervalHq (sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &count) |
sl_result | getTypicalScanMode (sl_u16 &outMode, sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
Get typical scan mode of lidar. More... | |
sl_result | grabScanDataHq (sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &count, sl_u32 timeout=DEFAULT_TIMEOUT) |
bool | isConnected () |
sl_result | negotiateSerialBaudRate (sl_u32 requiredBaudRate, sl_u32 *baudRateDetected=NULL) |
sl_result | reset (sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
sl_result | setLidarIpConf (const sl_lidar_ip_conf_t &conf, sl_u32 timeout) |
sl_result | setMotorSpeed (sl_u16 speed=DEFAULT_MOTOR_PWM) |
SL_LidarDriver () | |
sl_result | startScan (bool force, bool useTypicalScan, sl_u32 options=0, LidarScanMode *outUsedScanMode=nullptr) |
sl_result | startScanExpress (bool force, sl_u16 scanMode, sl_u32 options=0, LidarScanMode *outUsedScanMode=nullptr, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | startScanNormal (bool force, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | stop (sl_u32 timeout=DEFAULT_TIMEOUT) |
![]() | |
virtual LIDARMajorType | getLIDARMajorType (const sl_lidar_response_device_info_t *devInfo=nullptr)=0 |
virtual LIDARTechnologyType | getLIDARTechnologyType (const sl_lidar_response_device_info_t *devInfo=nullptr)=0 |
virtual sl_result | getModelNameDescriptionString (std::string &out_description, bool fetchAliasName=true, const sl_lidar_response_device_info_t *devInfo=nullptr, sl_u32 timeout=DEFAULT_TIMEOUT)=0 |
virtual sl_result | getMotorInfo (LidarMotorInfo &motorInfo, sl_u32 timeoutInMs=DEFAULT_TIMEOUT)=0 |
virtual sl_result | grabScanDataHqWithTimeStamp (sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &count, sl_u64 ×tamp_uS, sl_u32 timeout=DEFAULT_TIMEOUT)=0 |
virtual | ~ILidarDriver () |
Protected Member Functions | |
sl_result | checkSupportConfigCommands (bool &outSupport, sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
sl_result | getLidarConf (sl_u32 type, std::vector< sl_u8 > &outputBuf, const std::vector< sl_u8 > &reserve=std::vector< sl_u8 >(), sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | getLidarSampleDuration (float &sampleDurationRes, sl_u16 scanModeID, sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
sl_result | getMaxDistance (float &maxDistance, sl_u16 scanModeID, sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
sl_result | getScanModeAnsType (sl_u8 &ansType, sl_u16 scanModeID, sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
sl_result | getScanModeCount (sl_u16 &modeCount, sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
sl_result | getScanModeName (char *modeName, sl_u16 scanModeID, sl_u32 timeoutInMs=DEFAULT_TIMEOUT) |
sl_result | setLidarConf (sl_u32 type, const void *payload, size_t payloadSize, sl_u32 timeout) |
sl_result | startMotor () |
Private Member Functions | |
sl_result | _cacheCapsuledScanData () |
sl_result | _cacheHqScanData () |
sl_result | _cacheScanData () |
sl_result | _cacheUltraCapsuledScanData () |
sl_result | _cacheUltraDenseCapsuledScanData () |
void | _capsuleToNormal (const sl_lidar_response_capsule_measurement_nodes_t &capsule, sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount) |
sl_result | _clearRxDataCache () |
void | _dense_capsuleToNormal (const sl_lidar_response_capsule_measurement_nodes_t &capsule, sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount) |
void | _disableDataGrabbing () |
void | _HqToNormal (const sl_lidar_response_hq_capsule_measurement_nodes_t &node_hq, sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount) |
sl_result | _sendCommand (sl_u16 cmd, const void *payload=NULL, size_t payloadsize=0) |
void | _ultra_dense_capsuleToNormal (const sl_lidar_response_ultra_dense_capsule_measurement_nodes_t &capslue, sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount) |
void | _ultraCapsuleToNormal (const sl_lidar_response_ultra_capsule_measurement_nodes_t &capsule, sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &nodeCount) |
sl_result | _waitCapsuledNode (sl_lidar_response_capsule_measurement_nodes_t &node, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | _waitHqNode (sl_lidar_response_hq_capsule_measurement_nodes_t &node, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | _waitNode (sl_lidar_response_measurement_node_t *node, sl_u32 timeout=DEFAULT_TIMEOUT) |
template<typename T > | |
sl_result | _waitResponse (T &payload, sl_u8 ansType, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | _waitResponseHeader (sl_lidar_ans_header_t *header, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | _waitScanData (sl_lidar_response_measurement_node_t *nodebuffer, size_t &count, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | _waitUltraCapsuledNode (sl_lidar_response_ultra_capsule_measurement_nodes_t &node, sl_u32 timeout=DEFAULT_TIMEOUT) |
sl_result | _waitUltraDenseCapsuledNode (sl_lidar_response_ultra_dense_capsule_measurement_nodes_t &node, sl_u32 timeout=DEFAULT_TIMEOUT) |
Private Attributes | |
sl_u8 | _cached_capsule_flag |
sl_lidar_response_capsule_measurement_nodes_t | _cached_previous_capsuledata |
sl_lidar_response_dense_capsule_measurement_nodes_t | _cached_previous_dense_capsuledata |
sl_lidar_response_hq_capsule_measurement_nodes_t | _cached_previous_Hqdata |
sl_lidar_response_ultra_capsule_measurement_nodes_t | _cached_previous_ultracapsuledata |
sl_u16 | _cached_sampleduration_express |
sl_u16 | _cached_sampleduration_std |
sl_lidar_response_measurement_node_hq_t | _cached_scan_node_hq_buf [8192] |
sl_lidar_response_measurement_node_hq_t | _cached_scan_node_hq_buf_for_interval_retrieve [8192] |
size_t | _cached_scan_node_hq_count |
size_t | _cached_scan_node_hq_count_for_interval_retrieve |
rp::hal::Thread | _cachethread |
IChannel * | _channel |
rp::hal::Event | _dataEvt |
bool | _is_previous_capsuledataRdy |
bool | _is_previous_HqdataRdy |
bool | _isConnected |
bool | _isScanning |
MotorCtrlSupport | _isSupportingMotorCtrl |
rp::hal::Locker | _lock |
Definition at line 36 of file sl_lidar_driver_impl.h.
anonymous enum |
Enumerator | |
---|---|
LEGACY_SAMPLE_DURATION |
Definition at line 39 of file sl_lidar_driver_impl.h.
anonymous enum |
Enumerator | |
---|---|
NORMAL_CAPSULE | |
DENSE_CAPSULE |
Definition at line 43 of file sl_lidar_driver_impl.h.
anonymous enum |
Enumerator | |
---|---|
A2A3_LIDAR_MINUM_MAJOR_ID | |
TOF_LIDAR_MINUM_MAJOR_ID |
Definition at line 49 of file sl_lidar_driver_impl.h.
|
inline |
Definition at line 54 of file sl_lidar_driver_impl.h.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
virtual |
Ascending the scan data according to the angle value in the scan.
nodebuffer | Buffer provided by the caller application to do the reorder. Should be retrived from the grabScanData |
count | The caller must initialize this parameter to set the max data count of the provided buffer (in unit of rplidar_response_measurement_node_t). Once the interface returns, this parameter will store the actual received data count. The interface will return SL_RESULT_OPERATION_FAIL when all the scan data is invalid. |
Implements sl::ILidarDriver.
sl_result sl::SL_LidarDriver::ascendScanData | ( | sl_lidar_response_measurement_node_t * | nodebuffer, |
size_t | count | ||
) |
|
virtual |
Check whether the device support motor control Note: this API will disable grab.
motorCtrlSupport | Return the result. |
timeout | The operation timeout value (in millisecond) for the serial port communication. |
Implements sl::ILidarDriver.
|
protected |
Connect to LIDAR via channel
channel | The communication channel Note: you should manage the lifecycle of the channel object, make sure it is alive during lidar driver's lifecycle |
Implements sl::ILidarDriver.
sl::SL_LidarDriver::DEPRECATED | ( | sl_result | grabScanDatasl_lidar_response_measurement_node_t *nodebuffer, size_t &count, sl_u32 timeout=DEFAULT_TIMEOUT | ) |
|
virtual |
Disconnect from the LIDAR
Implements sl::ILidarDriver.
|
virtual |
Get all scan modes that supported by lidar.
Implements sl::ILidarDriver.
|
virtual |
Get the device information of the RPLIDAR include the serial number, firmware version, device model etc.
info | The device information returned from the RPLIDAR |
timeout | The operation timeout value (in millisecond) for the serial port communication |
Implements sl::ILidarDriver.
|
virtual |
Get LPX series lidar's MAC address
macAddrArray | The device MAC information returned from the LPX series lidar Notice: the macAddrArray must point to a valid buffer with at least 6 bytes length Otherwise, buffer overwrite will occur |
Implements sl::ILidarDriver.
|
virtual |
Calculate LIDAR's current scanning frequency from the given scan data Please refer to the application note doc for details Remark: the calcuation will be incorrect if the specified scan data doesn't contains enough data
scanMode | Lidar's current scan mode |
nodes | Current scan's measurements |
count | The number of sample nodes inside the given buffer |
Implements sl::ILidarDriver.
|
virtual |
Retrieve the health status of the RPLIDAR The host system can use this operation to check whether RPLIDAR is in the self-protection mode.
health | The health status info returned from the RPLIDAR |
timeout | The operation timeout value (in millisecond) for the serial port communication |
Implements sl::ILidarDriver.
|
protected |
|
virtual |
Get LPX and S2E series lidar's static IP address
conf | Network parameter that LPX series lidar owned |
timeout | The operation timeout value (in millisecond) for the ethernet udp communication |
Implements sl::ILidarDriver.
|
protected |
|
protected |
|
virtual |
Return received scan points even if it's not complete scan
nodebuffer | Buffer provided by the caller application to store the scan data |
count | Once the interface returns, this parameter will store the actual received data count. |
The interface will return SL_RESULT_OPERATION_TIMEOUT to indicate that not even a single node can be retrieved since last call.
Implements sl::ILidarDriver.
|
protected |
|
protected |
|
protected |
|
virtual |
Get typical scan mode of lidar.
Implements sl::ILidarDriver.
|
virtual |
Wait and grab a complete 0-360 degree scan data previously received. The grabbed scan data returned by this interface always has the following charactistics:
1) The first node of the grabbed data array (nodebuffer[0]) must be the first sample of a scan, i.e. the start_bit == 1 2) All data nodes are belong to exactly ONE complete 360-degrees's scan 3) Note, the angle data in one scan may not be ascending. You can use API ascendScanData to reorder the nodebuffer.
nodebuffer | Buffer provided by the caller application to store the scan data |
count | The caller must initialize this parameter to set the max data count of the provided buffer (in unit of rplidar_response_measurement_node_t). Once the interface returns, this parameter will store the actual received data count. |
timeout | Max duration allowed to wait for a complete scan data, nothing will be stored to the nodebuffer if a complete 360-degrees' scan data cannot to be ready timely. |
The interface will return SL_RESULT_OPERATION_TIMEOUT to indicate that no complete 360-degrees' scan can be retrieved withing the given timeout duration.
\The caller application can set the timeout value to Zero(0) to make this interface always returns immediately to achieve non-block operation.
Implements sl::ILidarDriver.
|
virtual |
Check if the connection is established
Implements sl::ILidarDriver.
|
virtual |
Ask the LIDAR to use a new baudrate for serial communication The target LIDAR system must support such feature to work. This function does NOT check whether the target LIDAR works with the requiredBaudRate or not. In order to verifiy the result, use getDeviceInfo or other getXXXX functions instead.
requiredBaudRate | The new baudrate required to be used. It MUST matches with the baudrate of the binded channel. |
baudRateDetected | The actual baudrate detected by the LIDAR system |
Implements sl::ILidarDriver.
|
virtual |
Ask the LIDAR core system to reset it self The host system can use the Reset operation to help LIDAR escape the self-protection mode.
timeout | The operation timeout value (in millisecond) |
Implements sl::ILidarDriver.
|
protected |
|
virtual |
Set LPX and S2E series lidar's static IP address
conf | Network parameter that LPX series lidar owned |
timeout | The operation timeout value (in millisecond) for the ethernet udp communication |
Implements sl::ILidarDriver.
|
virtual |
Set lidar motor speed The host system can use this operation to set lidar motor speed.
speed | The speed value set to lidar |
Note: The function will stop scan if speed is DEFAULT_MOTOR_SPEED.
Implements sl::ILidarDriver.
|
protected |
|
virtual |
Start scan
force | Force the core system to output scan data regardless whether the scanning motor is rotating or not. |
useTypicalScan | Use lidar's typical scan mode or use the compatibility mode (2k sps) |
options | Scan options (please use 0) |
outUsedScanMode | The scan mode selected by lidar |
Implements sl::ILidarDriver.
|
virtual |
Start scan in specific mode
force | Force the core system to output scan data regardless whether the scanning motor is rotating or not. |
scanMode | The scan mode id (use getAllSupportedScanModes to get supported modes) |
options | Scan options (please use 0) |
outUsedScanMode | The scan mode selected by lidar |
Implements sl::ILidarDriver.
sl_result sl::SL_LidarDriver::startScanNormal | ( | bool | force, |
sl_u32 | timeout = DEFAULT_TIMEOUT |
||
) |
|
virtual |
Ask the LIDAR core system to stop the current scan operation and enter idle state. The background thread will be terminated
timeout | The operation timeout value (in millisecond) for the serial port communication |
Implements sl::ILidarDriver.
|
private |
Definition at line 144 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 149 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 150 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 152 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 151 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 140 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 139 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 142 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 146 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 143 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 147 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 138 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 131 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 137 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 153 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 154 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 132 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 133 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 134 of file sl_lidar_driver_impl.h.
|
private |
Definition at line 136 of file sl_lidar_driver_impl.h.