YARP
Yet Another Robot Platform
Map2DClient.h
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 
19 #ifndef YARP_DEV_MAP2DCLIENT_H
20 #define YARP_DEV_MAP2DCLIENT_H
21 
22 
23 #include <yarp/os/Network.h>
24 #include <yarp/os/BufferedPort.h>
26 #include <yarp/dev/IMap2D.h>
27 #include <yarp/sig/Vector.h>
28 #include <yarp/dev/MapGrid2D.h>
29 #include <yarp/dev/Map2DLocation.h>
30 #include <yarp/dev/Map2DArea.h>
31 #include <yarp/os/Semaphore.h>
32 #include <yarp/os/Time.h>
33 #include <yarp/dev/PolyDriver.h>
34 
35 
49 class Map2DClient :
52 {
53 protected:
55  std::string m_local_name;
56  std::string m_map_server;
57 
58 public:
59 
60  /* DeviceDriver methods */
61  bool open(yarp::os::Searchable& config) override;
62  bool close() override;
63 
64  /* The following methods belong to IMap2D interface */
65  bool clearAllMaps () override;
66  bool remove_map (std::string map_name) override;
67  bool store_map (const yarp::dev::Nav2D::MapGrid2D& map) override;
68  bool get_map (std::string map_name, yarp::dev::Nav2D::MapGrid2D& map) override;
69  bool get_map_names(std::vector<std::string>& map_names) override;
70 
71  bool storeLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation loc) override;
72  bool storeArea(std::string location_name, yarp::dev::Nav2D::Map2DArea area) override;
73  bool storePath(std::string path_name, yarp::dev::Nav2D::Map2DPath path) override;
74 
75  bool getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation& loc) override;
76  bool getArea(std::string location_name, yarp::dev::Nav2D::Map2DArea& area) override;
77  bool getPath(std::string path_name, yarp::dev::Nav2D::Map2DPath& path) override;
78 
79  bool renameLocation(std::string original_name, std::string new_name) override;
80  bool renameArea(std::string original_name, std::string new_name) override;
81  bool renamePath(std::string original_name, std::string new_name) override;
82 
83  bool deleteLocation(std::string location_name) override;
84  bool deleteArea(std::string location_name) override;
85  bool deletePath(std::string path_name) override;
86 
87  bool getLocationsList(std::vector<std::string>& locations) override;
88  bool getAreasList(std::vector<std::string>& locations) override;
89  bool getPathsList(std::vector<std::string>& paths) override;
90 
91  bool clearAllLocations() override;
92  bool clearAllAreas() override;
93  bool clearAllPaths() override;
94 };
95 
96 #endif // YARP_DEV_MAP2DCLIENT_H
contains the definition of a Map2DArea type
contains the definition of a Map2DLocation type
contains the definition of a map type
contains the definition of a Vector type
bool getAreasList(std::vector< std::string > &locations) override
Get a list of all stored areas.
bool storeArea(std::string location_name, yarp::dev::Nav2D::Map2DArea area) override
Store an area.
bool deleteArea(std::string location_name) override
Delete an area.
bool renameLocation(std::string original_name, std::string new_name) override
Searches for a location and renames it.
bool getPathsList(std::vector< std::string > &paths) override
Get a list of all stored paths.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: Map2DClient.cpp:40
bool store_map(const yarp::dev::Nav2D::MapGrid2D &map) override
Stores a map into the map server.
Definition: Map2DClient.cpp:82
bool clearAllPaths() override
Delete all stored paths.
bool renameArea(std::string original_name, std::string new_name) override
Searches for an area and renames it.
std::string m_map_server
Definition: Map2DClient.h:56
bool getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation &loc) override
Retrieves a location specified by the user in the world reference frame.
bool renamePath(std::string original_name, std::string new_name) override
Searches for a path and renames it.
yarp::os::Port m_rpcPort_to_Map2DServer
Definition: Map2DClient.h:54
bool getLocationsList(std::vector< std::string > &locations) override
Get a list of all stored locations.
bool storePath(std::string path_name, yarp::dev::Nav2D::Map2DPath path) override
Store a path.
bool deletePath(std::string path_name) override
Delete a path.
bool getPath(std::string path_name, yarp::dev::Nav2D::Map2DPath &path) override
Retrieves a path.
bool get_map_names(std::vector< std::string > &map_names) override
Gets a list containing the names of all registered maps.
bool deleteLocation(std::string location_name) override
Delete a location.
bool remove_map(std::string map_name) override
Removes a map from the map server.
bool getArea(std::string location_name, yarp::dev::Nav2D::Map2DArea &area) override
Retrieves an area.
bool get_map(std::string map_name, yarp::dev::Nav2D::MapGrid2D &map) override
Gets a map from the map server.
bool close() override
Close the DeviceDriver.
bool clearAllMaps() override
Removes all the registered maps from the server.
bool clearAllAreas() override
Delete all stored areas.
std::string m_local_name
Definition: Map2DClient.h:55
bool clearAllLocations() override
Delete all stored locations.
bool storeLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation loc) override
Store a location specified by the user in the world reference frame.
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
IMap2D Interface.
Definition: IMap2D.h:39
A mini-server for network communication.
Definition: Port.h:50
A base class for nested structures that can be searched.
Definition: Searchable.h:69