node.cpp
Go to the documentation of this file.
1 /*
2  * RPLIDAR ROS NODE
3  *
4  * Copyright (c) 2009 - 2014 RoboPeak Team
5  * http://www.robopeak.com
6  * Copyright (c) 2014 - 2016 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 #include "ros/ros.h"
36 #include "sensor_msgs/LaserScan.h"
37 #include "std_srvs/Empty.h"
38 #include "sl_lidar.h"
39 
40 #ifndef _countof
41 #define _countof(_Array) (int)(sizeof(_Array) / sizeof(_Array[0]))
42 #endif
43 
44 #define DEG2RAD(x) ((x)*M_PI/180.)
45 #define RESET_TIMEOUT 15 // 15 second
46 
47 enum {
51 };
52 using namespace sl;
53 
54 ILidarDriver * drv = NULL;
55 
58  size_t node_count, ros::Time start,
59  double scan_time, bool inverted,
60  float angle_min, float angle_max,
61  float max_distance,
62  std::string frame_id)
63 {
64  static int scan_count = 0;
65  sensor_msgs::LaserScan scan_msg;
66 
67  scan_msg.header.stamp = start;
68  scan_msg.header.frame_id = frame_id;
69  scan_count++;
70 
71  bool reversed = (angle_max > angle_min);
72  if ( reversed ) {
73  scan_msg.angle_min = M_PI - angle_max;
74  scan_msg.angle_max = M_PI - angle_min;
75  } else {
76  scan_msg.angle_min = M_PI - angle_min;
77  scan_msg.angle_max = M_PI - angle_max;
78  }
79  scan_msg.angle_increment =
80  (scan_msg.angle_max - scan_msg.angle_min) / (double)(node_count-1);
81 
82  scan_msg.scan_time = scan_time;
83  scan_msg.time_increment = scan_time / (double)(node_count-1);
84  scan_msg.range_min = 0.15;
85  scan_msg.range_max = max_distance;//8.0;
86 
87  scan_msg.intensities.resize(node_count);
88  scan_msg.ranges.resize(node_count);
89  bool reverse_data = (!inverted && reversed) || (inverted && !reversed);
90  if (!reverse_data) {
91  for (size_t i = 0; i < node_count; i++) {
92  float read_value = (float) nodes[i].dist_mm_q2/4.0f/1000;
93  if (read_value == 0.0)
94  scan_msg.ranges[i] = std::numeric_limits<float>::infinity();
95  else
96  scan_msg.ranges[i] = read_value;
97  scan_msg.intensities[i] = (float) (nodes[i].quality >> 2);
98  }
99  } else {
100  for (size_t i = 0; i < node_count; i++) {
101  float read_value = (float)nodes[i].dist_mm_q2/4.0f/1000;
102  if (read_value == 0.0)
103  scan_msg.ranges[node_count-1-i] = std::numeric_limits<float>::infinity();
104  else
105  scan_msg.ranges[node_count-1-i] = read_value;
106  scan_msg.intensities[node_count-1-i] = (float) (nodes[i].quality >> 2);
107  }
108  }
109 
110  pub->publish(scan_msg);
111 }
112 
114 {
115  sl_result op_result;
116  sl_lidar_response_device_info_t devinfo;
117 
118  op_result = drv->getDeviceInfo(devinfo);
119  if (SL_IS_FAIL(op_result)) {
120  if (op_result == SL_RESULT_OPERATION_TIMEOUT) {
121  ROS_ERROR("Error, operation time out. RESULT_OPERATION_TIMEOUT! ");
122  } else {
123  ROS_ERROR("Error, unexpected error, code: %x",op_result);
124  }
125  return false;
126  }
127 
128  // print out the device serial number, firmware and hardware version number..
129  char sn_str[35] = {0};
130  for (int pos = 0; pos < 16 ;++pos) {
131  sprintf(sn_str + (pos * 2),"%02X", devinfo.serialnum[pos]);
132  }
133  char mode_str[16] = {0};
134  if((devinfo.model>>4) <= LIDAR_S_SERIES_MINUM_MAJOR_ID){
135  sprintf(mode_str,"A%dM%d",(devinfo.model>>4),(devinfo.model&0xf));
136 
137  }else if((devinfo.model>>4) <= LIDAR_T_SERIES_MINUM_MAJOR_ID){
138  sprintf(mode_str,"S%dM%d",(devinfo.model>>4)-LIDAR_S_SERIES_MINUM_MAJOR_ID,(devinfo.model&0xf));
139  }else{
140  sprintf(mode_str,"T%dM%d",(devinfo.model>>4)-LIDAR_T_SERIES_MINUM_MAJOR_ID,(devinfo.model&0xf));
141 
142  }
143  ROS_INFO("RPLIDAR MODE:%s",mode_str);
144  ROS_INFO("RPLIDAR S/N: %s",sn_str);
145  ROS_INFO("Firmware Ver: %d.%02d",devinfo.firmware_version>>8, devinfo.firmware_version & 0xFF);
146  ROS_INFO("Hardware Rev: %d",(int)devinfo.hardware_version);
147  return true;
148 }
149 
151 {
152  sl_result op_result;
153  op_result = drv->reset();
154  if (SL_IS_OK(op_result)) {
155  return true;
156  } else {
157  ROS_ERROR("Error, cannot reset rplidar: %x", op_result);
158  return false;
159  }
160 }
161 
163 {
164  sl_result op_result;
165  sl_lidar_response_device_health_t healthinfo;
166 
167  op_result = drv->getHealth(healthinfo);
168  if (SL_IS_OK(op_result)) {
169  //ROS_INFO("RPLidar health status : %d", healthinfo.status);
170  switch (healthinfo.status) {
171  case SL_LIDAR_STATUS_OK:
172  ROS_INFO("RPLidar health status : OK.");
173  return true;
175  ROS_INFO("RPLidar health status : Warning.");
176  return true;
178  ROS_ERROR("Error, rplidar internal error detected. Please reboot the device to retry.");
179  return false;
180  default:
181  ROS_ERROR("Error, Unknown internal error detected. Please reboot the device to retry.");
182  return false;
183  }
184  } else {
185  ROS_ERROR("Error, cannot retrieve rplidar health code: %x", op_result);
186  return false;
187  }
188 }
189 
190 bool stop_motor(std_srvs::Empty::Request &req,
191  std_srvs::Empty::Response &res)
192 {
193  if(!drv)
194  return false;
195 
196  ROS_DEBUG("Stop motor");
197  drv->setMotorSpeed(0);
198  return true;
199 }
200 
201 bool start_motor(std_srvs::Empty::Request &req,
202  std_srvs::Empty::Response &res)
203 {
204  if(!drv)
205  return false;
206  if(drv->isConnected())
207  {
208  ROS_DEBUG("Start motor");
209  sl_result ans=drv->setMotorSpeed();
210 
211  ans=drv->startScan(0,1);
212  }
213  else ROS_INFO("lost connection");
214  return true;
215 }
216 
218 {
219  return node.angle_z_q14 * 90.f / 16384.f;
220 }
221 
222 int main(int argc, char * argv[]) {
223  ros::init(argc, argv, "rplidar_node");
224 
225  std::string channel_type;
226  std::string tcp_ip;
227  int tcp_port = 20108;
228  std::string udp_ip;
229  int udp_port = 8089;
230  std::string serial_port;
231  int serial_baudrate = 115200;
232  std::string frame_id;
233  bool inverted = false;
234  bool initial_reset = false;
235  bool angle_compensate = true;
236  float angle_compensate_multiple = 1.0;//min 360 ponits at per 1 degree
237  int points_per_circle = 360;//min 360 ponits at per circle
238  std::string scan_mode;
239  float max_distance;
240  double scan_frequency;
241  ros::NodeHandle nh;
242  ros::Publisher scan_pub = nh.advertise<sensor_msgs::LaserScan>("scan", 1000);
243  ros::NodeHandle nh_private("~");
244  nh_private.param<std::string>("channel_type", channel_type, "serial");
245  nh_private.param<std::string>("tcp_ip", tcp_ip, "192.168.0.7");
246  nh_private.param<int>("tcp_port", tcp_port, 20108);
247  nh_private.param<std::string>("udp_ip", udp_ip, "192.168.11.2");
248  nh_private.param<int>("udp_port", udp_port, 8089);
249  nh_private.param<std::string>("serial_port", serial_port, "/dev/ttyUSB0");
250  nh_private.param<int>("serial_baudrate", serial_baudrate, 115200/*256000*/);//ros run for A1 A2, change to 256000 if A3
251  nh_private.param<std::string>("frame_id", frame_id, "laser_frame");
252  nh_private.param<bool>("inverted", inverted, false);
253  nh_private.param<bool>("initial_reset", initial_reset, false);
254  nh_private.param<bool>("angle_compensate", angle_compensate, false);
255  nh_private.param<std::string>("scan_mode", scan_mode, std::string());
256  if(channel_type == "udp"){
257  nh_private.param<double>("scan_frequency", scan_frequency, 20.0);
258  }
259  else{
260  nh_private.param<double>("scan_frequency", scan_frequency, 10.0);
261  }
262 
263  int ver_major = SL_LIDAR_SDK_VERSION_MAJOR;
264  int ver_minor = SL_LIDAR_SDK_VERSION_MINOR;
265  int ver_patch = SL_LIDAR_SDK_VERSION_PATCH;
266  ROS_INFO("RPLIDAR running on ROS package rplidar_ros, SDK Version:%d.%d.%d",ver_major,ver_minor,ver_patch);
267 
268  sl_result op_result;
269 
270  // create the driver instance
271  drv = *createLidarDriver();
272  IChannel* _channel;
273  if(channel_type == "tcp"){
274  _channel = *createTcpChannel(tcp_ip, tcp_port);
275  }
276  else if(channel_type == "udp"){
277  _channel = *createUdpChannel(udp_ip, udp_port);
278  }
279  else{
280  _channel = *createSerialPortChannel(serial_port, serial_baudrate);
281  }
282  if (SL_IS_FAIL((drv)->connect(_channel))) {
283  if(channel_type == "tcp"){
284  ROS_ERROR("Error, cannot connect to the ip addr %s with the tcp port %s.",tcp_ip.c_str(),std::to_string(tcp_port).c_str());
285  }
286  else if(channel_type == "udp"){
287  ROS_ERROR("Error, cannot connect to the ip addr %s with the udp port %s.",udp_ip.c_str(),std::to_string(udp_port).c_str());
288  }
289  else{
290  ROS_ERROR("Error, cannot bind to the specified serial port %s.",serial_port.c_str());
291  }
292  delete drv;
293  return -1;
294  }
295  // get rplidar device info
297  delete drv;
298  return -1;
299  }
300  if(initial_reset) {
301  ROS_INFO("Resetting rplidar");
302  if (!resetRPLIDAR(drv)) {
303  delete drv;
304  ROS_ERROR("Error resetting rplidar");
305  return -1;
306  } else {
307  // wait for the rplidar to reset
308  ros::Time last_time = ros::Time::now();
309  while (!getRPLIDARDeviceInfo(drv))
310  {
311  ros::Duration(0.5).sleep();
312  if ( (ros::Time::now() - last_time) > ros::Duration(RESET_TIMEOUT) )
313  {
314  delete drv;
315  ROS_ERROR("Error resetting rplidar");
316  return -1;
317  }
318  }
319 
320  ROS_INFO("Rplidar reset successfully");
321  }
322  }
323  if (!checkRPLIDARHealth(drv)) {
324  delete drv;
325  return -1;
326  }
327 
328 
329  sl_lidar_response_device_info_t devinfo;
330  op_result = drv->getDeviceInfo(devinfo);
331  bool scan_frequency_tunning_after_scan = false;
332 
333  if( (devinfo.model>>4) > LIDAR_S_SERIES_MINUM_MAJOR_ID){
334  scan_frequency_tunning_after_scan = true;
335  }
336  //two service for start/stop lidar rotate
337  ros::ServiceServer stop_motor_service = nh.advertiseService("stop_motor", stop_motor);
338  ros::ServiceServer start_motor_service = nh.advertiseService("start_motor", start_motor);
339 
340  if(!scan_frequency_tunning_after_scan){ //for RPLIDAR A serials
341  //start RPLIDAR A serials rotate by pwm
342  drv->setMotorSpeed(600);
343  }
344 
345 
346  LidarScanMode current_scan_mode;
347  if (scan_mode.empty()) {
348  op_result = drv->startScan(false /* not force scan */, true /* use typical scan mode */, 0, &current_scan_mode);
349  } else {
350  std::vector<LidarScanMode> allSupportedScanModes;
351  op_result = drv->getAllSupportedScanModes(allSupportedScanModes);
352 
353  if (SL_IS_OK(op_result)) {
354  sl_u16 selectedScanMode = sl_u16(-1);
355  for (std::vector<LidarScanMode>::iterator iter = allSupportedScanModes.begin(); iter != allSupportedScanModes.end(); iter++) {
356  if (iter->scan_mode == scan_mode) {
357  selectedScanMode = iter->id;
358  break;
359  }
360  }
361 
362  if (selectedScanMode == sl_u16(-1)) {
363  ROS_ERROR("scan mode `%s' is not supported by lidar, supported modes:", scan_mode.c_str());
364  for (std::vector<LidarScanMode>::iterator iter = allSupportedScanModes.begin(); iter != allSupportedScanModes.end(); iter++) {
365  ROS_ERROR("\t%s: max_distance: %.1f m, Point number: %.1fK", iter->scan_mode,
366  iter->max_distance, (1000/iter->us_per_sample));
367  }
368  op_result = SL_RESULT_OPERATION_FAIL;
369  } else {
370  op_result = drv->startScanExpress(false /* not force scan */, selectedScanMode, 0, &current_scan_mode);
371  }
372  }
373  }
374 
375  if(SL_IS_OK(op_result))
376  {
377  //default frequent is 10 hz (by motor pwm value), current_scan_mode.us_per_sample is the number of scan point per us
378  points_per_circle = (int)(1000*1000/current_scan_mode.us_per_sample/scan_frequency);
379  angle_compensate_multiple = points_per_circle/360.0 + 1;
380  if(angle_compensate_multiple < 1)
381  angle_compensate_multiple = 1.0;
382  max_distance = (float)current_scan_mode.max_distance;
383  ROS_INFO("current scan mode: %s, sample rate: %d Khz, max_distance: %.1f m, scan frequency:%.1f Hz, ", current_scan_mode.scan_mode,(int)(1000/current_scan_mode.us_per_sample+0.5),max_distance, scan_frequency);
384  }
385  else
386  {
387  ROS_ERROR("Can not start scan: %08x!", op_result);
388  }
389 
390  ros::Time start_scan_time;
391  ros::Time end_scan_time;
392  double scan_duration;
393 
394 
395  while (ros::ok()) {
397  size_t count = _countof(nodes);
398 
399  start_scan_time = ros::Time::now();
400  op_result = drv->grabScanDataHq(nodes, count);
401  end_scan_time = ros::Time::now();
402  scan_duration = (end_scan_time - start_scan_time).toSec();
403 
404  if (op_result == SL_RESULT_OK) {
405  if(scan_frequency_tunning_after_scan){ //Set scan frequency(For Slamtec Tof lidar)
406  ROS_INFO("set lidar scan frequency to %.1f Hz(%.1f Rpm) ",scan_frequency,scan_frequency*60);
407  drv->setMotorSpeed(scan_frequency*60); //rpm
408  scan_frequency_tunning_after_scan = false;
409  continue;
410  }
411  op_result = drv->ascendScanData(nodes, count);
412  float angle_min = DEG2RAD(0.0f);
413  float angle_max = DEG2RAD(360.0f);
414  if (op_result == SL_RESULT_OK) {
415  if (angle_compensate) {
416  const int angle_compensate_nodes_count = 360*angle_compensate_multiple;
417  int angle_compensate_offset = 0;
418  sl_lidar_response_measurement_node_hq_t angle_compensate_nodes[angle_compensate_nodes_count];
419  memset(angle_compensate_nodes, 0, angle_compensate_nodes_count*sizeof(sl_lidar_response_measurement_node_hq_t));
420 
421  int i = 0, j = 0;
422  for( ; i < count; i++ ) {
423  if (nodes[i].dist_mm_q2 != 0) {
424  float angle = getAngle(nodes[i]);
425  int angle_value = (int)(angle * angle_compensate_multiple);
426  if ((angle_value - angle_compensate_offset) < 0) angle_compensate_offset = angle_value;
427  for (j = 0; j < angle_compensate_multiple; j++) {
428 
429  int angle_compensate_nodes_index = angle_value-angle_compensate_offset+j;
430  if(angle_compensate_nodes_index >= angle_compensate_nodes_count)
431  angle_compensate_nodes_index = angle_compensate_nodes_count-1;
432  angle_compensate_nodes[angle_compensate_nodes_index] = nodes[i];
433  }
434  }
435  }
436 
437  publish_scan(&scan_pub, angle_compensate_nodes, angle_compensate_nodes_count,
438  start_scan_time, scan_duration, inverted,
439  angle_min, angle_max, max_distance,
440  frame_id);
441  } else {
442  int start_node = 0, end_node = 0;
443  int i = 0;
444  // find the first valid node and last valid node
445  while (nodes[i++].dist_mm_q2 == 0);
446  start_node = i-1;
447  i = count -1;
448  while (nodes[i--].dist_mm_q2 == 0);
449  end_node = i+1;
450 
451  angle_min = DEG2RAD(getAngle(nodes[start_node]));
452  angle_max = DEG2RAD(getAngle(nodes[end_node]));
453 
454  publish_scan(&scan_pub, &nodes[start_node], end_node-start_node +1,
455  start_scan_time, scan_duration, inverted,
456  angle_min, angle_max, max_distance,
457  frame_id);
458  }
459  } else if (op_result == SL_RESULT_OPERATION_FAIL) {
460  // All the data is invalid, just publish them
461  float angle_min = DEG2RAD(0.0f);
462  float angle_max = DEG2RAD(359.0f);
463  publish_scan(&scan_pub, nodes, count,
464  start_scan_time, scan_duration, inverted,
465  angle_min, angle_max, max_distance,
466  frame_id);
467  }
468  }
469 
470  ros::spinOnce();
471  }
472 
473  // done!
474  drv->setMotorSpeed(0);
475  drv->stop();
476  delete drv;
477  return 0;
478 }
sl_lidar_response_measurement_node_hq_t
Definition: sl_lidar_cmd.h:272
ros::Publisher
sl::LidarScanMode::us_per_sample
float us_per_sample
Definition: sl_lidar_driver.h:79
sl::IChannel
Definition: sl_lidar_driver.h:171
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
stop_motor
bool stop_motor(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
Definition: node.cpp:190
dist_mm_q2
sl_u32 dist_mm_q2
Definition: sl_lidar_cmd.h:3
sl::ILidarDriver::stop
virtual sl_result stop(sl_u32 timeout=DEFAULT_TIMEOUT)=0
ros.h
sl_lidar.h
sl::LidarScanMode::scan_mode
char scan_mode[64]
Definition: sl_lidar_driver.h:88
getRPLIDARDeviceInfo
bool getRPLIDARDeviceInfo(ILidarDriver *drv)
Definition: node.cpp:113
RESET_TIMEOUT
#define RESET_TIMEOUT
Definition: node.cpp:45
sl::ILidarDriver::setMotorSpeed
virtual sl_result setMotorSpeed(sl_u16 speed=DEFAULT_MOTOR_SPEED)=0
sl::ILidarDriver
Definition: sl_lidar_driver.h:306
ros::spinOnce
ROSCPP_DECL void spinOnce()
SL_IS_FAIL
#define SL_IS_FAIL(x)
Definition: sl_types.h:83
main
int main(int argc, char *argv[])
Definition: node.cpp:222
ros::NodeHandle::advertiseService
ServiceServer advertiseService(AdvertiseServiceOptions &ops)
SL_RESULT_OK
#define SL_RESULT_OK
Definition: sl_types.h:71
sl::LidarScanMode
Definition: sl_lidar_driver.h:73
DEG2RAD
#define DEG2RAD(x)
Definition: node.cpp:44
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
ros::ok
ROSCPP_DECL bool ok()
f
f
sl::LidarScanMode::max_distance
float max_distance
Definition: sl_lidar_driver.h:82
ros::ServiceServer
quality
sl_u8 quality
Definition: sl_lidar_cmd.h:4
sl::ILidarDriver::ascendScanData
virtual sl_result ascendScanData(sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t count)=0
_countof
#define _countof(_Array)
Definition: node.cpp:41
LIDAR_T_SERIES_MINUM_MAJOR_ID
@ LIDAR_T_SERIES_MINUM_MAJOR_ID
Definition: node.cpp:50
sl::ILidarDriver::grabScanDataHq
virtual sl_result grabScanDataHq(sl_lidar_response_measurement_node_hq_t *nodebuffer, size_t &count, sl_u32 timeout=DEFAULT_TIMEOUT)=0
resetRPLIDAR
bool resetRPLIDAR(ILidarDriver *drv)
Definition: node.cpp:150
SL_RESULT_OPERATION_TIMEOUT
#define SL_RESULT_OPERATION_TIMEOUT
Definition: sl_types.h:76
LIDAR_A_SERIES_MINUM_MAJOR_ID
@ LIDAR_A_SERIES_MINUM_MAJOR_ID
Definition: node.cpp:48
SL_LIDAR_STATUS_WARNING
#define SL_LIDAR_STATUS_WARNING
Definition: sl_lidar_cmd.h:172
SL_LIDAR_STATUS_OK
#define SL_LIDAR_STATUS_OK
Definition: sl_lidar_cmd.h:171
sl::createSerialPortChannel
Result< IChannel * > createSerialPortChannel(const std::string &device, int baudrate)
Definition: sl_serial_channel.cpp:141
LIDAR_S_SERIES_MINUM_MAJOR_ID
@ LIDAR_S_SERIES_MINUM_MAJOR_ID
Definition: node.cpp:49
ROS_DEBUG
#define ROS_DEBUG(...)
SL_IS_OK
#define SL_IS_OK(x)
Definition: sl_types.h:82
sl
Definition: sl_crc.h:38
sl::createTcpChannel
Result< IChannel * > createTcpChannel(const std::string &ip, int port)
Definition: sl_tcp_channel.cpp:120
sl::ILidarDriver::getAllSupportedScanModes
virtual sl_result getAllSupportedScanModes(std::vector< LidarScanMode > &outModes, sl_u32 timeoutInMs=DEFAULT_TIMEOUT)=0
Get all scan modes that supported by lidar.
sl_lidar_response_measurement_node_hq_t::angle_z_q14
sl_u16 angle_z_q14
Definition: sl_lidar_cmd.h:274
sl::ILidarDriver::getHealth
virtual sl_result getHealth(sl_lidar_response_device_health_t &health, sl_u32 timeout=DEFAULT_TIMEOUT)=0
SL_LIDAR_SDK_VERSION_MAJOR
#define SL_LIDAR_SDK_VERSION_MAJOR
Definition: sl_lidar.h:38
sl::ILidarDriver::isConnected
virtual bool isConnected()=0
start_motor
bool start_motor(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
Definition: node.cpp:201
start
ROSCPP_DECL void start()
sl::ILidarDriver::startScanExpress
virtual sl_result startScanExpress(bool force, sl_u16 scanMode, sl_u32 options=0, LidarScanMode *outUsedScanMode=nullptr, sl_u32 timeout=DEFAULT_TIMEOUT)=0
checkRPLIDARHealth
bool checkRPLIDARHealth(ILidarDriver *drv)
Definition: node.cpp:162
sl::createUdpChannel
Result< IChannel * > createUdpChannel(const std::string &ip, int port)
Definition: sl_udp_channel.cpp:125
sl::ILidarDriver::startScan
virtual sl_result startScan(bool force, bool useTypicalScan, sl_u32 options=0, LidarScanMode *outUsedScanMode=nullptr)=0
ros::Time
SL_RESULT_OPERATION_FAIL
#define SL_RESULT_OPERATION_FAIL
Definition: sl_types.h:75
ROS_ERROR
#define ROS_ERROR(...)
drv
ILidarDriver * drv
Definition: node.cpp:54
sl_result
uint32_t sl_result
Definition: sl_types.h:69
sl::getAngle
static float getAngle(const sl_lidar_response_measurement_node_t &node)
Definition: sl_lidar_driver.cpp:91
SL_LIDAR_SDK_VERSION_PATCH
#define SL_LIDAR_SDK_VERSION_PATCH
Definition: sl_lidar.h:40
publish_scan
void publish_scan(ros::Publisher *pub, sl_lidar_response_measurement_node_hq_t *nodes, size_t node_count, ros::Time start, double scan_time, bool inverted, float angle_min, float angle_max, float max_distance, std::string frame_id)
Definition: node.cpp:56
ros::Duration::sleep
bool sleep() const
SL_LIDAR_STATUS_ERROR
#define SL_LIDAR_STATUS_ERROR
Definition: sl_lidar_cmd.h:173
ROS_INFO
#define ROS_INFO(...)
sl::createLidarDriver
Result< ILidarDriver * > createLidarDriver()
Definition: sl_lidar_driver.cpp:1698
sl::ILidarDriver::getDeviceInfo
virtual sl_result getDeviceInfo(sl_lidar_response_device_info_t &info, sl_u32 timeout=DEFAULT_TIMEOUT)=0
ros::Duration
sl::ILidarDriver::reset
virtual sl_result reset(sl_u32 timeoutInMs=DEFAULT_TIMEOUT)=0
ros::NodeHandle
ros::Time::now
static Time now()
SL_LIDAR_SDK_VERSION_MINOR
#define SL_LIDAR_SDK_VERSION_MINOR
Definition: sl_lidar.h:39


rplidar_ros
Author(s):
autogenerated on Fri Aug 2 2024 08:42:14