YARP
Yet Another Robot Platform
Map2DClient.h
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 #ifndef YARP_DEV_MAP2DCLIENT_H
7 #define YARP_DEV_MAP2DCLIENT_H
8 
9 
10 #include <yarp/os/Network.h>
11 #include <yarp/os/BufferedPort.h>
13 #include <yarp/dev/IMap2D.h>
14 #include <yarp/sig/Vector.h>
15 #include <yarp/dev/MapGrid2D.h>
16 #include <yarp/dev/Map2DLocation.h>
17 #include <yarp/dev/Map2DArea.h>
18 #include <yarp/os/Semaphore.h>
19 #include <yarp/os/Time.h>
20 #include <yarp/dev/PolyDriver.h>
21 
22 
37 class Map2DClient :
40 {
41 protected:
43  std::string m_local_name;
44  std::string m_map_server;
45 
46 public:
47 
48  /* DeviceDriver methods */
49  bool open(yarp::os::Searchable& config) override;
50  bool close() override;
51 
52  /* The following methods belong to IMap2D interface */
53  bool clearAllMaps () override;
54  bool remove_map (std::string map_name) override;
55  bool store_map (const yarp::dev::Nav2D::MapGrid2D& map) override;
56  bool get_map (std::string map_name, yarp::dev::Nav2D::MapGrid2D& map) override;
57  bool get_map_names(std::vector<std::string>& map_names) override;
58 
59  bool storeLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation loc) override;
60  bool storeArea(std::string location_name, yarp::dev::Nav2D::Map2DArea area) override;
61  bool storePath(std::string path_name, yarp::dev::Nav2D::Map2DPath path) override;
62 
63  bool getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation& loc) override;
64  bool getArea(std::string location_name, yarp::dev::Nav2D::Map2DArea& area) override;
65  bool getPath(std::string path_name, yarp::dev::Nav2D::Map2DPath& path) override;
66 
67  bool renameLocation(std::string original_name, std::string new_name) override;
68  bool renameArea(std::string original_name, std::string new_name) override;
69  bool renamePath(std::string original_name, std::string new_name) override;
70 
71  bool deleteLocation(std::string location_name) override;
72  bool deleteArea(std::string location_name) override;
73  bool deletePath(std::string path_name) override;
74 
75  bool getLocationsList(std::vector<std::string>& locations) override;
76  bool getAreasList(std::vector<std::string>& locations) override;
77  bool getPathsList(std::vector<std::string>& paths) override;
78 
79  bool clearAllLocations() override;
80  bool clearAllAreas() override;
81  bool clearAllPaths() override;
82 
83  bool clearAllMapsTemporaryFlags() override;
84  bool clearMapTemporaryFlags(std::string map_name) override;
85 
86  bool saveMapsCollection(std::string maps_collection_file) override;
87  bool loadMapsCollection(std::string maps_collection_file) override;
88  bool saveLocationsAndExtras(std::string locations_collection_file) override;
89  bool loadLocationsAndExtras(std::string locations_collection_file) override;
90 };
91 
92 #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
map2DClient: A device which allows a client application to store/retrieve user maps device in a map s...
Definition: Map2DClient.h:40
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 loadLocationsAndExtras(std::string locations_collection_file) override
Load a collection of locations/areas/paths etc.
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 loadMapsCollection(std::string maps_collection_file) override
Load a collection of maps.
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:27
bool store_map(const yarp::dev::Nav2D::MapGrid2D &map) override
Stores a map into the map server.
Definition: Map2DClient.cpp:69
bool saveMapsCollection(std::string maps_collection_file) override
Save a collection of maps.
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:44
bool saveLocationsAndExtras(std::string locations_collection_file) override
Save a collection of locations/area/paths etc.
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.
bool clearMapTemporaryFlags(std::string map_name) override
Clear all temporary flags from a specific map.
yarp::os::Port m_rpcPort_to_Map2DServer
Definition: Map2DClient.h:42
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:43
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.
bool clearAllMapsTemporaryFlags() override
Clear all temporary flags from all stored maps.
Interface implemented by all device drivers.
Definition: DeviceDriver.h:35
IMap2D Interface.
Definition: IMap2D.h:36
A mini-server for network communication.
Definition: Port.h:47
A base class for nested structures that can be searched.
Definition: Searchable.h:66