YARP
Yet Another Robot Platform
Map2DClient.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
21 #include "Map2DClient.h"
22 #include <yarp/os/Log.h>
23 #include <yarp/os/LogComponent.h>
24 #include <yarp/os/LogStream.h>
25 #include <mutex>
26 #include <yarp/dev/INavigation2D.h>
27 #include <yarp/dev/GenericVocabs.h>
28 
29 using namespace yarp::dev;
30 using namespace yarp::dev::Nav2D;
31 using namespace yarp::os;
32 using namespace yarp::sig;
33 
34 namespace {
35 YARP_LOG_COMPONENT(MAP2DCLIENT, "yarp.device.map2DClient")
36 }
37 
38 //------------------------------------------------------------------------------------------------------------------------------
39 
41 {
42  m_local_name.clear();
43  m_map_server.clear();
44 
45  m_local_name = config.find("local").asString();
46  m_map_server = config.find("remote").asString();
47 
48  if (m_local_name == "")
49  {
50  yCError(MAP2DCLIENT, "open() error you have to provide valid local name");
51  return false;
52  }
53  if (m_map_server == "")
54  {
55  yCError(MAP2DCLIENT, "open() error you have to provide valid remote name");
56  return false;
57  }
58 
59  std::string local_rpc1 = m_local_name;
60  local_rpc1 += "/mapClient_rpc";
61 
62  std::string remote_rpc1 = m_map_server;
63  remote_rpc1 += "/rpc";
64 
65  if (!m_rpcPort_to_Map2DServer.open(local_rpc1))
66  {
67  yCError(MAP2DCLIENT, "open() error could not open rpc port %s, check network", local_rpc1.c_str());
68  return false;
69  }
70 
71  bool ok=false;
72  ok=Network::connect(local_rpc1, remote_rpc1);
73  if (!ok)
74  {
75  yCError(MAP2DCLIENT, "open() error could not connect to %s", remote_rpc1.c_str());
76  return false;
77  }
78 
79  return true;
80 }
81 
83 {
85  yarp::os::Bottle resp;
86 
89  yarp::os::Bottle& mapbot = b.addList();
90  MapGrid2D maptemp = map;
91  if (Property::copyPortable(maptemp, mapbot) == false)
92  {
93  yCError(MAP2DCLIENT) << "store_map() failed copyPortable()";
94  return false;
95  }
96  //yCDebug(MAP2DCLIENT) << b.toString();
97  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
98  if (ret)
99  {
100  if (resp.get(0).asVocab() != VOCAB_IMAP_OK)
101  {
102  yCError(MAP2DCLIENT) << "store_map() received error from server";
103  return false;
104  }
105  }
106  else
107  {
108  yCError(MAP2DCLIENT) << "store_map() error on writing on rpc port";
109  return false;
110  }
111  return true;
112 }
113 
114 bool Map2DClient::get_map(std::string map_name, MapGrid2D& map)
115 {
117  yarp::os::Bottle resp;
118 
119  b.addVocab(VOCAB_IMAP);
121  b.addString(map_name);
122 
123  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
124  if (ret)
125  {
126  if (resp.get(0).asVocab() != VOCAB_IMAP_OK)
127  {
128  yCError(MAP2DCLIENT) << "get_map() received error from server";
129  return false;
130  }
131  else
132  {
133  Value& bt = resp.get(1);
134  if (Property::copyPortable(bt, map))
135  {
136  return true;
137  }
138  else
139  {
140  yCError(MAP2DCLIENT) << "get_map() failed copyPortable()";
141  return false;
142  }
143  }
144  }
145  else
146  {
147  yCError(MAP2DCLIENT) << "get_map() error on writing on rpc port";
148  return false;
149  }
150  return true;
151 }
152 
154 {
156  yarp::os::Bottle resp;
157 
158  b.addVocab(VOCAB_IMAP);
160 
161  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
162  if (ret)
163  {
164  if (resp.get(0).asVocab() != VOCAB_IMAP_OK)
165  {
166  yCError(MAP2DCLIENT) << "clear() received error from server";
167  return false;
168  }
169  }
170  else
171  {
172  yCError(MAP2DCLIENT) << "clear() error on writing on rpc port";
173  return false;
174  }
175  return true;
176 }
177 
178 bool Map2DClient::get_map_names(std::vector<std::string>& map_names)
179 {
180  map_names.clear();
182  yarp::os::Bottle resp;
183 
184  b.addVocab(VOCAB_IMAP);
186  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
187  if (ret)
188  {
189  if (resp.get(0).asVocab() != VOCAB_IMAP_OK)
190  {
191  yCError(MAP2DCLIENT) << "get_map_names() received error from server";
192  return false;
193  }
194  else
195  {
196  for (size_t i = 1; i < resp.size(); i++)
197  {
198  map_names.push_back(resp.get(i).asString());
199  }
200  return true;
201  }
202  }
203  else
204  {
205  yCError(MAP2DCLIENT) << "get_map_names() error on writing on rpc port";
206  return false;
207  }
208  return true;
209 }
210 
211 bool Map2DClient::remove_map(std::string map_name)
212 {
214  yarp::os::Bottle resp;
215 
216  b.addVocab(VOCAB_IMAP);
218  b.addString(map_name);
219 
220  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
221  if (ret)
222  {
223  if (resp.get(0).asVocab() != VOCAB_IMAP_OK)
224  {
225  yCError(MAP2DCLIENT) << "remove_map() received error from server";
226  return false;
227  }
228  }
229  else
230  {
231  yCError(MAP2DCLIENT) << "remove_map() error on writing on rpc port";
232  return false;
233  }
234  return true;
235 }
236 
237 bool Map2DClient::storeLocation(std::string location_name, Map2DLocation loc)
238 {
240  yarp::os::Bottle resp;
241 
245  b.addString(location_name);
246  b.addString(loc.map_id);
247  b.addFloat64(loc.x);
248  b.addFloat64(loc.y);
249  b.addFloat64(loc.theta);
250 
251  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
252  if (ret)
253  {
254  if (resp.get(0).asVocab() != VOCAB_OK)
255  {
256  yCError(MAP2DCLIENT) << "storeLocation() received error from locations server";
257  return false;
258  }
259  }
260  else
261  {
262  yCError(MAP2DCLIENT) << "storeLocation() error on writing on rpc port";
263  return false;
264  }
265  return true;
266 }
267 
268 bool Map2DClient::storeArea(std::string area_name, Map2DArea area)
269 {
271  yarp::os::Bottle resp;
272 
276  b.addString(area_name);
277  yarp::os::Bottle& areabot = b.addList();
278  Map2DArea areatemp = area;
279  if (Property::copyPortable(areatemp, areabot) == false)
280  {
281  yCError(MAP2DCLIENT) << "storeArea() failed copyPortable()";
282  return false;
283  }
284 
285  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
286  if (ret)
287  {
288  if (resp.get(0).asVocab() != VOCAB_OK)
289  {
290  yCError(MAP2DCLIENT) << "storeArea() received error from locations server";
291  return false;
292  }
293  }
294  else
295  {
296  yCError(MAP2DCLIENT) << "storeArea() error on writing on rpc port";
297  return false;
298  }
299  return true;
300 }
301 
302 bool Map2DClient::storePath(std::string path_name, Map2DPath path)
303 {
305  yarp::os::Bottle resp;
306 
310  b.addString(path_name);
311  yarp::os::Bottle& areabot = b.addList();
312  Map2DPath pathtemp = path;
313  if (Property::copyPortable(pathtemp, areabot) == false)
314  {
315  yCError(MAP2DCLIENT) << "storePath() failed copyPortable()";
316  return false;
317  }
318 
319  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
320  if (ret)
321  {
322  if (resp.get(0).asVocab() != VOCAB_OK)
323  {
324  yCError(MAP2DCLIENT) << "storePath() received error from locations server";
325  return false;
326  }
327  }
328  else
329  {
330  yCError(MAP2DCLIENT) << "storePath() error on writing on rpc port";
331  return false;
332  }
333  return true;
334 }
335 
336 bool Map2DClient::getLocationsList(std::vector<std::string>& locations)
337 {
339  yarp::os::Bottle resp;
340 
344 
345  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
346  if (ret)
347  {
348  if (resp.get(0).asVocab() != VOCAB_OK)
349  {
350  yCError(MAP2DCLIENT) << "getLocationsList() received error from locations server";
351  return false;
352  }
353  else
354  {
355  Bottle* list = resp.get(1).asList();
356  if (list)
357  {
358  locations.clear();
359  for (size_t i = 0; i < list->size(); i++)
360  {
361  locations.push_back(list->get(i).asString());
362  }
363  return true;
364  }
365  else
366  {
367  yCError(MAP2DCLIENT) << "getLocationsList() error while reading from locations server";
368  return false;
369  }
370  }
371  }
372  else
373  {
374  yCError(MAP2DCLIENT) << "getLocationsList() error on writing on rpc port";
375  return false;
376  }
377  return true;
378 }
379 
380 bool Map2DClient::getAreasList(std::vector<std::string>& areas)
381 {
383  yarp::os::Bottle resp;
384 
388 
389  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
390  if (ret)
391  {
392  if (resp.get(0).asVocab() != VOCAB_OK)
393  {
394  yCError(MAP2DCLIENT) << "getAreasList() received error from locations server";
395  return false;
396  }
397  else
398  {
399  Bottle* list = resp.get(1).asList();
400  if (list)
401  {
402  areas.clear();
403  for (size_t i = 0; i < list->size(); i++)
404  {
405  areas.push_back(list->get(i).asString());
406  }
407  return true;
408  }
409  else
410  {
411  yCError(MAP2DCLIENT) << "getAreasList() error while reading from locations server";
412  return false;
413  }
414  }
415  }
416  else
417  {
418  yCError(MAP2DCLIENT) << "getAreasList() error on writing on rpc port";
419  return false;
420  }
421  return true;
422 }
423 
424 bool Map2DClient::getPathsList(std::vector<std::string>& paths)
425 {
427  yarp::os::Bottle resp;
428 
432 
433  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
434  if (ret)
435  {
436  if (resp.get(0).asVocab() != VOCAB_OK)
437  {
438  yCError(MAP2DCLIENT) << "getPathsList() received error from locations server";
439  return false;
440  }
441  else
442  {
443  Bottle* list = resp.get(1).asList();
444  if (list)
445  {
446  paths.clear();
447  for (size_t i = 0; i < list->size(); i++)
448  {
449  paths.push_back(list->get(i).asString());
450  }
451  return true;
452  }
453  else
454  {
455  yCError(MAP2DCLIENT) << "getPathsList() error while reading from locations server";
456  return false;
457  }
458  }
459  }
460  else
461  {
462  yCError(MAP2DCLIENT) << "getPathsList() error on writing on rpc port";
463  return false;
464  }
465  return true;
466 }
467 
468 bool Map2DClient::getLocation(std::string location_name, Map2DLocation& loc)
469 {
471  yarp::os::Bottle resp;
472 
476  b.addString(location_name);
477 
478  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
479  if (ret)
480  {
481  if (resp.get(0).asVocab() != VOCAB_OK)
482  {
483  yCError(MAP2DCLIENT) << "getLocation() received error from locations server";
484  return false;
485  }
486  else
487  {
488  loc.map_id = resp.get(1).asString();
489  loc.x = resp.get(2).asFloat64();
490  loc.y = resp.get(3).asFloat64();
491  loc.theta = resp.get(4).asFloat64();
492  }
493  }
494  else
495  {
496  yCError(MAP2DCLIENT) << "getLocation() error on writing on rpc port";
497  return false;
498  }
499  return true;
500 }
501 
502 bool Map2DClient::getArea(std::string location_name, Map2DArea& area)
503 {
505  yarp::os::Bottle resp;
506 
510  b.addString(location_name);
511 
512  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
513  if (ret)
514  {
515  if (resp.get(0).asVocab() != VOCAB_OK)
516  {
517  yCError(MAP2DCLIENT) << "getArea() received error from locations server";
518  return false;
519  }
520  else
521  {
522  Value& bt = resp.get(1);
523  if (Property::copyPortable(bt, area))
524  {
525  return true;
526  }
527  else
528  {
529  yCError(MAP2DCLIENT) << "getArea() failed copyPortable()";
530  return false;
531  }
532  }
533  }
534  else
535  {
536  yCError(MAP2DCLIENT) << "getArea() error on writing on rpc port";
537  return false;
538  }
539  return true;
540 }
541 
542 bool Map2DClient::getPath(std::string path_name, Map2DPath& path)
543 {
545  yarp::os::Bottle resp;
546 
550  b.addString(path_name);
551 
552  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
553  if (ret)
554  {
555  if (resp.get(0).asVocab() != VOCAB_OK)
556  {
557  yCError(MAP2DCLIENT) << "getPath() received error from locations server";
558  return false;
559  }
560  else
561  {
562  Value& bt = resp.get(1);
563  if (Property::copyPortable(bt, path))
564  {
565  return true;
566  }
567  else
568  {
569  yCError(MAP2DCLIENT) << "getPath() failed copyPortable()";
570  return false;
571  }
572  }
573  }
574  else
575  {
576  yCError(MAP2DCLIENT) << "getPath() error on writing on rpc port";
577  return false;
578  }
579  return true;
580 }
581 
582 bool Map2DClient::deleteLocation(std::string location_name)
583 {
585  yarp::os::Bottle resp;
586 
590  b.addString(location_name);
591 
592  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
593  if (ret)
594  {
595  if (resp.get(0).asVocab() != VOCAB_OK)
596  {
597  yCError(MAP2DCLIENT) << "deleteLocation() received error from locations server";
598  return false;
599  }
600  }
601  else
602  {
603  yCError(MAP2DCLIENT) << "deleteLocation() error on writing on rpc port";
604  return false;
605  }
606  return true;
607 }
608 
609 bool Map2DClient::renameLocation(std::string original_name, std::string new_name)
610 {
612  yarp::os::Bottle resp;
613 
617  b.addString(original_name);
618  b.addString(new_name);
619 
620  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
621  if (ret)
622  {
623  if (resp.get(0).asVocab() != VOCAB_OK)
624  {
625  yCError(MAP2DCLIENT) << "renameLocation() received error from locations server";
626  return false;
627  }
628  }
629  else
630  {
631  yCError(MAP2DCLIENT) << "renameLocation() error on writing on rpc port";
632  return false;
633  }
634  return true;
635 }
636 
637 bool Map2DClient::deleteArea(std::string location_name)
638 {
640  yarp::os::Bottle resp;
641 
645  b.addString(location_name);
646 
647  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
648  if (ret)
649  {
650  if (resp.get(0).asVocab() != VOCAB_OK)
651  {
652  yCError(MAP2DCLIENT) << "deleteArea() received error from locations server";
653  return false;
654  }
655  }
656  else
657  {
658  yCError(MAP2DCLIENT) << "deleteArea() error on writing on rpc port";
659  return false;
660  }
661  return true;
662 }
663 
664 bool Map2DClient::deletePath(std::string path_name)
665 {
667  yarp::os::Bottle resp;
668 
672  b.addString(path_name);
673 
674  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
675  if (ret)
676  {
677  if (resp.get(0).asVocab() != VOCAB_OK)
678  {
679  yCError(MAP2DCLIENT) << "deletePath() received error from locations server";
680  return false;
681  }
682  }
683  else
684  {
685  yCError(MAP2DCLIENT) << "deletePath() error on writing on rpc port";
686  return false;
687  }
688  return true;
689 }
690 
691 bool Map2DClient::renameArea(std::string original_name, std::string new_name)
692 {
694  yarp::os::Bottle resp;
695 
699  b.addString(original_name);
700  b.addString(new_name);
701 
702  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
703  if (ret)
704  {
705  if (resp.get(0).asVocab() != VOCAB_OK)
706  {
707  yCError(MAP2DCLIENT) << "renameArea() received error from locations server";
708  return false;
709  }
710  }
711  else
712  {
713  yCError(MAP2DCLIENT) << "renameArea() error on writing on rpc port";
714  return false;
715  }
716  return true;
717 }
718 
719 bool Map2DClient::renamePath(std::string original_name, std::string new_name)
720 {
722  yarp::os::Bottle resp;
723 
727  b.addString(original_name);
728  b.addString(new_name);
729 
730  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
731  if (ret)
732  {
733  if (resp.get(0).asVocab() != VOCAB_OK)
734  {
735  yCError(MAP2DCLIENT) << "renamePath() received error from locations server";
736  return false;
737  }
738  }
739  else
740  {
741  yCError(MAP2DCLIENT) << "renamePath() error on writing on rpc port";
742  return false;
743  }
744  return true;
745 }
746 
748 {
750  yarp::os::Bottle resp;
751 
755 
756  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
757  if (ret)
758  {
759  if (resp.get(0).asVocab() != VOCAB_OK)
760  {
761  yCError(MAP2DCLIENT) << "clearAllLocations() received error from locations server";
762  return false;
763  }
764  }
765  else
766  {
767  yCError(MAP2DCLIENT) << "clearAllLocations() error on writing on rpc port";
768  return false;
769  }
770  return true;
771 }
772 
774 {
776  yarp::os::Bottle resp;
777 
781 
782  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
783  if (ret)
784  {
785  if (resp.get(0).asVocab() != VOCAB_OK)
786  {
787  yCError(MAP2DCLIENT) << "clearAllAreas() received error from locations server";
788  return false;
789  }
790  }
791  else
792  {
793  yCError(MAP2DCLIENT) << "clearAllAreas() error on writing on rpc port";
794  return false;
795  }
796  return true;
797 }
798 
800 {
802  yarp::os::Bottle resp;
803 
807 
808  bool ret = m_rpcPort_to_Map2DServer.write(b, resp);
809  if (ret)
810  {
811  if (resp.get(0).asVocab() != VOCAB_OK)
812  {
813  yCError(MAP2DCLIENT) << "clearAllPaths() received error from locations server";
814  return false;
815  }
816  }
817  else
818  {
819  yCError(MAP2DCLIENT) << "clearAllPaths() error on writing on rpc port";
820  return false;
821  }
822  return true;
823 }
824 
826 {
827  return true;
828 }
LogStream.h
INavigation2D.h
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
VOCAB_IMAP_SET_MAP
constexpr yarp::conf::vocab32_t VOCAB_IMAP_SET_MAP
Definition: IMap2D.h:210
VOCAB_IMAP_REMOVE
constexpr yarp::conf::vocab32_t VOCAB_IMAP_REMOVE
Definition: IMap2D.h:214
yarp::os::Value::asVocab
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
Definition: Value.cpp:231
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
yarp::os::Bottle::size
size_type size() const
Gets the number of elements in the bottle.
Definition: Bottle.cpp:254
yarp::dev::Map2DLocationData::y
double y
Definition: Map2DLocationData.h:32
yarp::sig
Signal processing.
Definition: Image.h:25
Map2DClient::open
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: Map2DClient.cpp:40
Map2DClient::renameArea
bool renameArea(std::string original_name, std::string new_name) override
Searches for an area and renames it.
Definition: Map2DClient.cpp:691
VOCAB_NAV_LOCATION
constexpr yarp::conf::vocab32_t VOCAB_NAV_LOCATION
Definition: ILocalization2D.h:136
VOCAB_IMAP_GET_MAP
constexpr yarp::conf::vocab32_t VOCAB_IMAP_GET_MAP
Definition: IMap2D.h:211
Map2DClient::getLocationsList
bool getLocationsList(std::vector< std::string > &locations) override
Get a list of all stored locations.
Definition: Map2DClient.cpp:336
YARP_LOG_COMPONENT
#define YARP_LOG_COMPONENT(name,...)
Definition: LogComponent.h:80
VOCAB_NAV_DELETE_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_DELETE_X
Definition: ILocalization2D.h:132
Map2DClient::deleteArea
bool deleteArea(std::string location_name) override
Delete an area.
Definition: Map2DClient.cpp:637
ret
bool ret
Definition: ImplementAxisInfo.cpp:72
Map2DClient::renamePath
bool renamePath(std::string original_name, std::string new_name) override
Searches for a path and renames it.
Definition: Map2DClient.cpp:719
VOCAB_NAV_CLEAR_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_CLEAR_X
Definition: ILocalization2D.h:131
VOCAB_NAV_RENAME_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_RENAME_X
Definition: ILocalization2D.h:133
yarp::os::Bottle::addFloat64
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:161
yarp::dev::Map2DLocationData::theta
double theta
Definition: Map2DLocationData.h:33
Map2DClient::close
bool close() override
Close the DeviceDriver.
Definition: Map2DClient.cpp:825
VOCAB_IMAP_GET_NAMES
constexpr yarp::conf::vocab32_t VOCAB_IMAP_GET_NAMES
Definition: IMap2D.h:212
yarp::dev
An interface for the device drivers.
Definition: audioBufferSizeData.cpp:17
Map2DClient::get_map_names
bool get_map_names(std::vector< std::string > &map_names) override
Gets a list containing the names of all registered maps.
Definition: Map2DClient.cpp:178
Map2DClient::clearAllMaps
bool clearAllMaps() override
Removes all the registered maps from the server.
Definition: Map2DClient.cpp:153
VOCAB_NAV_GET_LIST_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_LIST_X
Definition: ILocalization2D.h:118
Log.h
Map2DClient::get_map
bool get_map(std::string map_name, yarp::dev::Nav2D::MapGrid2D &map) override
Gets a map from the map server.
Definition: Map2DClient.cpp:114
Map2DClient::deletePath
bool deletePath(std::string path_name) override
Delete a path.
Definition: Map2DClient.cpp:664
yarp::os::Bottle::get
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition: Bottle.cpp:249
yarp::os::Bottle::addList
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
Definition: Bottle.cpp:185
Map2DClient::clearAllAreas
bool clearAllAreas() override
Delete all stored areas.
Definition: Map2DClient.cpp:773
Map2DClient::clearAllPaths
bool clearAllPaths() override
Delete all stored paths.
Definition: Map2DClient.cpp:799
yarp::dev::Nav2D::MapGrid2D
Definition: MapGrid2D.h:32
Map2DClient::getAreasList
bool getAreasList(std::vector< std::string > &locations) override
Get a list of all stored areas.
Definition: Map2DClient.cpp:380
Map2DClient::getLocation
bool getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation &loc) override
Retrieves a location specified by the user in the world reference frame.
Definition: Map2DClient.cpp:468
yarp::os::Value::asString
virtual std::string asString() const
Get string value.
Definition: Value.cpp:237
Map2DClient::deleteLocation
bool deleteLocation(std::string location_name) override
Delete a location.
Definition: Map2DClient.cpp:582
VOCAB_NAV_AREA
constexpr yarp::conf::vocab32_t VOCAB_NAV_AREA
Definition: ILocalization2D.h:135
VOCAB_NAV_GET_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_X
Definition: ILocalization2D.h:117
yarp::os::Searchable::find
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
Map2DClient::storeArea
bool storeArea(std::string location_name, yarp::dev::Nav2D::Map2DArea area) override
Store an area.
Definition: Map2DClient.cpp:268
Map2DClient::storeLocation
bool storeLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation loc) override
Store a location specified by the user in the world reference frame.
Definition: Map2DClient.cpp:237
Map2DClient::getPath
bool getPath(std::string path_name, yarp::dev::Nav2D::Map2DPath &path) override
Retrieves a path.
Definition: Map2DClient.cpp:542
yarp::dev::Nav2D::Map2DPath
Definition: Map2DPath.h:27
yarp::dev::Nav2D
Definition: ILocalization2D.h:21
yarp::os::Bottle::addString
void addString(const char *str)
Places a string in the bottle, at the end of the list.
Definition: Bottle.cpp:173
yarp::os::Bottle::addVocab
void addVocab(int x)
Places a vocabulary item in the bottle, at the end of the list.
Definition: Bottle.cpp:167
LogComponent.h
VOCAB_IMAP_CLEAR
constexpr yarp::conf::vocab32_t VOCAB_IMAP_CLEAR
Definition: IMap2D.h:213
Map2DClient::getPathsList
bool getPathsList(std::vector< std::string > &paths) override
Get a list of all stored paths.
Definition: Map2DClient.cpp:424
yarp::dev::Nav2D::Map2DLocation
Definition: Map2DLocation.h:30
VOCAB_IMAP_OK
constexpr yarp::conf::vocab32_t VOCAB_IMAP_OK
Definition: IMap2D.h:217
Map2DClient.h
yCError
#define yCError(component,...)
Definition: LogComponent.h:157
Map2DClient::store_map
bool store_map(const yarp::dev::Nav2D::MapGrid2D &map) override
Stores a map into the map server.
Definition: Map2DClient.cpp:82
yarp::os
An interface to the operating system, including Port based communication.
Definition: AbstractCarrier.h:17
VOCAB_NAV_PATH
constexpr yarp::conf::vocab32_t VOCAB_NAV_PATH
Definition: ILocalization2D.h:137
Map2DClient::clearAllLocations
bool clearAllLocations() override
Delete all stored locations.
Definition: Map2DClient.cpp:747
VOCAB_NAV_STORE_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_STORE_X
Definition: ILocalization2D.h:134
Map2DClient::renameLocation
bool renameLocation(std::string original_name, std::string new_name) override
Searches for a location and renames it.
Definition: Map2DClient.cpp:609
yarp::os::Value::asList
virtual Bottle * asList() const
Get list value.
Definition: Value.cpp:243
Map2DClient::remove_map
bool remove_map(std::string map_name) override
Removes a map from the map server.
Definition: Map2DClient.cpp:211
yarp::dev::Nav2D::Map2DArea
Definition: Map2DArea.h:30
yarp::dev::Map2DLocationData::x
double x
Definition: Map2DLocationData.h:31
Map2DClient::getArea
bool getArea(std::string location_name, yarp::dev::Nav2D::Map2DArea &area) override
Retrieves an area.
Definition: Map2DClient.cpp:502
Map2DClient::storePath
bool storePath(std::string path_name, yarp::dev::Nav2D::Map2DPath path) override
Store a path.
Definition: Map2DClient.cpp:302
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
GenericVocabs.h
yarp::dev::Map2DLocationData::map_id
std::string map_id
Definition: Map2DLocationData.h:30
yarp::os::Value::asFloat64
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition: Value.cpp:225
VOCAB_OK
constexpr yarp::conf::vocab32_t VOCAB_OK
Definition: GenericVocabs.h:18
VOCAB_IMAP
constexpr yarp::conf::vocab32_t VOCAB_IMAP
Definition: IMap2D.h:209
VOCAB_INAVIGATION
constexpr yarp::conf::vocab32_t VOCAB_INAVIGATION
Definition: ILocalization2D.h:110