140 bool ok = command.
read(connection);
152 else if (command.
get(0).
asString() ==
"listLocations")
154 std::vector<std::string> locations;
157 for (
auto it=locations.begin();
it!=locations.end();
it++)
159 std::string loc = *
it;
166 reply.
addString(
"gotoLocation <locationName>");
281 if(this->
getPath(location_name, path))
284 std::lock_guard <std::mutex>
lg(
m_mutex);
294 return ReturnValue::return_code::return_value_error_method_failed;
298 std::lock_guard <std::mutex>
lg(
m_mutex);
305 std::lock_guard <std::mutex>
lg(
m_mutex);
312 location_name =
ret.name;
constexpr yarp::conf::vocab32_t VOCAB_OK
constexpr yarp::conf::vocab32_t VOCAB_ERR
contains the definition of a Map2DPath type
virtual yarp::dev::ReturnValue goto_target_by_absolute_location_and_set_name_RPC(const yarp::dev::Nav2D::Map2DLocation &loc, const std::string &name)
virtual yarp::dev::ReturnValue follow_path_RPC(const yarp::dev::Nav2D::Map2DPath &path)
virtual yarp::dev::ReturnValue stop_navigation_RPC()
virtual return_get_name_of_current_target get_name_of_current_target_RPC()
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::string m_map_locations_server
std::string m_localization_server
std::string m_navigation_server
yarp::os::Port m_rpc_port_user_commands
yarp::dev::ReturnValue storeCurrentPosition(std::string location_name) override
Store the current location of the robot.
INavigation2DMsgs m_nav_RPC
yarp::dev::ReturnValue storeLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation loc) override
Store a location specified by the user in the world reference frame.
yarp::dev::ReturnValue getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation &loc) override
Retrieves a location specified by the user in the world reference frame.
ILocalization2DMsgs m_loc_RPC
yarp::dev::ReturnValue getNameOfCurrentTarget(std::string &location_name) override
Gets the name of the current target, if available (set by gotoTargetByLocationName)
yarp::dev::ReturnValue getPath(std::string path_name, yarp::dev::Nav2D::Map2DPath &path) override
Retrieves a path.
yarp::os::Port m_rpc_port_to_localization_server
yarp::dev::ReturnValue gotoTargetByLocationName(std::string location_name) override
Ask the robot to reach a previously stored location/area.
yarp::dev::ReturnValue getArea(std::string location_name, yarp::dev::Nav2D::Map2DArea &area) override
Retrieves an area.
yarp::dev::ReturnValue getLocationsList(std::vector< std::string > &locations) override
Get a list of the names of all stored locations.
yarp::dev::ReturnValue checkNearToLocation(yarp::dev::Nav2D::Map2DLocation loc, bool &is_near, double linear_tolerance, double angular_tolerance=std::numeric_limits< double >::infinity()) override
Check if the robot is currently near to the specified area.
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::dev::ReturnValue getCurrentPosition(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the current position of the robot w.r.t world reference frame.
yarp::dev::ReturnValue checkInsideArea(yarp::dev::Nav2D::Map2DArea area, bool &is_inside) override
Check if the robot is currently inside the specified area.
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::os::Port m_rpc_port_to_Map2DServer
yarp::os::Port m_rpc_port_to_navigation_server
bool getRandomLocation(yarp::dev::Nav2D::Map2DLocation &loc)
get a random Map2DLocation inside the Map2DArea @loc the computed Map2DLocation
bool checkLocationInsideArea(yarp::dev::Nav2D::Map2DLocation loc)
Check if a Map2DLocation is inside a Map2DArea.
A simple collection of objects that can be described and transmitted in a portable way.
void addVocab32(yarp::conf::vocab32_t x)
Places a vocabulary item in the bottle, at the end of the list.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void clear()
Empties the bottle of any objects it contains.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
A mini-server for performing network communication in the background.
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.
void setReader(PortReader &reader) override
Set an external reader for port data.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A base class for nested structures that can be searched.
virtual std::string asString() const
Get string value.
bool attachAsClient(yarp::os::UnbufferedContactable &port)
Tag this WireLink as a client, sending data via the specified port.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.