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 
50 class Map2DClient :
53 {
54 protected:
56  std::string m_local_name;
57  std::string m_map_server;
58 
59 public:
60 
61  /* DeviceDriver methods */
62  bool open(yarp::os::Searchable& config) override;
63  bool close() override;
64 
65  /* The following methods belong to IMap2D interface */
66  bool clearAllMaps () override;
67  bool remove_map (std::string map_name) override;
68  bool store_map (const yarp::dev::Nav2D::MapGrid2D& map) override;
69  bool get_map (std::string map_name, yarp::dev::Nav2D::MapGrid2D& map) override;
70  bool get_map_names(std::vector<std::string>& map_names) override;
71 
72  bool storeLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation loc) override;
73  bool storeArea(std::string location_name, yarp::dev::Nav2D::Map2DArea area) override;
74  bool storePath(std::string path_name, yarp::dev::Nav2D::Map2DPath path) override;
75 
76  bool getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation& loc) override;
77  bool getArea(std::string location_name, yarp::dev::Nav2D::Map2DArea& area) override;
78  bool getPath(std::string path_name, yarp::dev::Nav2D::Map2DPath& path) override;
79 
80  bool renameLocation(std::string original_name, std::string new_name) override;
81  bool renameArea(std::string original_name, std::string new_name) override;
82  bool renamePath(std::string original_name, std::string new_name) override;
83 
84  bool deleteLocation(std::string location_name) override;
85  bool deleteArea(std::string location_name) override;
86  bool deletePath(std::string path_name) override;
87 
88  bool getLocationsList(std::vector<std::string>& locations) override;
89  bool getAreasList(std::vector<std::string>& locations) override;
90  bool getPathsList(std::vector<std::string>& paths) override;
91 
92  bool clearAllLocations() override;
93  bool clearAllAreas() override;
94  bool clearAllPaths() override;
95 };
96 
97 #endif // YARP_DEV_MAP2DCLIENT_H
MapGrid2D.h
contains the definition of a map type
Network.h
yarp::dev::Nav2D::IMap2D
IMap2D Interface.
Definition: IMap2D.h:39
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
Map2DArea.h
contains the definition of a Map2DArea type
Vector.h
contains the definition of a Vector type
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
IPreciselyTimed.h
Map2DClient::getLocationsList
bool getLocationsList(std::vector< std::string > &locations) override
Get a list of all stored locations.
Definition: Map2DClient.cpp:336
yarp::dev::DeviceDriver
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
Map2DClient::deleteArea
bool deleteArea(std::string location_name) override
Delete an area.
Definition: Map2DClient.cpp:637
Map2DClient
map2DClient: A device which allows a client application to store/retrieve user maps device in a map s...
Definition: Map2DClient.h:53
Map2DClient::renamePath
bool renamePath(std::string original_name, std::string new_name) override
Searches for a path and renames it.
Definition: Map2DClient.cpp:719
Map2DClient::close
bool close() override
Close the DeviceDriver.
Definition: Map2DClient.cpp:825
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
yarp::os::Port
A mini-server for network communication.
Definition: Port.h:50
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
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
PolyDriver.h
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
IMap2D.h
Map2DClient::deleteLocation
bool deleteLocation(std::string location_name) override
Delete a location.
Definition: Map2DClient.cpp:582
Map2DLocation.h
contains the definition of a Map2DLocation type
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
Semaphore.h
BufferedPort.h
Map2DClient::m_rpcPort_to_Map2DServer
yarp::os::Port m_rpcPort_to_Map2DServer
Definition: Map2DClient.h:55
Map2DClient::getPathsList
bool getPathsList(std::vector< std::string > &paths) override
Get a list of all stored paths.
Definition: Map2DClient.cpp:424
Map2DClient::m_map_server
std::string m_map_server
Definition: Map2DClient.h:57
yarp::dev::Nav2D::Map2DLocation
Definition: Map2DLocation.h:30
Map2DClient::store_map
bool store_map(const yarp::dev::Nav2D::MapGrid2D &map) override
Stores a map into the map server.
Definition: Map2DClient.cpp:82
Map2DClient::clearAllLocations
bool clearAllLocations() override
Delete all stored locations.
Definition: Map2DClient.cpp:747
Map2DClient::renameLocation
bool renameLocation(std::string original_name, std::string new_name) override
Searches for a location and renames it.
Definition: Map2DClient.cpp:609
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
Time.h
Map2DClient::getArea
bool getArea(std::string location_name, yarp::dev::Nav2D::Map2DArea &area) override
Retrieves an area.
Definition: Map2DClient.cpp:502
Map2DClient::m_local_name
std::string m_local_name
Definition: Map2DClient.h:56
Map2DClient::storePath
bool storePath(std::string path_name, yarp::dev::Nav2D::Map2DPath path) override
Store a path.
Definition: Map2DClient.cpp:302