YARP
Yet Another Robot Platform
navigation2DServer.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 <yarp/os/Network.h>
9 #include <yarp/os/RFModule.h>
10 #include <yarp/os/Time.h>
11 #include <yarp/os/Port.h>
12 #include <yarp/os/LogComponent.h>
13 #include <yarp/os/LogStream.h>
15 #include <yarp/dev/INavigation2D.h>
16 #include <yarp/dev/MapGrid2D.h>
17 #include <math.h>
18 #include <cmath>
19 #include "navigation2DServer.h"
20 
21 using namespace yarp::os;
22 using namespace yarp::dev;
23 using namespace yarp::dev::Nav2D;
24 
25 namespace {
26 YARP_LOG_COMPONENT(NAVIGATION2DSERVER, "yarp.device.navigation2DServer")
27 }
28 
29 #ifndef RAD2DEG
30 #define RAD2DEG 180.0/M_PI
31 #endif
32 
34 {
35  iNav_target = nullptr;
36  iNav_ctrl = nullptr;
39 }
40 
42 {
43  if (device2attach.size() != 1)
44  {
45  yCError(NAVIGATION2DSERVER, "Cannot attach more than one device");
46  return false;
47  }
48 
49  yarp::dev::PolyDriver * Idevice2attach = device2attach[0]->poly;
50 
51  if (Idevice2attach->isValid())
52  {
53  Idevice2attach->view(iNav_target);
54  Idevice2attach->view(iNav_ctrl);
55  }
56 
57  if (nullptr == iNav_target ||
58  nullptr == iNav_ctrl)
59  {
60  yCError(NAVIGATION2DSERVER, "Subdevice passed to attach method is invalid");
61  return false;
62  }
63 
64  PeriodicThread::setPeriod(m_period);
65  return PeriodicThread::start();
66 }
67 
69 {
70  if (PeriodicThread::isRunning())
71  {
72  PeriodicThread::stop();
73  }
74  iNav_target = nullptr;
75  iNav_ctrl = nullptr;
76  return true;
77 }
78 
80 {
81  Property params;
82  params.fromString(config.toString().c_str());
83  yCDebug(NAVIGATION2DSERVER) << "Configuration: \n" << config.toString().c_str();
84 
85  if (!config.check("period"))
86  {
87  yCInfo(NAVIGATION2DSERVER) << "Missing 'period' parameter. Using default value: 0.010";
88  m_period = 0.010;
89  }
90  else
91  {
92  m_period = config.find("period").asFloat64();
93  }
94 
95  std::string local_name = "/navigationServer";
96  if (!config.check("name"))
97  {
98  yCInfo(NAVIGATION2DSERVER) << "Missing 'name' parameter. Using default value: /navigationServer";
99  }
100  else
101  {
102  local_name = config.find("name").asString();
103  }
104  m_rpcPortName = local_name + "/rpc";
105  m_streamingPortName = local_name + "/streaming:o";
106 
107  if (config.check("subdevice"))
108  {
109  Property p;
110  PolyDriverList driverlist;
111  p.fromString(config.toString(), false);
112  p.put("device", config.find("subdevice").asString());
113 
114  if (!pNav.open(p) || !pNav.isValid())
115  {
116  yCError(NAVIGATION2DSERVER) << "Failed to open subdevice.. check params";
117  return false;
118  }
119 
120  driverlist.push(&pNav, "1");
121  if (!attachAll(driverlist))
122  {
123  yCError(NAVIGATION2DSERVER) << "Failed to open subdevice.. check params";
124  return false;
125  }
126  }
127 
128  if (!initialize_YARP(config))
129  {
130  yCError(NAVIGATION2DSERVER) << "Error initializing YARP ports";
131  return false;
132  }
133 
134  return true;
135 }
136 
138 {
139  if (!m_rpcPort.open(m_rpcPortName.c_str()))
140  {
141  yCError(NAVIGATION2DSERVER, "Failed to open port %s", m_rpcPortName.c_str());
142  return false;
143  }
144  m_rpcPort.setReader(*this);
145  return true;
146 }
147 
149 {
150  yCTrace(NAVIGATION2DSERVER, "Close");
151  if (PeriodicThread::isRunning())
152  {
153  PeriodicThread::stop();
154  }
155 
156  detachAll();
157  return true;
158 }
159 
160 bool navigation2DServer::parse_respond_string(const yarp::os::Bottle& command, yarp::os::Bottle& reply)
161 {
162  if (command.get(0).isString() == false)
163  {
164  yCError(NAVIGATION2DSERVER) << "General error in navigation2DServer::parse_respond_string()";
165  return false;
166  }
167 
168  if (command.get(0).asString() == "help")
169  {
170  reply.addVocab32("many");
171  reply.addString("Navigation2DServer does not support rpc commands in plain text format, only vocabs.");
172  reply.addString("Please use the rpc port of Navigation2DClient.");
173  }
174  else
175  {
176  reply.addString("Unknown command. Type 'help'.");
177  }
178  return true;
179 }
180 
181 bool navigation2DServer::parse_respond_vocab(const yarp::os::Bottle& command, yarp::os::Bottle& reply)
182 {
183  if (command.get(0).isVocab32() == false)
184  {
185  yCError(NAVIGATION2DSERVER) << "General error in navigation2DServer::parse_respond_vocab()";
186  return false;
187  }
188 
189  if (command.get(0).asVocab32() != VOCAB_INAVIGATION ||
190  command.get(1).isVocab32() == false)
191  {
192  yCError(NAVIGATION2DSERVER) << "Invalid vocab received";
193  reply.addVocab32(VOCAB_ERR);
194  return true;
195  }
196 
197  int request = command.get(1).asVocab32();
198  if (request == VOCAB_NAV_GOTOABS)
199  {
200  Map2DLocation loc;
201  loc.map_id = command.get(2).asString();
202  loc.x = command.get(3).asFloat64();
203  loc.y = command.get(4).asFloat64();
204  loc.theta = command.get(5).asFloat64();
206  if (ret)
207  {
208  clear_current_goal_name();
209  reply.addVocab32(VOCAB_OK);
210  }
211  else
212  {
213  yCError(NAVIGATION2DSERVER) << "gotoTargetByAbsoluteLocation() failed";
214  reply.addVocab32(VOCAB_ERR);
215  }
216  }
217  else if (request == VOCAB_NAV_GOTOABS_AND_NAME)
218  {
219  Map2DLocation loc;
220  loc.map_id = command.get(2).asString();
221  loc.x = command.get(3).asFloat64();
222  loc.y = command.get(4).asFloat64();
223  loc.theta = command.get(5).asFloat64();
224  std::string location_name = command.get(6).asString();
226  if (ret)
227  {
228  set_current_goal_name(location_name);
229  reply.addVocab32(VOCAB_OK);
230  }
231  else
232  {
233  yCError(NAVIGATION2DSERVER) << "gotoTargetByAbsoluteLocation() failed";
234  reply.addVocab32(VOCAB_ERR);
235  }
236  }
237  else if (request == VOCAB_NAV_RECOMPUTE_PATH)
238  {
240  if (ret)
241  {
242  reply.addVocab32(VOCAB_OK);
243  }
244  else
245  {
246  yCError(NAVIGATION2DSERVER) << "recomputeCurrentNavigationPath() failed";
247  reply.addVocab32(VOCAB_ERR);
248  }
249  reply.addVocab32(VOCAB_OK);
250  }
251  else if (request == VOCAB_NAV_GOTOREL)
252  {
253  if (command.size() == 5)
254  {
255  double x = command.get(2).asFloat64();
256  double y = command.get(3).asFloat64();
257  double theta = command.get(4).asFloat64();
258  bool ret = iNav_target->gotoTargetByRelativeLocation(x, y, theta);
259  if (ret)
260  {
261  clear_current_goal_name();
262  reply.addVocab32(VOCAB_OK);
263  }
264  else
265  {
266  yCError(NAVIGATION2DSERVER) << "gotoTargetByRelativeLocation() failed";
267  reply.addVocab32(VOCAB_ERR);
268  }
269  }
270  else if (command.size() == 4)
271  {
272  double x = command.get(2).asFloat64();
273  double y = command.get(3).asFloat64();
275  if (ret)
276  {
277  clear_current_goal_name();
278  reply.addVocab32(VOCAB_OK);
279  }
280  else
281  {
282  yCError(NAVIGATION2DSERVER) << "gotoTargetByRelativeLocation() failed";
283  reply.addVocab32(VOCAB_ERR);
284  }
285  }
286  else
287  {
288  yCError(NAVIGATION2DSERVER) << "Invalid number of params";
289  reply.addVocab32(VOCAB_ERR);
290  }
291  }
292  else if (request == VOCAB_NAV_VELOCITY_CMD)
293  {
294  double x_vel = command.get(2).asFloat64();
295  double y_vel = command.get(3).asFloat64();
296  double t_vel = command.get(4).asFloat64();
297  double timeout = command.get(5).asFloat64();
298  bool ret = iNav_target->applyVelocityCommand(x_vel,y_vel,t_vel,timeout);
299  if (ret)
300  {
301  clear_current_goal_name();
302  reply.addVocab32(VOCAB_OK);
303  }
304  else
305  {
306  yCError(NAVIGATION2DSERVER) << "applyVelocityCommand() failed";
307  reply.addVocab32(VOCAB_ERR);
308  }
309  }
310  else if (request == VOCAB_NAV_GET_NAME_TARGET)
311  {
312  reply.addVocab32(VOCAB_OK);
313  reply.addString(m_current_goal_name);
314  }
315  else if (request == VOCAB_NAV_GET_NAVIGATION_STATUS)
316  {
318  bool ret = iNav_ctrl->getNavigationStatus(nav_status);
319  if (ret)
320  {
321  reply.addVocab32(VOCAB_OK);
322  reply.addInt32(nav_status);
323  }
324  else
325  {
326  yCError(NAVIGATION2DSERVER) << "getNavigationStatus() failed";
327  reply.addVocab32(VOCAB_ERR);
328  }
329  }
330  else if (request == VOCAB_NAV_STOP)
331  {
332  bool ret = iNav_ctrl->stopNavigation();
333  if (ret)
334  {
335  clear_current_goal_name();
336  reply.addVocab32(VOCAB_OK);
337  }
338  else
339  {
340  yCError(NAVIGATION2DSERVER) << "stopNavigation() failed";
341  reply.addVocab32(VOCAB_ERR);
342  }
343  }
344  else if (request == VOCAB_NAV_SUSPEND)
345  {
346  double time = -1;
347  if (command.size() > 1)
348  {
349  time = command.get(1).asFloat64();
350  bool ret = iNav_ctrl->suspendNavigation(time);
351  if (ret)
352  {
353  reply.addVocab32(VOCAB_OK);
354  }
355  else
356  {
357  yCError(NAVIGATION2DSERVER) << "suspendNavigation() failed";
358  reply.addVocab32(VOCAB_ERR);
359  }
360  }
361  else
362  {
363  bool ret = iNav_ctrl->suspendNavigation();
364  if (ret)
365  {
366  reply.addVocab32(VOCAB_OK);
367  }
368  else
369  {
370  yCError(NAVIGATION2DSERVER) << "suspendNavigation() failed";
371  reply.addVocab32(VOCAB_ERR);
372  }
373  }
374  }
375  else if (request == VOCAB_NAV_RESUME)
376  {
377  bool ret = iNav_ctrl->resumeNavigation();
378  if (ret)
379  {
380  reply.addVocab32(VOCAB_OK);
381  }
382  else
383  {
384  yCError(NAVIGATION2DSERVER) << "resumeNavigation failed()";
385  reply.addVocab32(VOCAB_ERR);
386  }
387  }
388  else if (request == VOCAB_NAV_GET_NAVIGATION_WAYPOINTS)
389  {
390  Map2DPath locs;
392  if (ret)
393  {
394  reply.addVocab32(VOCAB_OK);
395  Bottle& waypoints = reply.addList();
396  for (auto it = locs.begin(); it!=locs.end(); it++)
397  {
398  Bottle& the_waypoint = waypoints.addList();
399  the_waypoint.addString(it->map_id);
400  the_waypoint.addFloat64(it->x);
401  the_waypoint.addFloat64(it->y);
402  the_waypoint.addFloat64(it->theta);
403  }
404  }
405  else
406  {
407  yCError(NAVIGATION2DSERVER) << "getAllNavigationWaypoints() failed";
408  reply.addVocab32(VOCAB_ERR);
409  }
410  }
411  else if (request == VOCAB_NAV_GET_CURRENT_WAYPOINT)
412  {
413  Map2DLocation loc;
415  if (ret)
416  {
417  reply.addVocab32(VOCAB_OK);
418  reply.addString(loc.map_id);
419  reply.addFloat64(loc.x);
420  reply.addFloat64(loc.y);
421  reply.addFloat64(loc.theta);
422  }
423  else
424  {
425  yCError(NAVIGATION2DSERVER) << "getCurrentNavigationWaypoint() failed";
426  reply.addVocab32(VOCAB_ERR);
427  }
428  }
429  else if (request == VOCAB_NAV_GET_NAV_MAP)
430  {
431  MapGrid2D map;
433  {
434  reply.addVocab32(VOCAB_OK);
435  yarp::os::Bottle& mapbot = reply.addList();
436  Property::copyPortable(map, mapbot);
437  }
438  else
439  {
440  yCError(NAVIGATION2DSERVER) << "getCurrentNavigationMap() failed";
441  reply.addVocab32(VOCAB_ERR);
442  }
443  }
444  else if (request == VOCAB_NAV_GET_ABS_TARGET)
445  {
446  Map2DLocation loc;
447  bool ret;
449  if (ret)
450  {
451  reply.addVocab32(VOCAB_OK);
452  reply.addString(loc.map_id);
453  reply.addFloat64(loc.x);
454  reply.addFloat64(loc.y);
455  reply.addFloat64(loc.theta);
456  }
457  else
458  {
459  yCError(NAVIGATION2DSERVER) << "getAbsoluteLocationOfCurrentTarget() failed";
460  reply.addVocab32(VOCAB_ERR);
461  }
462  }
463  else if (request == VOCAB_NAV_GET_REL_TARGET)
464  {
465  Map2DLocation loc;
466  bool ret;
468  if (ret)
469  {
470  reply.addVocab32(VOCAB_OK);
471  reply.addFloat64(loc.x);
472  reply.addFloat64(loc.y);
473  reply.addFloat64(loc.theta);
474  }
475  else
476  {
477  yCError(NAVIGATION2DSERVER) << "getRelativeLocationOfCurrentTarget() failed";
478  reply.addVocab32(VOCAB_ERR);
479  }
480  }
481  else
482  {
483  yCError(NAVIGATION2DSERVER) << "Invalid vocab received:" << yarp::os::Vocab32::decode(request);
484  reply.addVocab32(VOCAB_ERR);
485  }
486 
487  return true;
488 }
489 
491 {
492  yarp::os::Bottle command;
493  yarp::os::Bottle reply;
494  bool ok = command.read(connection);
495  if (!ok) {
496  return false;
497  }
498  reply.clear();
499 
500  //^^^^^^^^^^^^^^^^^ STRING SECTION
501  if (command.get(0).isString())
502  {
503  parse_respond_string(command, reply);
504  }
505  //^^^^^^^^^^^^^^^^^ VOCAB SECTION
506  else if (command.get(0).isVocab32())
507  {
508  parse_respond_vocab(command, reply);
509  }
510  else
511  {
512  yCError(NAVIGATION2DSERVER) << "Invalid command type";
513  reply.addVocab32(VOCAB_ERR);
514  }
515 
516  yarp::os::ConnectionWriter *returnToSender = connection.getWriter();
517  if (returnToSender != nullptr)
518  {
519  reply.write(*returnToSender);
520  }
521 
522  return true;
523 }
524 
526 {
528 
529  double m_stats_time_curr = yarp::os::Time::now();
530  if (m_stats_time_curr - m_stats_time_last > 5.0)
531  {
532  if (!ok)
533  {
534  yCError(NAVIGATION2DSERVER, "Unable to get Navigation Status!\n");
535  }
536  else
537  {
538  yCInfo(NAVIGATION2DSERVER) << "Running, ALL ok. Navigation status:" << getStatusAsString(m_navigation_status);
539  }
541  }
542 }
543 
544 std::string navigation2DServer::getStatusAsString(NavigationStatusEnum status)
545 {
546  if (status == navigation_status_idle) {
547  return std::string("navigation_status_idle");
548  } else if (status == navigation_status_moving) {
549  return std::string("navigation_status_moving");
550  } else if (status == navigation_status_waiting_obstacle) {
551  return std::string("navigation_status_waiting_obstacle");
552  } else if (status == navigation_status_goal_reached) {
553  return std::string("navigation_status_goal_reached");
554  } else if (status == navigation_status_aborted) {
555  return std::string("navigation_status_aborted");
556  } else if (status == navigation_status_failing) {
557  return std::string("navigation_status_failing");
558  } else if (status == navigation_status_paused) {
559  return std::string("navigation_status_paused");
560  } else if (status == navigation_status_preparing_before_move) {
561  return std::string("navigation_status_preparing_before_move");
562  } else if (status == navigation_status_thinking) {
563  return std::string("navigation_status_thinking");
564  } else if (status == navigation_status_error) {
565  return std::string("navigation_status_error");
566  }
567  return std::string("navigation_status_error");
568 }
569 
570 bool navigation2DServer::set_current_goal_name(const std::string& name)
571 {
572  m_current_goal_name = name;
573  return true;
574 }
575 
576 bool navigation2DServer::get_current_goal_name(std::string& name)
577 {
578  if (m_current_goal_name == "")
579  {
580  return false;
581  }
582  name = m_current_goal_name;
583  return true;
584 }
585 
586 bool navigation2DServer::clear_current_goal_name()
587 {
588  m_current_goal_name = "";
589  return true;
590 }
define control board standard interfaces
constexpr yarp::conf::vocab32_t VOCAB_OK
Definition: GenericVocabs.h:15
constexpr yarp::conf::vocab32_t VOCAB_ERR
Definition: GenericVocabs.h:17
constexpr yarp::conf::vocab32_t VOCAB_NAV_GOTOABS_AND_NAME
constexpr yarp::conf::vocab32_t VOCAB_NAV_VELOCITY_CMD
constexpr yarp::conf::vocab32_t VOCAB_INAVIGATION
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_ABS_TARGET
constexpr yarp::conf::vocab32_t VOCAB_NAV_RECOMPUTE_PATH
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_REL_TARGET
constexpr yarp::conf::vocab32_t VOCAB_NAV_GOTOREL
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAME_TARGET
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAVIGATION_STATUS
constexpr yarp::conf::vocab32_t VOCAB_NAV_GOTOABS
constexpr yarp::conf::vocab32_t VOCAB_NAV_RESUME
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_CURRENT_WAYPOINT
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAVIGATION_WAYPOINTS
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAV_MAP
constexpr yarp::conf::vocab32_t VOCAB_NAV_STOP
constexpr yarp::conf::vocab32_t VOCAB_NAV_SUSPEND
bool ret
contains the definition of a map type
constexpr double DEFAULT_THREAD_PERIOD
navigation2DServer()
Default module constructor.
bool initialize_YARP(yarp::os::Searchable &config)
yarp::os::Port m_rpcPort
virtual bool attachAll(const yarp::dev::PolyDriverList &l) override
Attach to a list of objects.
yarp::dev::Nav2D::NavigationStatusEnum m_navigation_status
std::string m_streamingPortName
virtual bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
yarp::dev::PolyDriver pNav
yarp::dev::Nav2D::INavigation2DControlActions * iNav_ctrl
virtual bool detachAll() override
Detach the object (you must have first called attach).
virtual bool close() override
Close the DeviceDriver.
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual void run() override
Loop function.
yarp::dev::Nav2D::INavigation2DTargetActions * iNav_target
bool view(T *&x)
Get an interface to the device driver.
Definition: DeviceDriver.h:74
virtual bool recomputeCurrentNavigationPath()=0
Forces the navigation system to recompute the path from the current robot position to the current goa...
virtual bool getAllNavigationWaypoints(yarp::dev::Nav2D::TrajectoryTypeEnum trajectory_type, yarp::dev::Nav2D::Map2DPath &waypoints)=0
Returns the list of waypoints generated by the navigation algorithm.
virtual bool getCurrentNavigationWaypoint(yarp::dev::Nav2D::Map2DLocation &curr_waypoint)=0
Returns the current waypoint pursued by the navigation algorithm.
virtual bool resumeNavigation()=0
Resume a previously suspended navigation task.
virtual bool getNavigationStatus(NavigationStatusEnum &status)=0
Gets the current status of the navigation task.
virtual bool stopNavigation()=0
Terminates the current navigation task.
virtual bool suspendNavigation(const double time_s=std::numeric_limits< double >::infinity())=0
Ask to the robot to suspend the current navigation task for a defined amount of time.
virtual bool getCurrentNavigationMap(yarp::dev::Nav2D::NavigationMapTypeEnum map_type, yarp::dev::Nav2D::MapGrid2D &map)=0
Returns the current navigation map processed by the navigation algorithm.
virtual bool gotoTargetByRelativeLocation(double x, double y)=0
Ask the robot to reach a position defined in the robot reference frame.
virtual bool gotoTargetByAbsoluteLocation(yarp::dev::Nav2D::Map2DLocation loc)=0
Ask the robot to reach a position defined in the world reference frame.
virtual bool getAbsoluteLocationOfCurrentTarget(yarp::dev::Nav2D::Map2DLocation &loc)=0
Gets the last navigation target in the world reference frame.
virtual bool applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout=0.1)=0
Apply a velocity command.
virtual bool getRelativeLocationOfCurrentTarget(double &x, double &y, double &theta)=0
Gets the last navigation target in the robot reference frame.
iterator begin() noexcept
Returns an iterator to the begin of the Path.
Definition: Map2DPath.cpp:106
iterator end() noexcept
Returns an iterator to the end of the Path.
Definition: Map2DPath.cpp:112
void push(PolyDriver *p, const char *k)
A container for a device driver.
Definition: PolyDriver.h:24
bool isValid() const
Check if device is valid.
Definition: PolyDriver.cpp:196
bool open(const std::string &txt)
Construct and configure a device by its common name.
Definition: PolyDriver.cpp:140
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:74
void addVocab32(yarp::conf::vocab32_t x)
Places a vocabulary item in the bottle, at the end of the list.
Definition: Bottle.cpp:164
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
Definition: Bottle.cpp:182
size_type size() const
Gets the number of elements in the bottle.
Definition: Bottle.cpp:251
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
Definition: Bottle.cpp:240
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
Definition: Bottle.cpp:158
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition: Bottle.cpp:246
void clear()
Empties the bottle of any objects it contains.
Definition: Bottle.cpp:121
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
Definition: Bottle.cpp:230
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
Definition: Bottle.cpp:140
void addString(const char *str)
Places a string in the bottle, at the end of the list.
Definition: Bottle.cpp:170
An interface for reading from a network connection.
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
An interface for writing to a network connection.
An abstraction for a periodic thread.
void setReader(PortReader &reader) override
Set an external reader for port data.
Definition: Port.cpp:502
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
Definition: Port.cpp:79
A class for storing options and configuration information.
Definition: Property.h:34
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
Definition: Property.cpp:1063
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition: Property.cpp:1015
A base class for nested structures that can be searched.
Definition: Searchable.h:66
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
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 yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition: Value.cpp:222
virtual bool isString() const
Checks if value is a string.
Definition: Value.cpp:156
virtual yarp::conf::vocab32_t asVocab32() const
Get vocabulary identifier as an integer.
Definition: Value.cpp:228
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition: Value.cpp:204
virtual bool isVocab32() const
Checks if value is a vocabulary identifier.
Definition: Value.cpp:174
virtual std::string asString() const
Get string value.
Definition: Value.cpp:234
#define yCInfo(component,...)
Definition: LogComponent.h:132
#define yCError(component,...)
Definition: LogComponent.h:154
#define yCTrace(component,...)
Definition: LogComponent.h:85
#define yCDebug(component,...)
Definition: LogComponent.h:109
#define YARP_LOG_COMPONENT(name,...)
Definition: LogComponent.h:77
@ navigation_status_preparing_before_move
Definition: INavigation2D.h:31
@ navigation_status_goal_reached
Definition: INavigation2D.h:34
@ navigation_status_waiting_obstacle
Definition: INavigation2D.h:33
An interface for the device drivers.
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition: Time.cpp:121
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
Definition: Vocab.cpp:33
An interface to the operating system, including Port based communication.