YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
main.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 <iostream>
9#include <iomanip>
10#include <sstream>
11#include <fstream>
12#include <string>
13#include <cstdio>
14#include <limits>
15#include <cmath>
16#include <opencv2/opencv.hpp>
17#include <opencv2/core/version.hpp>
18#include <opencv2/highgui/highgui_c.h>
19#include <opencv2/highgui.hpp>
20#include <vector>
21
22#include <yarp/dev/Drivers.h>
23#include <yarp/os/Network.h>
24#include <yarp/os/Bottle.h>
26#include <yarp/os/Time.h>
27#include <yarp/os/Log.h>
29#include <yarp/os/LogStream.h>
30#include <yarp/sig/Vector.h>
31#include <yarp/sig/Image.h>
33#include <yarp/dev/PolyDriver.h>
34
35using namespace yarp::os;
36using namespace yarp::sig;
37
38#ifndef DEG2RAD
39#define DEG2RAD M_PI/180.0
40#endif
41
42const CvScalar color_bwhite = cvScalar(200,200,255);
43const CvScalar color_white = cvScalar(255,255,255);
44const CvScalar color_red = cvScalar(0,0,255);
45const CvScalar color_yellow = cvScalar(0,255,255);
47const CvScalar color_gray = cvScalar(100,100,100);
48
49#define ASPECT_LINE 0
50#define ASPECT_POINT 1
51
52bool g_lidar_debug_nan = false;
53bool g_lidar_debug_inf = false;
54
55void drawGrid(cv::Mat& img, double scale)
56{
57 cv::line(img,cvPoint(0,0),cvPoint(img.cols,img.rows),color_black);
58 cv::line(img,cvPoint(img.cols,0),cvPoint(0,img.rows),color_black);
59 cv::line(img,cvPoint(img.cols/2,0),cvPoint(img.cols/2,img.rows),color_black);
60 cv::line(img,cvPoint(0,img.rows/2),cvPoint(img.cols,img.rows/2),color_black);
61 const float step = (0.5 * scale); //mm
62/*
63 for (int xi=0; xi<img->width; xi+=step)
64 cvLine(img,cvPoint(xi,0),cvPoint(xi,img->height),color_black);
65 for (int yi=0; yi<img->height; yi+=step)
66 cvLine(img,cvPoint(0,yi),cvPoint(img->width,yi),color_black);
67*/
68 char buff [10];
69 float rad_step=0;
70 std::string fmt = "%3.1fm";
71 if (scale > 174)
72 {
73 rad_step = 0.5;
74 fmt = "%3.2fm";
75 }
76 else if (scale > 50 && scale <=174)
77 {
78 rad_step=1;
79 }
80 else if (scale > 22 && scale <= 50)
81 {
82 rad_step = 2;
83 }
84 else if (scale > 9 && scale <= 22)
85 {
86 rad_step = 4;
87 }
88 else
89 {
90 rad_step = 8;
91 }
92 for (float rad=0; rad<80; rad+=rad_step)
93 {
94 sprintf (buff,fmt.c_str(),float(rad)/2);
95 cv::putText(img, buff, cvPoint(img.cols / 2, int(float(img.rows) / 2.0 - float(step) * rad)), cv::FONT_HERSHEY_SIMPLEX, 0.4, cvScalar(0, 0, 0), 1, cv::LINE_AA);
96 cv::circle(img,cvPoint(img.cols/2,img.rows/2),(int)(step*rad),color_black);
97 }
98
99}
100
101void drawRobot (cv::Mat& img, double robot_radius, double scale)
102{
103 cv::rectangle(img,cvPoint(0,0),cvPoint(img.cols,img.rows),cvScalar(0,0,0),CV_FILLED);
104
105 //draw a circle
106 double v1 = robot_radius*scale;
107 if (v1 < 0) {
108 v1 = 0;
109 }
110 double v2 = robot_radius*scale - 1;
111 if (v2 < 0) {
112 v2 = 0;
113 }
114 double v3 = robot_radius*scale - 2;
115 if (v3 < 0) {
116 v3 = 0;
117 }
118
119 cv::circle(img, cv::Point(img.cols/2, img.rows/2), (int)(v1),color_gray,CV_FILLED);
120 cv::circle(img, cv::Point(img.cols/2, img.rows/2), (int)(v2), color_black);
121 cv::circle(img, cv::Point(img.cols/2, img.rows/2), (int)(v3), color_black);
122}
123
124void drawCompass(const yarp::sig::Vector* comp, cv::Mat& img, bool absolute)
125{
126 int sx = 0;
127 int sy = 0;
128 int ex = 0;
129 int ey = 0;
130 int tx = 0;
131 int ty = 0;
132 char buff [20];
133 cv::circle(img,cvPoint(img.cols/2,img.rows/2),250,color_black);
134 for (int i=0; i<360; i+=10)
135 {
136 double ang;
137 if (absolute) {
138 ang = i + 180;
139 } else {
140 ang = i + (*comp)[0] + 180;
141 }
142 sx = int(-250*sin(ang/180.0*M_PI)+img.cols/2);
143 sy = int(250*cos(ang/180.0*M_PI)+img.rows/2);
144 ex = int(-260*sin(ang/180.0*M_PI)+img.cols/2);
145 ey = int(260*cos(ang/180.0*M_PI)+img.rows/2);
146 tx = int(-275*sin(ang/180.0*M_PI)+img.cols/2);
147 ty = int(275*cos(ang/180.0*M_PI)+img.rows/2);
148 cv::line(img,cvPoint(sx,sy),cvPoint(ex,ey),color_black);
149 cv::Size tempSize;
150 int lw;
151 if (i==0) {sprintf(buff,"N"); tempSize = cv::getTextSize( buff, cv::FONT_HERSHEY_SIMPLEX, 0.8, 1, &lw ); cv::putText(img, buff, cvPoint(tx-tempSize.width/2,ty+tempSize.height/2), cv::FONT_HERSHEY_SIMPLEX, 0.8, cvScalar(0, 0, 0), 1, cv::LINE_AA);}
152 else if (i==90) {sprintf(buff,"E"); tempSize = cv::getTextSize( buff, cv::FONT_HERSHEY_SIMPLEX, 0.8, 1, &lw ); cv::putText(img, buff, cvPoint(tx-tempSize.width/2,ty+tempSize.height/2), cv::FONT_HERSHEY_SIMPLEX, 0.8, cvScalar(0, 0, 0), 1, cv::LINE_AA);}
153 else if (i==180) {sprintf(buff,"S"); tempSize = cv::getTextSize( buff, cv::FONT_HERSHEY_SIMPLEX, 0.8, 1, &lw ); cv::putText(img, buff, cvPoint(tx-tempSize.width/2,ty+tempSize.height/2), cv::FONT_HERSHEY_SIMPLEX, 0.8, cvScalar(0, 0, 0), 1, cv::LINE_AA);}
154 else if (i==270) {sprintf(buff,"W"); tempSize = cv::getTextSize( buff, cv::FONT_HERSHEY_SIMPLEX, 0.8, 1, &lw ); cv::putText(img, buff, cvPoint(tx-tempSize.width/2,ty+tempSize.height/2), cv::FONT_HERSHEY_SIMPLEX, 0.8, cvScalar(0, 0, 0), 1, cv::LINE_AA);}
155 else {sprintf(buff,"%d",i); tempSize = cv::getTextSize( buff, cv::FONT_HERSHEY_SIMPLEX, 0.4, 1, &lw ); cv::putText(img, buff, cvPoint(tx-tempSize.width/2,ty+tempSize.height/2), cv::FONT_HERSHEY_SIMPLEX, 0.4, cvScalar(0, 0, 0), 1, cv::LINE_AA);}
156 }
157}
158
159void drawNav(const yarp::os::Bottle *display, cv::Mat& img, double scale)
160{
161 if (display->size()==8)
162 {
163 yError ("wrong image format!");
164 return;
165 }
166 double c0 = display->get(0).asFloat64();
167// double c1 = display->get(1).asFloat64();
168// double c2 = display->get(2).asFloat64();
169 double angle_f = display->get(3).asFloat64();
170// double angle_t = display->get(4).asFloat64();
171// double w_f = display->get(5).asFloat64();
172// double w_t = display->get(6).asFloat64();
173 double max_obs_dist = display->get(7).asFloat64();
174 double angle_g = display->get(8).asFloat64();
175
176 CvPoint center;
177 center.x = (int)(img.cols/2 );
178 center.y = (int)(img.rows/2 );
179
180 CvPoint ray;
181 ray.x=int(200*sin(DEG2RAD*angle_f));
182 ray.y=-int(200*cos(DEG2RAD*angle_f));
183 ray.x += center.x;
184 ray.y += center.y;
185
186 int thickness = 3;
187 cv::line(img,center,ray,color_bwhite,thickness);
188
189 ray.x=int(100*sin(DEG2RAD*c0));
190 ray.y=-int(100*cos(DEG2RAD*c0));
191 ray.x += center.x;
192 ray.y += center.y;
193 cv::line(img,center,ray,color_red,thickness);
194
195 ray.x=int(150*sin(DEG2RAD*angle_g));
196 ray.y=-int(150*cos(DEG2RAD*angle_g));
197 ray.x += center.x;
198 ray.y += center.y;
199 cv::line(img,center,ray,color_yellow,thickness);
200
201 cv::circle(img,cvPoint(img.cols/2,img.rows/2),(int)(max_obs_dist*scale-1),color_black);
202}
203
204void drawLaser(const Vector *comp, std::vector<yarp::sig::LaserMeasurementData> *las, std::vector<yarp::sig::LaserMeasurementData> *lmap, cv::Mat& img, double angle_tot, int scans, double sens_position_x, double sens_position_y, double sens_position_t, double scale, bool absolute, bool verbose, int aspect)
205{
206 img.setTo(cv::Scalar(0, 0, 0));
207 cv::rectangle(img, cvPoint(0, 0), cvPoint(img.cols, img.rows), cvScalar(255, 0, 0), -1);
208 CvPoint center;
209
211 if (!absolute) {
212 center_angle = 0;
213 } else {
214 center_angle = -180 - (*comp)[0];
215 }
216 center.x = (int)(img.cols / 2 + (sens_position_x*scale)*sin(center_angle / 180 * M_PI));
217 center.y = (int)(img.rows / 2 - (sens_position_y*scale)*cos(center_angle / 180 * M_PI));
218
219 static double old_time = 0;
220
221 if (las==nullptr || comp==nullptr)
222 {
223 return;
224 }
225
227 if (verbose) {
228 yError("received vector size:%d ", int(las->size()));
229 }
230 static int timeout_count = 0;
231 if (curr_time - old_time > 0.40) {
233 }
234 if (verbose) {
235 yWarning("time:%f timeout:%d\n", curr_time - old_time, timeout_count);
236 }
238 for (int i = 0; i<scans; i++)
239 {
240 double x = 0;
241 double y = 0;
242 (*las)[i].get_cartesian(x, y);
243 #if 0
244 if (x == std::numeric_limits<double>::infinity() ||
245 y == std::numeric_limits<double>::infinity()) continue; //this is not working
246 #endif
247 if (std::isinf(x) || std::isinf(y))
248 {
250 {
251 //the following rotation is performed to have x axis aligned with screen vertical
252 //double rr;
253 double tt;
254 double sensor_resolution = 0.5; //@@@fixme
255 tt = -i * sensor_resolution - 90;
256 //(*las)[i].get_polar(rr,tt);
257 CvPoint ray;
258 //yDebug() << rr << tt;
259 ray.x = 1.0 * cos(tt * DEG2RAD) * scale;
260 ray.y = 1.0 * sin(tt * DEG2RAD) * scale;
261 ray.x += center.x;
262 ray.y += center.y;
263
264 int thickness = 2;
265 //draw a line
266 cv::line(img, center, ray, color_yellow, thickness);
267 }
268 continue;
269 }
270
271 if (std::isnan(x) || std::isnan(y))
272 {
274 {
275 //the following rotation is performed to have x axis aligned with screen vertical
276 //double rr;
277 double tt;
278 double sensor_resolution = 0.5; //@@@fixme
279 tt= - i * sensor_resolution - 90;
280 //(*las)[i].get_polar(rr,tt);
281 CvPoint ray;
282 //yDebug() << rr << tt;
283 ray.x = 1.0 * cos(tt*DEG2RAD) * scale;
284 ray.y = 1.0 * sin(tt*DEG2RAD) * scale;
285 ray.x += center.x;
286 ray.y += center.y;
287
288 int thickness = 2;
289 //draw a line
290 cv::line(img, center, ray, color_red, thickness);
291 }
292 continue;
293 }
294
295 //if (length<0) length = 0;
296 //else if (length>15) length = 15; //15m maximum
297
298 //the following rotation is performed to have x axis aligned with screen vertical
299 CvPoint ray;
300 ray.x = int(-y*scale);
301 ray.y = int(-x*scale);
302 ray.x += center.x;
303 ray.y += center.y;
304
305 int thickness = 2;
306 //draw a line
307 if (aspect == ASPECT_LINE)
308 {
309 cv::line(img, center, ray, color_white, thickness);
310 }
311 else if (aspect == ASPECT_POINT)
312 {
313 cv::line(img, ray, ray, color_white, 3);
314 }
315
316 if (lmap)
317 {
318 double x = 0;
319 double y = 0;
320 (*lmap)[i].get_cartesian(x, y);
322 ray2.x = -int(x*scale);
323 ray2.y = -int(y*scale);
324 ray2.x += (center.x - int((sens_position_x*scale)*sin(center_angle / 180 * M_PI)));
325 ray2.y += (center.y + int((sens_position_y*scale)*cos(center_angle / 180 * M_PI)));
326 cv::line(img, center, ray2, color_bwhite, thickness);
327 }
328 }
329}
330
332{
333 yInfo() << "Available options:";
334 yInfo() << "--scale <double> zoom factor (default 100)";
335 yInfo() << "--robot_radius <double> the radius of the displayed robot footprint ";
336 yInfo() << "--sens_position_x <double> the position in meters of the laser center respect to the center of the robot (default 0 m)";
337 yInfo() << "--sens_position_y <double> the position in meters of the laser center respect to the center of the robot (default 0 m)";
338 yInfo() << "--sens_position_theta <double> the orientation in degrees of the laser sensor respect to the center of the robot (default 0 deg)";
339 yInfo() << "--verbose <bool> toggles debug messages on/off (default false)";
340 yInfo() << "--absolute <bool> display the laser in absolute o relative mode (default false)";
341 yInfo() << "--compass <bool> displays the compass (default true) ";
342 yInfo() << "--period <double> the refresh period (default 50 ms)";
343 yInfo() << "--aspect <0/1> draws line/points (default 0=lines)";
344 yInfo() << "--sens_port <string> the name of the port used by rangefinder2D_nwc_yarp to connect to the laser device. (mandatory)";
345 yInfo() << "--carrier <string> the name of the carrier used by rangefinder2D_nwc_yarp for connection to the server";
346 yInfo() << "--lidar_debug shows NaN values";
347 yInfo() << "--local <string> the prefix for the client port. By default /laserScannerGui. Useful in case of multiple instances.";
348 yInfo() << "";
349 yInfo() << "Available commands (pressing the key during execution):";
350 yInfo() << "c ...... enables/disables compass.";
351 yInfo() << "a ...... set absolute/relative mode.";
352 yInfo() << "w ...... zoom in.";
353 yInfo() << "s ...... zoom out.";
354 yInfo() << "v ...... set verbose mode on/off.";
355 yInfo() << "r ...... set refresh period (50/100/200ms).";
356 yInfo() << "b ...... change aspect (lines/points)";
357}
358
359int main(int argc, char *argv[])
360{
362
364
365 //retrieve information for the list of parts
366 rf.setDefaultConfigFile("yarplaserscannergui.ini");
367 rf.configure(argc, argv);
368 if (rf.check("help"))
369 {
370 display_help();
371 return 0;
372 }
373 double scale = rf.check("scale", Value(100), "global scale factor").asFloat64();
374 double robot_radius = rf.check("robot_radius", Value(0.001), "robot radius [m]").asFloat64();
375 double sens_position_x = rf.check("sens_position_x", Value(0), "sens_position_x [m]").asFloat64();
376 double sens_position_y = rf.check("sens_position_y", Value(0), "sens_position_y [m]").asFloat64();
377 double sens_position_t = rf.check("sens_position_theta", Value(0), "sens_position_theta [m]").asFloat64();
378 bool verbose = rf.check("verbose", Value(false), "verbose [0/1]").asBool();
379 bool absolute = rf.check("absolute", Value(false), "absolute [0/1]").asBool();
380 bool compass = rf.check("compass", Value(true), "compass [0/1]").asBool();
381 int period = rf.check("period",Value(50),"period [ms]").asInt32(); //ms
382 int aspect = rf.check("aspect", Value(0), "0 draw lines, 1 draw points").asInt32();
383 std::string laserport = rf.check("sens_port", Value("/laser:o"), "laser port name").asString();
384 std::string carrier = rf.check("carrier", Value("tcp"), "rangefinder2D_nwc_yarp connection carrier").asString();
385 std::string localprefix = rf.check("local", Value("/laserScannerGui"), "prefix for the client port").asString();
386 if (rf.check ("lidar_debug")) { g_lidar_debug_nan = g_lidar_debug_inf = true;}
387 if (rf.check ("lidar_debug_nan")) { g_lidar_debug_nan = true; }
388 if (rf.check ("lidar_debug_inf")) { g_lidar_debug_inf = true; }
389
390 std::string laser_map_port_name;
391 laser_map_port_name = localprefix + "/laser_map:i";
392 std::string compass_port_name;
393 compass_port_name = localprefix + "/compass:i";
394 std::string nav_display;
395 nav_display = localprefix + "/nav_display:i";
396
397 int width = 600;
398 int height = 600;
399
402 lasOptions.put("device", "rangefinder2D_nwc_yarp");
403 lasOptions.put("local", localprefix + "/laser:i");
404 lasOptions.put("remote", laserport);
405 lasOptions.put("carrier", carrier);
406 bool b = drv->open(lasOptions);
407 if (!b)
408 {
409 yError() << "Unable to open polydriver";
410 delete drv;
411 return 0;
412 }
414 drv->view(iLas);
415 if (iLas == nullptr)
416 {
417 yError() << "Unable to get IRangefinder2D interface";
418 delete drv;
419 return 0;
420 }
421
422 double angle_min = 0;
423 double angle_max = 0;
424 double angle_step = 0;
425 iLas->getScanLimits(angle_min, angle_max);
426 double angle_tot = (angle_max - angle_min);
427 iLas->getHorizontalResolution(angle_step);
428 int scans = (int)(angle_tot / angle_step);
429 std::vector<yarp::sig::LaserMeasurementData> laser_data;
430
437
438 std::string window_name = "LaserScannerGui connected to " + laserport;
439 cv::Mat img = cv::Mat(width, height, CV_8UC3);
440 cv::Mat img2 = cv::Mat(width, height, CV_8UC3);
442
443 bool exit = false;
445 compass_data.resize(3, 0.0);
446
447 while(!exit)
448 {
449 void *v = cvGetWindowHandle(window_name.c_str());
450 if (v == nullptr)
451 {
452 exit = true;
453 break;
454 }
455
456 if (compass)
457 {
459 if (cmp) {
460 compass_data = *cmp;
461 }
462 }
463
464 iLas->getLaserMeasurement(laser_data);
465 int laser_data_size = laser_data.size();
466
467 /*yarp::os::Bottle *las_map = laserMapInPort.read(false);
468 if (las_map)
469 {
470 for (unsigned int i=0; i<1080; i++)
471 {
472 Bottle* b = las_map->get(i).asList();
473 lasermap_data[i].x = b->get(0).asFloat64();
474 lasermap_data[i].y = b->get(1).asFloat64();
475 }
476 }*/
477
478 //The drawing functions.
479 {
480 /*if (las_map)
481 {
482 if (laser_data_size != scans)
483 {
484 drawLaser(&compass_data, &laser_data, lasermap_data, img, angle_tot, scans, sens_position, scale, absolute, verbose, aspect);
485 }
486 else
487 {
488 drawLaser(&compass_data, &laser_data, 0, img, angle_tot, scans, sens_position, scale, absolute, verbose, aspect);
489 }
490 }
491 else*/
492 {
493 if (laser_data_size != scans)
494 {
495 yWarning() << "Problem detected in size of laser measurement vector";
496 }
497 else
498 {
499 drawLaser(&compass_data, &laser_data, nullptr, img, angle_tot, scans, sens_position_x, sens_position_y, sens_position_t, scale, absolute, verbose, aspect);
500 }
501
502 }
504 drawGrid(img,scale);
505 if (compass) {
507 }
508
510 if (nav_display)
511 {
512 drawNav(nav_display,img,scale);
513 }
514
515 cv::addWeighted(img, 0.7, img2, 0.3, 0.0, img);
516 cv::imshow(window_name.c_str(), img);
517 }
518
519 SystemClock::delaySystem(double(period)/1000.0+0.005);
520
521 //if ESC is pressed, exit.
522 int keypressed = cvWaitKey(2); //wait 2ms. Lower values do not work under Linux
523 keypressed &= 0xFF; //this mask is required in Linux systems
524 if (keypressed == 27) {
525 exit = true;
526 }
527 if(keypressed == 'w' && scale <500)
528 {
529 //scale+=0.001;
530 scale*=1.02;
531 yInfo("scale factor is now:%.3f",scale);
532 }
533 if(keypressed == 's' && scale >8)
534 {
535 //scale-=0.001;
536 scale/=1.02;
537 yInfo("scale factor is now:%.3f", scale);
538 }
539 if(keypressed == 'v' )
540 {
541 verbose= (!verbose);
542 if (verbose) {
543 yInfo("verbose mode is now ON");
544 } else {
545 yInfo("verbose mode is now OFF");
546 }
547 }
548 if(keypressed == 'a' )
549 {
550 absolute= (!absolute);
551 if (absolute) {
552 yInfo("display is now in ABSOLUTE mode");
553 } else {
554 yInfo("display is now in RELATIVE mode");
555 }
556 }
557 if(keypressed == 'r' )
558 {
559 if (period == 0) {
560 period = 50;
561 } else if (period == 50) {
562 period = 100;
563 } else if (period == 100) {
564 period = 200;
565 } else if (period == 200) {
566 period = 0;
567 }
568 yInfo("refresh period set to %d ms.", period);
569 }
570 if(keypressed == 'c' )
571 {
572 compass= (!compass);
573 if (compass) { yInfo( "compass is now ON"); }
574 else { yInfo( "compass is now OFF"); compass_data.zero(); }
575 }
576 if (keypressed == 'b')
577 {
578 aspect = aspect + 1;
579 if (aspect > 1) {
580 aspect = 0;
581 }
582 }
583 if(keypressed == 'h' ||
584 keypressed == 'H')
585 {
586 yInfo("available commands:");
587 yInfo("c ...... enables/disables compass.");
588 yInfo("a ...... set absolute/relative mode.");
589 yInfo("w ...... zoom in.");
590 yInfo("s ...... zoom out.");
591 yInfo("v ...... set verbose mode on/off.");
592 yInfo("r ...... set refresh rate.");
593 yInfo("b ...... change aspect");
594 }
595 }
596
601 if (drv) {
602 delete drv;
603 }
604}
#define M_PI
#define yInfo(...)
Definition Log.h:319
#define yError(...)
Definition Log.h:361
#define yWarning(...)
Definition Log.h:340
contains the definition of a Vector type
bool view(T *&x)
Get an interface to the device driver.
A generic interface for planar laser range finders.
A container for a device driver.
Definition PolyDriver.h:23
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
size_type size() const
Gets the number of elements in the bottle.
Definition Bottle.cpp:251
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition Bottle.cpp:246
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
T * read(bool shouldWait=true) override
Read an available object from the port.
Utilities for manipulating the YARP network, including initialization and shutdown.
Definition Network.h:706
A class for storing options and configuration information.
Definition Property.h:33
Helper class for finding config files and other external resources.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
bool setDefaultConfigFile(const std::string &fname)
Provide a default value for the configuration file (can be overridden from command line with the –fro...
static void delaySystem(double seconds)
A single value (typically within a Bottle).
Definition Value.h:43
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition Value.cpp:222
void drawLaser(const Vector *comp, std::vector< yarp::sig::LaserMeasurementData > *las, std::vector< yarp::sig::LaserMeasurementData > *lmap, cv::Mat &img, double angle_tot, int scans, double sens_position_x, double sens_position_y, double sens_position_t, double scale, bool absolute, bool verbose, int aspect)
Definition main.cpp:204
int main(int argc, char *argv[])
Definition main.cpp:359
void drawCompass(const yarp::sig::Vector *comp, cv::Mat &img, bool absolute)
Definition main.cpp:124
const CvScalar color_red
Definition main.cpp:44
const CvScalar color_gray
Definition main.cpp:47
void drawNav(const yarp::os::Bottle *display, cv::Mat &img, double scale)
Definition main.cpp:159
#define ASPECT_POINT
Definition main.cpp:50
void drawGrid(cv::Mat &img, double scale)
Definition main.cpp:55
#define ASPECT_LINE
Definition main.cpp:49
const CvScalar color_yellow
Definition main.cpp:45
const CvScalar color_white
Definition main.cpp:43
void display_help()
Definition main.cpp:331
void drawRobot(cv::Mat &img, double robot_radius, double scale)
Definition main.cpp:101
const CvScalar color_bwhite
Definition main.cpp:42
const CvScalar color_black
Definition main.cpp:46
#define DEG2RAD
Definition main.cpp:39
bool g_lidar_debug_nan
Definition main.cpp:52
bool g_lidar_debug_inf
Definition main.cpp:53
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition Time.cpp:121
An interface to the operating system, including Port based communication.
@ YARP_CLOCK_SYSTEM
Definition Time.h:28
The main, catch-all namespace for YARP.
Definition dirs.h:16
bool absolute(const char *path)