YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
rpLidar.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#define _USE_MATH_DEFINES
7
8#include "rpLidar.h"
9
10#include <yarp/os/Time.h>
11#include <yarp/os/Log.h>
12#include <yarp/os/LogStream.h>
14
15#include <cmath>
16#include <cstdlib>
17#include <cstring>
18#include <iostream>
19#include <limits>
20#include <mutex>
21
22
23//#define LASER_DEBUG
24//#define FORCE_SCAN
25
26#ifndef DEG2RAD
27#define DEG2RAD M_PI/180.0
28#endif
29
30YARP_LOG_COMPONENT(RPLIDAR, "yarp.device.rpLidar")
31
33
35{
36 maxsize = bufferSize + 1;
37 start = 0;
38 end = 0;
39 elems = (byte *)calloc(maxsize, sizeof(byte));
40}
41
46
47//-------------------------------------------------------------------------------------
48
50{
51 info = "Fake Laser device for test/debugging";
53
54#ifdef LASER_DEBUG
55 yCDebug(RPLIDAR, "%s\n", config.toString().c_str());
56#endif
57
58 min_distance = 0.1; //m
59 max_distance = 2.5; //m
60
61 bool br = config.check("GENERAL");
62 if (br != false)
63 {
65 clip_max_enable = general_config.check("clip_max");
66 clip_min_enable = general_config.check("clip_min");
67 if (clip_max_enable) { max_distance = general_config.find("clip_max").asFloat64(); }
68 if (clip_min_enable) { min_distance = general_config.find("clip_min").asFloat64(); }
69 if (general_config.check("max_angle") == false) { yCError(RPLIDAR) << "Missing max_angle param"; return false; }
70 if (general_config.check("min_angle") == false) { yCError(RPLIDAR) << "Missing min_angle param"; return false; }
71 if (general_config.check("resolution") == false) { yCError(RPLIDAR) << "Missing resolution param"; return false; }
72 max_angle = general_config.find("max_angle").asFloat64();
73 min_angle = general_config.find("min_angle").asFloat64();
74 resolution = general_config.find("resolution").asFloat64();
75 do_not_clip_infinity_enable = (general_config.find("allow_infinity").asInt32()!=0);
76 }
77 else
78 {
79 yCError(RPLIDAR) << "Missing GENERAL section";
80 return false;
81 }
82
83 bool bs = config.check("SKIP");
84 if (bs != false)
85 {
87 Bottle mins = skip_config.findGroup("min");
88 Bottle maxs = skip_config.findGroup("max");
89 size_t s_mins = mins.size();
90 size_t s_maxs = mins.size();
91 if (s_mins == s_maxs && s_maxs > 1 )
92 {
93 for (size_t s = 1; s < s_maxs; s++)
94 {
96 range.max = maxs.get(s).asFloat64();
97 range.min = mins.get(s).asFloat64();
98 if (range.max >= 0 && range.max <= 360 &&
99 range.min >= 0 && range.min <= 360 &&
100 range.max > range.min)
101 {
102 range_skip_vector.push_back(range);
103 }
104 else
105 {
106 yCError(RPLIDAR) << "Invalid range in SKIP section";
107 return false;
108 }
109 }
110 }
111
112 }
113
114 if (max_angle <= min_angle) { yCError(RPLIDAR) << "max_angle should be > min_angle"; return false; }
115 double fov = (max_angle - min_angle);
116 if (fov >360) { yCError(RPLIDAR) << "max_angle - min_angle <= 360"; return false; }
117 sensorsNum = (int)(fov/resolution);
119
120 yCInfo(RPLIDAR, "Starting debug mode");
121 yCInfo(RPLIDAR, "max_dist %f, min_dist %f", max_distance, min_distance);
122 yCInfo(RPLIDAR, "max_angle %f, min_angle %f", max_angle, min_angle);
123 yCInfo(RPLIDAR, "resolution %f", resolution);
124 yCInfo(RPLIDAR, "sensors %d", sensorsNum);
125
126 yarp::os::Searchable& general_config = config.findGroup("GENERAL");
127 bool ok = general_config.check("Serial_Configuration");
128 if (!ok)
129 {
130 yCError(RPLIDAR, "Cannot find configuration file for serial port communication!");
131 return false;
132 }
133 std::string serial_filename = general_config.find("Serial_Configuration").asString();
134
135 Property prop;
138
139 prop.put("device", "serialport");
140 ok = prop.fromConfigFile(serial_completefilename, config, false);
141 if (!ok)
142 {
143 yCError(RPLIDAR, "Unable to read from serial port configuration file");
144 return false;
145 }
146
147 pSerial = nullptr;
148 driver.open(prop);
149 if (!driver.isValid())
150 {
151 yCError(RPLIDAR, "Error opening PolyDriver check parameters");
152 return false;
153 }
155 if (!pSerial)
156 {
157 yCError(RPLIDAR, "Error opening serial driver. Device not available");
158 return false;
159 }
160
161 //
162 int cleanup = pSerial->flush();
163 if (cleanup > 0)
164 {
165 yCDebug(RPLIDAR, "cleanup performed, flushed %d chars", cleanup);
166 }
167
168 // check health
169 bool b_health = HW_getHealth();
170 if (b_health == false)
171 {
172 yCWarning(RPLIDAR, "Sensor in error status, attempt to recover");
173 HW_reset();
174 b_health = HW_getHealth();
175 if (b_health == false)
176 {
177 yCError(RPLIDAR, "Unable to recover error");
178 return false;
179 }
180 else
181 {
182 yCInfo(RPLIDAR, "Sensor recovered from a previous error status");
183 }
184 }
185 yCInfo(RPLIDAR, "Sensor ready");
186
187// string info;
188// bool b_info = HW_getInfo(info);
189
190 return PeriodicThread::start();
191}
192
194{
196
197 if (!HW_stop())
198 {
199 yCError(RPLIDAR, "Unable to stop sensor!");
200 HW_reset();
201 }
202
203 if (driver.isValid()) {
204 driver.close();
205 }
206
207 yCInfo(RPLIDAR) << "rpLidar closed";
208 return true;
209}
210
211ReturnValue RpLidar::getDistanceRange(double& min, double& max)
212{
213 std::lock_guard<std::mutex> guard(mutex);
214 min = min_distance;
215 max = max_distance;
216 return ReturnValue_ok;
217}
218
220{
221 std::lock_guard<std::mutex> guard(mutex);
222 min_distance = min;
223 max_distance = max;
224 return ReturnValue_ok;
225}
226
227ReturnValue RpLidar::getScanLimits(double& min, double& max)
228{
229 std::lock_guard<std::mutex> guard(mutex);
230 min = min_angle;
231 max = max_angle;
232 return ReturnValue_ok;
233}
234
235ReturnValue RpLidar::setScanLimits(double min, double max)
236{
237 std::lock_guard<std::mutex> guard(mutex);
238 min_angle = min;
239 max_angle = max;
240 return ReturnValue_ok;
241}
242
244{
245 std::lock_guard<std::mutex> guard(mutex);
247 return ReturnValue_ok;
248}
249
251{
252 std::lock_guard<std::mutex> guard(mutex);
254 return ReturnValue_ok;
255}
256
258{
259 std::lock_guard<std::mutex> guard(mutex);
260 yCWarning(RPLIDAR, "getScanRate not yet implemented");
261 return ReturnValue_ok;
262}
263
265{
266 std::lock_guard<std::mutex> guard(mutex);
267 yCWarning(RPLIDAR, "setScanRate not yet implemented");
268 return ReturnValue::return_code::return_value_error_not_implemented_by_device;
269}
270
271
273{
274 std::lock_guard<std::mutex> guard(mutex);
275 out = laser_data;
277 return ReturnValue_ok;
278}
279
280ReturnValue RpLidar::getLaserMeasurement(std::vector<yarp::sig::LaserMeasurementData> &data, double* timestamp)
281{
282 std::lock_guard<std::mutex> guard(mutex);
283#ifdef LASER_DEBUG
284 //yCDebug(RPLIDAR, "data: %s\n", laser_data.toString().c_str());
285#endif
286 size_t size = laser_data.size();
287 data.resize(size);
288 if (max_angle < min_angle)
289 {
290 yCError(RPLIDAR) << "getLaserMeasurement failed";
291 return ReturnValue::return_code::return_value_error_method_failed;
292 }
294 for (size_t i = 0; i < size; i++)
295 {
296 double angle = (i / double(size)*laser_angle_of_view + min_angle)* DEG2RAD;
297 data[i].set_polar(laser_data[i], angle);
298 }
300 return ReturnValue_ok;
301}
303{
304 std::lock_guard<std::mutex> guard(mutex);
305 status = device_status;
306 return ReturnValue_ok;
307}
308
310{
311#ifdef LASER_DEBUG
312 yCDebug(RPLIDAR, "RpLidar:: thread initialising...\n");
313 yCDebug(RPLIDAR, "... done!\n");
314#endif
315
316 if (!HW_start())
317 {
318 yCError(RPLIDAR, "Unable to put sensor in scan mode!");
319 return false;
320 }
321 return true;
322}
323
324bool RpLidar::HW_getInfo(std::string& s_info)
325{
326 int r = 0;
327 unsigned char cmd_arr[2];
328 cmd_arr[0] = 0xA5;
329 cmd_arr[1] = 0x50;
330 pSerial->send((char *)cmd_arr, 2);
331
333
334 unsigned char s[255];
335 r = pSerial->receiveBytes(s, 7);
336 if (r!=7)
337 {
338 yCError(RPLIDAR, "Received answer with wrong length: %d", r);
339 return false;
340 }
341
342 if ((unsigned char)s[0] != 0xA5 || (unsigned char)s[1] != 0x5A || (unsigned char)s[2] != 0x14 || (unsigned char)s[6] != 0x04)
343 {
344 yCError(RPLIDAR, "Invalid answer header");
345 return false;
346 }
347
348 r = pSerial->receiveBytes(s, 20);
349 if (r!=20)
350 {
351 yCError(RPLIDAR, "Received answer with wrong length: %d", r);
352 return false;
353 }
354 char info[512];
355 sprintf(info, "model %d fw_major %d fw_minor %d hardware %d serial number %c%c%c%c%c %c%c%c%c%c %c%c%c%c%c%c",
356 s[0], s[1], s[2], s[3],
357 s[4], s[5], s[6], s[7], s[8],
358 s[9], s[10], s[11], s[12], s[13],
359 s[14], s[15], s[16], s[17], s[18], s[19]);
360 s_info.append(info);
361 return true;
362}
363
364bool RpLidar::HW_getHealth()
365{
366 pSerial->flush();
367
368 int r = 0;
369 unsigned char cmd_arr[2];
370 cmd_arr[0] = 0xA5;
371 cmd_arr[1] = 0x52;
372 pSerial->send((char *)cmd_arr, 2);
373
375
376 unsigned char s[255];
377 memset(s, 0, 255);
378 r = pSerial->receiveBytes(s,7);
379 if (r!=7)
380 {
381 yCError(RPLIDAR, "Received answer with wrong length: %d", r);
382 return false;
383 }
384
385 if ((unsigned char)s[0] != 0xA5 || (unsigned char)s[1] != 0x5A || (unsigned char)s[2] != 3 || (unsigned char)s[6] != 0x06)
386 {
387 yCError(RPLIDAR, "Invalid answer header");
388 return false;
389 }
390
391 memset(s, 0, 255);
392 r = pSerial->receiveBytes(s,3);
393 if (r !=3)
394 {
395 yCError(RPLIDAR, "Received answer with wrong length: %d", r);
396 return false;
397 }
398
399 int status = s[0];
400 int code = s[1] << 8 | s[2];
401 if (status == 0)
402 {
403 return true;
404 }
405 else if (status == 1)
406 {
407 yCWarning(RPLIDAR, "sensor in warning status, code %d", code);
408 return true;
409 }
410 else if (status == 2)
411 {
412 yCError(RPLIDAR, "sensor in error status, code %d", code);
413 return true;
414 }
415 yCError(RPLIDAR, "Unkwnon answer code");
416 return false;
417}
418
419bool RpLidar::HW_reset()
420{
421 pSerial->flush();
422
423 unsigned char cmd_arr[2];
424 cmd_arr[0] = 0xA5;
425 cmd_arr[1] = 0x40;
426 pSerial->send((char *)cmd_arr, 2);
427
429 return true;
430}
431
432bool RpLidar::HW_start()
433{
434 pSerial->flush();
435
436 int r = 0;
437
438 unsigned char cmd_arr[2];
439 cmd_arr[0] = 0xA5;
440#ifdef FORCE_SCAN
441 cmd_arr[1] = 0x21;
442#else
443 cmd_arr[1] = 0x20;
444#endif
445 pSerial->send((char *)cmd_arr,2);
446
448
449 unsigned char s[255];
450 memset(s, 0, 255);
451 r = pSerial->receiveBytes(s, 7);
452 if (r != 7)
453 {
454 yCError(RPLIDAR, "Received answer with wrong length: %d", r);
455 return false;
456 }
457
458 if ((unsigned char)s[0] != 0xA5 || (unsigned char)s[1] != 0x5A || (unsigned char)s[2] != 0x05 ||
459 (unsigned char)s[5] != 0x40 || (unsigned char)s[6] != 0x81)
460 {
461 yCError(RPLIDAR, "Invalid answer header");
462 return false;
463 }
464
465 return true;
466}
467
468bool RpLidar::HW_stop()
469{
470 pSerial->flush();
471
472 unsigned char cmd_arr[2];
473 cmd_arr[0] = 0xA5;
474 cmd_arr[1] = 0x25;
475 pSerial->send((char*)cmd_arr,2);
476
478 return true;
479}
480
481#define DEBUG_LOCKING 1
482
484{
485#ifdef DEBUG_TIMING
486 double t1 = yarp::os::Time::now();
487#endif
488 const int packet = 100;
489 std::lock_guard<std::mutex> guard(mutex);
490
491 unsigned char buff[packet*3];
492 memset(buff, 0, packet*3);
493
494 unsigned int r = 0;
495 static unsigned int total_r = 0;
496 unsigned int count = 0;
497 do
498 {
499 r = pSerial->receiveBytes(buff, packet);
500#ifdef DEBUG_BYTES_READ_1
501 yCDebug(RPLIDAR) << r;
502#endif
503 buffer->write_elems(buff, r);
504 count++;
505 total_r += r;
506#ifdef DEBUG_BYTES_READ_2
507 if (r < packet)
508 {
509 yCDebug(RPLIDAR) << "R" << r;
510 }
511#endif
512 }
513 while (buffer->size() < (packet * 2) || r < packet);
514
515 unsigned char minibuff[15];
516 unsigned int ok_count = 0;
517 bool new_scan = false;
518 do
519 {
520 buffer->select_elems(minibuff,15);
521
522 int start = (minibuff[0]) & 0x01;
523 int lock = (minibuff[0] >> 1) & 0x01;
524 int check = (minibuff[1] & 0x01);
525
526 int start_n1 = (minibuff[5]) & 0x01;
527 int lock_n1 = (minibuff[5] >> 1) & 0x01;
528 int start_n2 = (minibuff[10]) & 0x01;
529 int lock_n2 = (minibuff[10] >> 1) & 0x01;
530 int check_n1 = (minibuff[6] & 0x01);
531 int check_n2 = (minibuff[11] & 0x01);
532
533 int quality = (minibuff[0] >> 2);
534 int i_angle = ((minibuff[2] >> 1) << 8) | (minibuff[1]);
535 int i_distance = (minibuff[4] << 8) | (minibuff[3]); //this is ok!
536
537 if (start == lock)
538 {
539#ifdef DEBUG_LOCKING
540 yCError(RPLIDAR) << "lock error 1 " << "previous ok" << ok_count << "total r" << total_r;
541#endif
542 buffer->throw_away_elem();
543 new_scan = false;
544 ok_count = 0;
545 continue;
546 }
547
548 if (start_n1 == lock_n1)
549 {
550#ifdef DEBUG_LOCKING
551 yCError(RPLIDAR) << "lock error 2 " << "previous ok" << ok_count << "total r" << total_r;
552#endif
553 buffer->throw_away_elem();
554 new_scan = false;
555 ok_count = 0;
556 continue;
557 }
558
559 if (start_n2 == lock_n2)
560 {
561#ifdef DEBUG_LOCKING
562 yCError(RPLIDAR) << "lock error 3 " << "previous ok" << ok_count << "total r" << total_r;
563#endif
564 buffer->throw_away_elem();
565 new_scan = false;
566 ok_count = 0;
567 continue;
568 }
569
570 if (start == 1 && start_n1 == 1)
571 {
572#ifdef DEBUG_LOCKING
573 yCError(RPLIDAR) << "lock error 4 " << "previous ok" << ok_count << "total r" << total_r;
574#endif
575 buffer->throw_away_elem();
576 new_scan = false;
577 ok_count = 0;
578 continue;
579 }
580
581 if (check != 1)
582 {
583#ifdef DEBUG_LOCKING
584 yCError(RPLIDAR) << "checksum error 1" << "previous ok" << ok_count << "total r" << total_r;
585#endif
586 buffer->throw_away_elem();
587 new_scan = false;
588 ok_count = 0;
589 continue;
590 }
591
592 if (check_n1 != 1)
593 {
594#ifdef DEBUG_LOCKING
595 yCError(RPLIDAR) << "checksum error 2" << "previous ok" << ok_count << "total r" << total_r;
596#endif
597 buffer->throw_away_elem();
598 new_scan = false;
599 ok_count = 0;
600 continue;
601 }
602
603 if (check_n2 != 1)
604 {
605#ifdef DEBUG_LOCKING
606 yCError(RPLIDAR) << "checksum error 3" << "previous ok" << ok_count << "total r" << total_r;
607#endif
608 buffer->throw_away_elem();
609 new_scan = false;
610 ok_count = 0;
611 continue;
612 }
613
614#ifdef DEBUG_LOCKING
615 // yCDebug(RPLIDAR) << "OK" << buffer->get_start() << buffer->get_end() << "total r" << total_r;
616 ok_count++;
617#endif
618
619 if (start == 1 && new_scan == false)
620 {
621 //this is a new scan
622 new_scan = true;
623 }
624 else if (start == 1 && new_scan == true)
625 {
626 //end of data
627 new_scan = false;
628 }
629
630 double distance = i_distance / 4.0 / 1000; //m
631 double angle = i_angle / 64.0; //deg
632 angle = (360 - angle) + 90;
633 if (angle >= 360) {
634 angle -= 360;
635 }
636
637 if (i_distance == 0)
638 {
639 // yCWarning(RPLIDAR) << "Invalid Measurement " << i/5;
640 }
641 if (quality == 0)
642 {
643 // yCWarning(RPLIDAR) << "Quality Low" << i / 5;
644 distance = std::numeric_limits<double>::infinity();
645 }
646 if (angle > 360)
647 {
648 yCWarning(RPLIDAR) << "Invalid angle";
649 }
650
651 if (clip_min_enable)
652 {
653 if (distance < min_distance) {
655 }
656 }
657 if (clip_max_enable)
658 {
660 {
661 if (!do_not_clip_infinity_enable && distance <= std::numeric_limits<double>::infinity())
662 {
664 }
665 }
666 }
667
668 for (auto& i : range_skip_vector)
669 {
670 if (angle > i.min && angle < i.max)
671 {
672 distance = std::numeric_limits<double>::infinity();
673 }
674 }
675
676 /*--------------------------------------------------------------*/
677 /* {
678 yCError(RPLIDAR) << "Wrong scan size: " << r;
679 bool b_health = HW_getHealth();
680 if (b_health == true)
681 {
682 if (!HW_reset())
683 {
684 yCError(RPLIDAR, "Unable to reset sensor!");
685 }
686 yCWarning(RPLIDAR, "Sensor reset after error");
687 if (!HW_start())
688 {
689 yCError(RPLIDAR, "Unable to put sensor in scan mode!");
690 }
691 mutex.unlock();
692 return;
693 }
694 else
695 {
696 yCError(RPLIDAR) << "System in error state";
697 }
698 }*/
699 buffer->throw_away_elems(5);
700 //int m_elem = (int)((max_angle - min_angle) / resolution);
701 int elem = (int)(angle / resolution);
702 if (elem >= 0 && elem < (int)laser_data.size())
703 {
705 }
706 else
707 {
708 yCDebug(RPLIDAR) << "RpLidar::run() invalid angle: elem" << elem << ">" << "laser_data.size()" << laser_data.size();
709 }
710 }
711 while (buffer->size() > packet && isRunning() );
712
713#ifdef DEBUG_TIMING
714 double t2 = yarp::os::Time::now();
715 yCDebug(RPLIDAR, "Time %f", (t2 - t1) * 1000.0);
716#endif
717 return;
718}
719
721{
722#ifdef LASER_DEBUG
723 yCDebug(RPLIDAR, "RpLidar Thread releasing...");
724 yCDebug(RPLIDAR, "... done.");
725#endif
726
727 return;
728}
729
730ReturnValue RpLidar::getDeviceInfo(std::string &device_info)
731{
732 std::lock_guard<std::mutex> guard(mutex);
733 device_info = info;
734 return ReturnValue_ok;
735}
#define DEG2RAD
#define ReturnValue_ok
Definition ReturnValue.h:77
double max_distance
Definition rpLidar.h:190
void run() override
Loop function.
Definition rpLidar.cpp:483
yarp::sig::Vector laser_data
Definition rpLidar.h:200
yarp::dev::ReturnValue getScanLimits(double &min, double &max) override
get the scan angular range.
Definition rpLidar.cpp:227
std::string info
Definition rpLidar.h:197
bool close() override
Close the DeviceDriver.
Definition rpLidar.cpp:193
yarp::dev::ReturnValue setScanLimits(double min, double max) override
set the scan angular range.
Definition rpLidar.cpp:235
bool do_not_clip_infinity_enable
Definition rpLidar.h:194
std::mutex mutex
Definition rpLidar.h:182
yarp::dev::ReturnValue getDeviceStatus(Device_status &status) override
get the device status
Definition rpLidar.cpp:302
bool clip_max_enable
Definition rpLidar.h:192
std::vector< Range_t > range_skip_vector
Definition rpLidar.h:195
bool threadInit() override
Initialization method.
Definition rpLidar.cpp:309
yarp::dev::ReturnValue getDistanceRange(double &min, double &max) override
get the device detection range
Definition rpLidar.cpp:211
PolyDriver driver
Definition rpLidar.h:179
Device_status device_status
Definition rpLidar.h:198
void threadRelease() override
Release method.
Definition rpLidar.cpp:720
yarp::dev::ReturnValue getHorizontalResolution(double &step) override
get the angular step between two measurements.
Definition rpLidar.cpp:243
yarp::dev::ReturnValue setHorizontalResolution(double step) override
get the angular step between two measurements (if available)
Definition rpLidar.cpp:250
yarp::dev::ReturnValue setScanRate(double rate) override
set the scan rate (scans per seconds)
Definition rpLidar.cpp:264
bool clip_min_enable
Definition rpLidar.h:193
int sensorsNum
Definition rpLidar.h:185
double resolution
Definition rpLidar.h:191
ISerialDevice * pSerial
Definition rpLidar.h:180
double min_angle
Definition rpLidar.h:187
double min_distance
Definition rpLidar.h:189
yarp::dev::ReturnValue setDistanceRange(double min, double max) override
set the device detection range.
Definition rpLidar.cpp:219
double max_angle
Definition rpLidar.h:188
yarp::dev::ReturnValue getDeviceInfo(std::string &device_info) override
get the device hardware characteristics
Definition rpLidar.cpp:730
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition rpLidar.cpp:49
yarp::dev::ReturnValue getScanRate(double &rate) override
get the scan rate (scans per seconds)
Definition rpLidar.cpp:257
yarp::dev::ReturnValue getRawData(yarp::sig::Vector &data, double *timestamp) override
Get the device measurements.
Definition rpLidar.cpp:272
yarp::dev::ReturnValue getLaserMeasurement(std::vector< yarp::sig::LaserMeasurementData > &data, double *timestamp) override
Get the device measurements.
Definition rpLidar.cpp:280
bool view(T *&x)
Get an interface to the device driver.
virtual int flush()=0
Flushes the internal buffer.
virtual bool send(const yarp::os::Bottle &msg)=0
Sends a string of chars to the serial communications channel.
virtual int receiveBytes(unsigned char *bytes, const int size)=0
Gets an array of bytes (unsigned char) with size <= 'size' parameter.
bool close() override
Close the DeviceDriver.
bool isValid() const
Check if device is valid.
bool open(const std::string &txt)
Construct and configure a device by its common name.
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
A mini-server for performing network communication in the background.
bool isRunning() const
Returns true when the thread is started, false otherwise.
bool start()
Call this to start the thread.
void step()
Call this to "step" the thread rather than starting it.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A class for storing options and configuration information.
Definition Property.h:33
bool fromConfigFile(const std::string &fname, bool wipe=true)
Interprets a file as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition Property.cpp:987
Helper class for finding config files and other external resources.
std::string findFileByName(const std::string &name)
Find the full path to a file.
A base class for nested structures that can be searched.
Definition Searchable.h:31
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
static void delaySystem(double seconds)
void resize(size_t size) override
Resize the vector.
Definition Vector.h:221
size_t size() const
Definition Vector.h:341
#define yCInfo(component,...)
#define yCError(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition Time.cpp:121
The main, catch-all namespace for YARP.
Definition dirs.h:16
const yarp::os::LogComponent & RPLIDAR()
Definition rpLidar.cpp:30
const yarp::os::LogComponent & RPLIDAR()
Definition rpLidar.cpp:30