41 yCError(NAVIGATION2D_NWC_YARP,
"open() error you have to provide a valid 'local' param");
47 yCError(NAVIGATION2D_NWC_YARP,
"open() error you have to provide a valid 'navigation_server' param");
53 yCError(NAVIGATION2D_NWC_YARP,
"open() error you have to provide valid 'map_locations_server' param");
59 yCError(NAVIGATION2D_NWC_YARP,
"open() error you have to provide valid 'localization_server' param");
63 if (config.
check(
"period"))
80 remote_streaming_name,
94 yCError(NAVIGATION2D_NWC_YARP,
"open() error could not open rpc port %s, check network", local_rpc_1.c_str());
100 yCError(NAVIGATION2D_NWC_YARP,
"open() error could not open rpc port %s, check network", local_rpc_2.c_str());
106 yCError(NAVIGATION2D_NWC_YARP,
"open() error could not open rpc port %s, check network", local_rpc_3.c_str());
112 ok = Network::connect(local_rpc_1, remote_rpc_1);
115 yCError(NAVIGATION2D_NWC_YARP,
"open() error could not connect to %s", remote_rpc_1.c_str());
119 ok = Network::connect(local_rpc_2, remote_rpc_2);
122 yCError(NAVIGATION2D_NWC_YARP,
"open() error could not connect to %s", remote_rpc_2.c_str());
126 ok = Network::connect(local_rpc_3, remote_rpc_3);
129 yCError(NAVIGATION2D_NWC_YARP,
"open() error could not connect to %s", remote_rpc_3.c_str());
135 yCError(NAVIGATION2D_NWC_YARP,
"Error! Cannot attach the m_rpc_port_to_Map2DServer port as a client");
141 yCError(NAVIGATION2D_NWC_YARP,
"Error! Cannot attach the m_rpc_port_localization_server port as a client");
147 yCError(NAVIGATION2D_NWC_YARP,
"Error! Cannot attach the m_rpc_port_navigation_server port as a client");
164 yCError(NAVIGATION2D_NWC_YARP,
"Should not enter here");
173 yCError(NAVIGATION2D_NWC_YARP) <<
"checkInsideArea() unable to get robot position";
177 return curr_loc.
is_near_to(loc, linear_tolerance, angular_tolerance);
184 if (this->
getLocation(location_name, loc) ==
false)
186 yCError(NAVIGATION2D_NWC_YARP) <<
"Location" << location_name <<
"not found";
192 yCError(NAVIGATION2D_NWC_YARP) <<
"checkInsideArea() unable to get robot position";
196 return curr_loc.
is_near_to(loc, linear_tolerance, angular_tolerance);
204 yCError(NAVIGATION2D_NWC_YARP) <<
"checkInsideArea() unable to get robot position";
221 if (this->
getArea(area_name, area) ==
false)
223 yCError(NAVIGATION2D_NWC_YARP) <<
"Area" << area_name <<
"not found";
229 yCError(NAVIGATION2D_NWC_YARP) <<
"checkInsideArea() unable to get robot position";
248 bool found = this->
getLocation(location_name, loc);
253 found = this->
getArea(location_name, area);
263 yCError(NAVIGATION2D_NWC_YARP) <<
"Location not found, stopping navigation";
269 std::lock_guard <std::mutex> lg(
m_mutex);
276 std::lock_guard <std::mutex> lg(
m_mutex);
280 yCError(NAVIGATION2D_NWC_YARP,
"Unable to get_name_of_current_target_RPC");
283 location_name =
ret.name;
291 if (!b) {
return false;}
293 if (!b) {
return false;}
virtual bool stop_navigation_RPC()
virtual return_get_name_of_current_target get_name_of_current_target_RPC()
virtual bool goto_target_by_absolute_location_and_set_name_RPC(const yarp::dev::Nav2D::Map2DLocation &loc, const std::string &name)
bool getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation &loc) override
Retrieves a location specified by the user in the world reference frame.
INavigation2DMsgs m_nav_RPC
std::string m_map_locations_server_name
bool storeLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation loc) override
Store a location specified by the user in the world reference frame.
ILocalization2DMsgs m_loc_RPC
bool gotoTargetByLocationName(std::string location_name) override
Ask the robot to reach a previously stored location/area.
yarp::os::Port m_rpc_port_to_localization_server
std::string m_navigation_server_name
bool checkInsideArea(yarp::dev::Nav2D::Map2DArea area) override
Check if the robot is currently inside the specified area.
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool getNameOfCurrentTarget(std::string &location_name) override
Gets the name of the current target, if available (set by gotoTargetByLocationName)
bool getCurrentPosition(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the current position of the robot w.r.t world reference frame.
std::string m_localization_server_name
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool storeCurrentPosition(std::string location_name) override
Store the current location of the robot.
bool checkNearToLocation(yarp::dev::Nav2D::Map2DLocation loc, double linear_tolerance, double angular_tolerance=std::numeric_limits< double >::infinity()) override
Check if the robot is currently near to the specified area.
yarp::os::Port m_rpc_port_to_Map2DServer
bool getArea(std::string location_name, yarp::dev::Nav2D::Map2DArea &area) override
Retrieves an area.
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.
An interface for reading from a network connection.
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 bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
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 yCWarning(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.
bool is_near_to(const Map2DLocation &other_loc, double linear_tolerance, double angular_tolerance) const
Compares two Map2DLocations.