|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
38 bool Navigation2DClient::set_current_goal_name(
const std::string& name)
40 m_current_goal_name = name;
44 bool Navigation2DClient::get_current_goal_name(std::string& name)
46 if (m_current_goal_name ==
"")
50 name = m_current_goal_name;
54 bool Navigation2DClient::reset_current_goal_name()
56 m_current_goal_name =
"";
65 m_navigation_server_name.clear();
66 m_map_locations_server_name.clear();
67 m_localization_server_name.clear();
70 m_navigation_server_name = config.
find(
"navigation_server").
asString();
71 m_map_locations_server_name = config.
find(
"map_locations_server").
asString();
72 m_localization_server_name = config.
find(
"localization_server").
asString();
74 if (m_local_name ==
"")
76 yCError(NAVIGATION2DCLIENT,
"open() error you have to provide a valid 'local' param");
80 if (m_navigation_server_name ==
"")
82 yCError(NAVIGATION2DCLIENT,
"open() error you have to provide a valid 'navigation_server' param");
86 if (m_map_locations_server_name ==
"")
88 yCError(NAVIGATION2DCLIENT,
"open() error you have to provide valid 'map_locations_server' param");
92 if (m_localization_server_name ==
"")
94 yCError(NAVIGATION2DCLIENT,
"open() error you have to provide valid 'localization_server' param");
98 if (config.
check(
"period"))
105 yCWarning(NAVIGATION2DCLIENT,
"Using default period of %d ms" , m_period);
116 remote_streaming_name,
117 local_streaming_name;
119 local_rpc_1 = m_local_name +
"/navigation/rpc";
120 local_rpc_2 = m_local_name +
"/locations/rpc";
121 local_rpc_3 = m_local_name +
"/localization/rpc";
122 local_rpc_4 = m_local_name +
"/user_commands/rpc";
123 remote_rpc_1 = m_navigation_server_name +
"/rpc";
124 remote_rpc_2 = m_map_locations_server_name +
"/rpc";
125 remote_rpc_3 = m_localization_server_name +
"/rpc";
126 remote_streaming_name = m_localization_server_name +
"/stream:o";
127 local_streaming_name = m_local_name +
"/stream:i";
129 if (!m_rpc_port_navigation_server.open(local_rpc_1))
131 yCError(NAVIGATION2DCLIENT,
"open() error could not open rpc port %s, check network", local_rpc_1.c_str());
135 if (!m_rpc_port_map_locations_server.open(local_rpc_2))
137 yCError(NAVIGATION2DCLIENT,
"open() error could not open rpc port %s, check network", local_rpc_2.c_str());
141 if (!m_rpc_port_localization_server.open(local_rpc_3))
143 yCError(NAVIGATION2DCLIENT,
"open() error could not open rpc port %s, check network", local_rpc_3.c_str());
149 ok = Network::connect(local_rpc_1, remote_rpc_1);
152 yCError(NAVIGATION2DCLIENT,
"open() error could not connect to %s", remote_rpc_1.c_str());
156 ok = Network::connect(local_rpc_2, remote_rpc_2);
159 yCError(NAVIGATION2DCLIENT,
"open() error could not connect to %s", remote_rpc_2.c_str());
163 ok = Network::connect(local_rpc_3, remote_rpc_3);
166 yCError(NAVIGATION2DCLIENT,
"open() error could not connect to %s", remote_rpc_3.c_str());
170 if (!m_rpc_port_user_commands.open(local_rpc_4.c_str()))
172 yCError(NAVIGATION2DCLIENT,
"Failed to open port %s", local_rpc_4.c_str());
175 m_rpc_port_user_commands.setReader(*
this);
182 m_rpc_port_navigation_server.close();
183 m_rpc_port_map_locations_server.close();
184 m_rpc_port_localization_server.close();
185 m_rpc_port_user_commands.close();
193 yCError(NAVIGATION2DCLIENT) <<
"General error in parse_respond_string";
200 reply.
addString(
"Available commands are:");
204 reply.
addString(
"store_location <location_name> <map_id> <x> <y> <y>");
205 reply.
addString(
"store_current_location <location_name>");
206 reply.
addString(
"delete_location <location_name>");
210 reply.
addString(
"get_navigation_status");
217 reply.
addString(
"initLoc <map_name> <x> <y> <angle in degrees>");
219 else if (command.
get(0).
asString() ==
"store_current_location")
224 reply.
addString(
"store_current_location done");
228 reply.
addString(
"store_current_location failed");
237 if (command.
size() == 5)
246 bool ret = this->gotoTargetByAbsoluteLocation(loc);
249 reply.
addString(
"gotoTargetByAbsoluteLocation() executed successfully");
253 reply.
addString(
"gotoTargetByAbsoluteLocation() returned an error");
263 if (command.
size() == 4)
266 ret = this->gotoTargetByRelativeLocation(x, y,
t);
270 ret = this->gotoTargetByRelativeLocation(x, y);
275 reply.
addString(
"gotoTargetByRelativeLocation() executed successfully");
279 reply.
addString(
"gotoTargetByRelativeLocation() returned an error");
282 else if (command.
get(0).
asString() ==
"get_location_list")
284 std::vector<std::string> locations;
285 bool ret = getLocationsList(locations);
288 for (
size_t i=0; i < locations.size(); i++)
295 reply.
addString(
"get_location_list failed");
298 else if (command.
get(0).
asString() ==
"get_navigation_status")
301 bool ret = this->getNavigationStatus(ss);
309 reply.
addString(
"getNavigationStatus() failed");
316 bool ret1 = this->getCurrentPosition(curr_loc);
319 std::string s = std::string(
"Current Location is: ") + curr_loc.
toString();
324 reply.
addString(
"getCurrentPosition(curr_loc) failed");
330 bool ret2 = this->getCurrentPosition(curr_loc, cov);
333 std::string s = std::string(
"Current Location with covariance is: ") + curr_loc.
toString() +
"\n" + cov.
toString();
338 reply.
addString(
"getCurrentPosition(curr_loc, covariance) failed");
346 if (command.
size() == 5)
352 ret = this->setInitialPose(init_loc);
354 else if (command.
size() == 6)
361 if (b && b->
size()==9)
364 for (
size_t i = 0; i < 3; i++) {
for (
size_t j = 0; j < 3; j++) { cov[i][j] = b->
get(i * 3 + j).
asFloat64(); } }
365 ret = this->setInitialPose(init_loc, cov);
372 std::string s = std::string(
"Localization initialized to: ") + init_loc.
toString();
377 reply.
addString(
"setInitialPose() failed");
380 else if (command.
get(0).
asString() ==
"store_location")
382 if (command.
size() != 6)
384 reply.
addString(
"store_location failed (invalid params)");
400 reply.
addString(
"store_location failed");
404 else if (command.
get(0).
asString() ==
"delete_location")
413 reply.
addString(
"delete_location failed");
416 else if (command.
get(0).
asString() ==
"clear_all_locations")
418 std::vector<std::string> locations;
419 bool ret = getLocationsList(locations);
422 for (
size_t i = 0; i < locations.size(); i++)
424 bool ret = this->deleteLocation(locations[i]);
427 reply.
addString(
"clear_all_locations failed");
430 reply.
addString(
"clear_all_locations done");
434 reply.
addString(
"clear_all_locations failed");
439 bool ret = this->gotoTargetByLocationName(command.
get(1).
asString());
450 else if (command.
get(0).
asString() ==
"get_last_target")
452 std::string last_target;
453 bool b = this->getNameOfCurrentTarget(last_target);
460 yCError(NAVIGATION2DCLIENT) <<
"get_last_target failed: goto <location_name> target not found.";
466 this->stopNavigation();
471 this->stopLocalizationService();
472 reply.
addString(
"Stopping localization service.");
477 if (command.
size() > 1)
479 this->suspendNavigation(time);
482 else if (command.
get(0).
asString() ==
"resume_nav")
484 this->resumeNavigation();
489 this->startLocalizationService();
490 reply.
addString(
"Starting localization service.");
494 yCError(NAVIGATION2DCLIENT) <<
"Unknown command";
504 bool ok = command.
read(connection);
505 if (!ok)
return false;
510 parse_respond_string(command, reply);
514 yCError(NAVIGATION2DCLIENT) <<
"Invalid command type";
519 if (returnToSender !=
nullptr)
521 reply.
write(*returnToSender);
533 bool ret = m_rpc_port_navigation_server.write(b, resp);
538 yCError(NAVIGATION2DCLIENT) <<
"getNavigationStatus() received error from navigation server";
549 yCError(NAVIGATION2DCLIENT) <<
"getNavigationStatus() error on writing on rpc port";
567 bool ret = m_rpc_port_navigation_server.write(b, resp);
572 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByAbsoluteLocation() received error from navigation server";
578 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByAbsoluteLocation() error on writing on rpc port";
582 reset_current_goal_name();
589 if (getCurrentPosition(curr_loc) ==
false)
591 yCError(NAVIGATION2DCLIENT) <<
"checkInsideArea() unable to get robot position";
595 return curr_loc.
is_near_to(loc, linear_tolerance, angular_tolerance);
602 if (this->getLocation(location_name, loc) ==
false)
604 yCError(NAVIGATION2DCLIENT) <<
"Location" << location_name <<
"not found";
608 if (getCurrentPosition(curr_loc) ==
false)
610 yCError(NAVIGATION2DCLIENT) <<
"checkInsideArea() unable to get robot position";
614 return curr_loc.
is_near_to(loc, linear_tolerance, angular_tolerance);
620 if (getCurrentPosition(curr_loc) ==
false)
622 yCError(NAVIGATION2DCLIENT) <<
"checkInsideArea() unable to get robot position";
639 if (this->getArea(area_name, area) ==
false)
641 yCError(NAVIGATION2DCLIENT) <<
"Area" << area_name <<
"not found";
645 if (getCurrentPosition(curr_loc) ==
false)
647 yCError(NAVIGATION2DCLIENT) <<
"checkInsideArea() unable to get robot position";
666 bool found = this->getLocation(location_name, loc);
671 found = this->getArea(location_name, area);
681 yCError(NAVIGATION2DCLIENT) <<
"Location not found";
686 this->gotoTargetByAbsoluteLocation(loc);
687 set_current_goal_name(location_name);
702 bool ret = m_rpc_port_navigation_server.write(b, resp);
707 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByRelativeLocation() received error from navigation server";
713 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByRelativeLocation() error on writing on rpc port";
717 reset_current_goal_name();
732 bool ret = m_rpc_port_navigation_server.write(b, resp);
737 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByRelativeLocation() received error from navigation server";
743 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByRelativeLocation() error on writing on rpc port";
747 reset_current_goal_name();
759 bool ret = m_rpc_port_navigation_server.write(b, resp);
764 yCError(NAVIGATION2DCLIENT) <<
"recomputeCurrentNavigationPath() received error from navigation server";
770 yCError(NAVIGATION2DCLIENT) <<
"recomputeCurrentNavigationPath() error on writing on rpc port";
788 bool ret = m_rpc_port_localization_server.write(b, resp);
793 yCError(NAVIGATION2DCLIENT) <<
"setInitialPose() received error from localization server";
799 yCError(NAVIGATION2DCLIENT) <<
"setInitialPose() error on writing on rpc port";
807 if (cov.
rows() != 3 || cov.
cols() != 3)
809 yCError(NAVIGATION2DCLIENT) <<
"Covariance matrix is expected to have size (3,3)";
822 for (
int i = 0; i < 3; i++) {
for (
int j = 0; j < 3; j++) { mc.
addFloat64(cov[i][j]); } }
824 bool ret = m_rpc_port_localization_server.write(b, resp);
829 yCError(NAVIGATION2DCLIENT) <<
"setInitialPose() received error from localization server";
835 yCError(NAVIGATION2DCLIENT) <<
"setInitialPose() error on writing on rpc port";
849 bool ret = m_rpc_port_localization_server.write(b, resp);
854 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() received error from localization server";
859 if (cov.
rows() != 3 || cov.
cols() != 3)
861 yCDebug(NAVIGATION2DCLIENT) <<
"Performance warning: covariance matrix is not (3,3), resizing...";
869 if (mc ==
nullptr)
return false;
870 for (
size_t i = 0; i < 3; i++) {
for (
size_t j = 0; j < 3; j++) { cov[i][j] = mc->
get(i * 3 + j).
asFloat64(); } }
876 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() error on writing on rpc port";
884 yCError(NAVIGATION2DCLIENT) <<
" getEstimatedOdometry is not yet implemented";
896 bool ret = m_rpc_port_localization_server.write(b, resp);
901 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() received error from localization server";
915 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() error on writing on rpc port";
930 bool ret = m_rpc_port_navigation_server.write(b, resp);
935 yCError(NAVIGATION2DCLIENT) <<
"suspendNavigation() received error from navigation server";
941 yCError(NAVIGATION2DCLIENT) <<
"suspendNavigation() error on writing on rpc port";
955 bool ret = m_rpc_port_navigation_server.write(b, resp);
960 yCError(NAVIGATION2DCLIENT) <<
"getAbsoluteLocationOfCurrentTarget() received error from navigation server";
974 yCError(NAVIGATION2DCLIENT) <<
"getAbsoluteLocationOfCurrentTarget() error on writing on rpc port";
983 if (get_current_goal_name(s))
990 yCError(NAVIGATION2DCLIENT) <<
"No name for the current target, or no target set";
1002 bool ret = m_rpc_port_navigation_server.write(b, resp);
1007 yCError(NAVIGATION2DCLIENT) <<
"getRelativeLocationOfCurrentTarget() received error from navigation server";
1020 yCError(NAVIGATION2DCLIENT) <<
"getRelativeLocationOfCurrentTarget() error on writing on rpc port";
1036 bool ret_nav = m_rpc_port_localization_server.write(b_nav, resp_nav);
1041 yCError(NAVIGATION2DCLIENT) <<
"storeCurrentPosition() received error from localization server";
1054 yCError(NAVIGATION2DCLIENT) <<
"storeCurrentPosition() error on writing on rpc port";
1067 bool ret_loc = m_rpc_port_map_locations_server.write(b_loc, resp_loc);
1072 yCError(NAVIGATION2DCLIENT) <<
"storeCurrentPosition() received error from locations server";
1078 yCError(NAVIGATION2DCLIENT) <<
"storeCurrentPosition() error on writing on rpc port";
1098 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1103 yCError(NAVIGATION2DCLIENT) <<
"storeLocation() received error from locations server";
1109 yCError(NAVIGATION2DCLIENT) <<
"storeLocation() error on writing on rpc port";
1124 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1129 yCError(NAVIGATION2DCLIENT) <<
"getLocationsList() received error from locations server";
1138 for (
size_t i = 0; i < list->
size(); i++)
1146 yCError(NAVIGATION2DCLIENT) <<
"getLocationsList() error while reading from locations server";
1153 yCError(NAVIGATION2DCLIENT) <<
"getLocationsList() error on writing on rpc port";
1169 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1174 yCError(NAVIGATION2DCLIENT) <<
"getLocation() received error from locations server";
1187 yCError(NAVIGATION2DCLIENT) <<
"getLocation() error on writing on rpc port";
1205 bool ret = m_rpc_port_map_locations_server.write(b_loc, resp_loc);
1210 yCError(NAVIGATION2DCLIENT) <<
"getArea() received error from locations server";
1216 if (Property::copyPortable(b, area) ==
false)
1218 yCError(NAVIGATION2DCLIENT) <<
"getArea() received error from locations server";
1225 yCError(NAVIGATION2DCLIENT) <<
"getArea() error on writing on rpc port";
1242 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1247 yCError(NAVIGATION2DCLIENT) <<
"deleteLocation() received error from locations server";
1253 yCError(NAVIGATION2DCLIENT) <<
"deleteLocation() error on writing on rpc port";
1268 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1273 yCError(NAVIGATION2DCLIENT) <<
"clearAllLocations() received error from locations server";
1279 yCError(NAVIGATION2DCLIENT) <<
"clearAllLocations() error on writing on rpc port";
1293 bool ret = m_rpc_port_navigation_server.write(b, resp);
1298 yCError(NAVIGATION2DCLIENT) <<
"stopNavigation() received error from navigation server";
1304 yCError(NAVIGATION2DCLIENT) <<
"stopNavigation() error on writing on rpc port";
1318 bool ret = m_rpc_port_navigation_server.write(b, resp);
1323 yCError(NAVIGATION2DCLIENT) <<
"resumeNavigation() received error from navigation server";
1329 yCError(NAVIGATION2DCLIENT) <<
"resumeNavigation() error on writing on rpc port";
1344 bool ret = m_rpc_port_navigation_server.write(b, resp);
1349 yCError(NAVIGATION2DCLIENT) <<
"getNavigationWaypoints() received error from navigation server";
1356 if (waypoints_bottle == 0) {
yCError(NAVIGATION2DCLIENT) <<
"getNavigationWaypoints parsing error";
return false; }
1357 for (
size_t i = 0; i < waypoints_bottle->
size(); i++)
1360 if (the_waypoint == 0) {
yCError(NAVIGATION2DCLIENT) <<
"getNavigationWaypoints parsing error";
return false; }
1379 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() error on writing on rpc port";
1393 bool ret = m_rpc_port_navigation_server.write(b, resp);
1398 yCError(NAVIGATION2DCLIENT) <<
"getCurrentNavigationWaypoint() received error from navigation server";
1401 else if (resp.
size() == 5)
1412 curr_waypoint.
map_id =
"invalid";
1413 curr_waypoint.
x = std::nan(
"");
1414 curr_waypoint.
y = std::nan(
"");
1415 curr_waypoint.
theta = std::nan(
"");
1421 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() error on writing on rpc port";
1436 bool ret = m_rpc_port_navigation_server.write(b, resp);
1441 yCError(NAVIGATION2DCLIENT) <<
"getCurrentNavigationMap() received error from server";
1447 if (Property::copyPortable(b, map))
1453 yCError(NAVIGATION2DCLIENT) <<
"getCurrentNavigationMap() failed copyPortable()";
1460 yCError(NAVIGATION2DCLIENT) <<
"getCurrentNavigationMap() error on writing on rpc port";
1474 bool ret = m_rpc_port_localization_server.write(b, resp);
1479 yCError(NAVIGATION2DCLIENT) <<
"getLocalizationStatus() received error from localization server";
1490 yCError(NAVIGATION2DCLIENT) <<
"getLocalizationStatus() error on writing on rpc port";
1508 bool ret = m_rpc_port_navigation_server.write(b, resp);
1513 yCError(NAVIGATION2DCLIENT) <<
"applyVelocityCommand() received error from navigation server";
1519 yCError(NAVIGATION2DCLIENT) <<
"applyVelocityCommand() error on writing on rpc port";
1523 reset_current_goal_name();
1535 bool ret = m_rpc_port_localization_server.write(b, resp);
1540 yCError(NAVIGATION2DCLIENT) <<
"getEstimatedPoses() received error from localization server";
1547 for (
int i = 0; i < nposes; i++)
1561 yCError(NAVIGATION2DCLIENT) <<
"getEstimatedPoses() parsing error";
1564 poses.push_back(loc);
1571 yCError(NAVIGATION2DCLIENT) <<
"getEstimatedPoses() error on writing on rpc port";
1578 double Navigation2DClient::normalize_angle(
double angle)
1580 angle = std::remainder(angle, 360);
1582 if (angle > 180 && angle < 360)
1584 angle = angle - 360;
1587 if (angle<-180 && angle>-360)
1589 angle = angle + 360;
1602 bool ret = m_rpc_port_localization_server.write(b, resp);
1607 yCError(NAVIGATION2DCLIENT) <<
"startLocalizationService() received error from navigation server";
1613 yCError(NAVIGATION2DCLIENT) <<
"startLocalizationService() error on writing on rpc port";
1627 bool ret = m_rpc_port_localization_server.write(b, resp);
1632 yCError(NAVIGATION2DCLIENT) <<
"stopLocalizationService() received error from navigation server";
1638 yCError(NAVIGATION2DCLIENT) <<
"stopLocalizationService() error on writing on rpc port";
A simple collection of objects that can be described and transmitted in a portable way.
bool gotoTargetByAbsoluteLocation(yarp::dev::Nav2D::Map2DLocation loc) override
Ask the robot to reach a position defined in the world reference frame.
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
bool getNavigationStatus(yarp::dev::Nav2D::NavigationStatusEnum &status) override
Gets the current status of the navigation task.
bool getAbsoluteLocationOfCurrentTarget(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the last navigation target in the world reference frame.
std::string toString(int precision=-1, int width=-1, const char *endRowStr="\n") const
Print matrix to a string.
void clear()
Empties the bottle of any objects it contains.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_CURRENT_POS
A base class for nested structures that can be searched.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_LOCALIZER_POSES
size_type size() const
Gets the number of elements in the bottle.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_ABS_TARGET
bool getRelativeLocationOfCurrentTarget(double &x, double &y, double &theta) override
Gets the last navigation target in the robot reference frame.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
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 suspendNavigation(const double time_s) override
Ask to the robot to suspend the current navigation task for a defined amount of time.
constexpr yarp::conf::vocab32_t VOCAB_NAV_LOCATION
#define yCWarning(component,...)
constexpr yarp::conf::vocab32_t VOCAB_NAV_SUSPEND
bool stopLocalizationService() override
Stops the localization service.
std::string toString() const
Returns text representation of the location.
bool recomputeCurrentNavigationPath() override
Forces the navigation system to recompute the path from the current robot position to the current goa...
bool getAllNavigationWaypoints(yarp::dev::Nav2D::TrajectoryTypeEnum trajectory_type, yarp::dev::Nav2D::Map2DPath &waypoints) override
Returns the list of waypoints generated by the navigation algorithm.
#define YARP_LOG_COMPONENT(name,...)
constexpr yarp::conf::vocab32_t VOCAB_NAV_DELETE_X
size_t rows() const
Return number of rows.
virtual bool checkInsideArea(yarp::dev::Nav2D::Map2DArea area) override
Check if the robot is currently inside the specified area.
bool getEstimatedPoses(std::vector< yarp::dev::Nav2D::Map2DLocation > &poses) override
Gets a set of pose estimates computed by the localization algorithm.
bool getRandomLocation(yarp::dev::Nav2D::Map2DLocation &loc)
get a random Map2DLocation inside the Map2DArea @loc the computed Map2DLocation
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_CURRENT_WAYPOINT
bool parse_respond_string(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
bool gotoTargetByLocationName(std::string location_name) override
Ask the robot to reach a previously stored location/area.
bool getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation &loc) override
Retrieves a location previously stored by the user.
constexpr yarp::conf::vocab32_t VOCAB_NAV_CLEAR_X
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
constexpr yarp::conf::vocab32_t VOCAB_NAV_VELOCITY_CMD
An interface for the device drivers.
bool applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout=0.1) override
Apply a velocity command.
bool getCurrentNavigationMap(yarp::dev::Nav2D::NavigationMapTypeEnum map_type, yarp::dev::Nav2D::MapGrid2D &map) override
Returns the current navigation map processed by the navigation algorithm.
bool getLocationsList(std::vector< std::string > &locations) override
Get a list of all stored locations.
bool stopNavigation() override
Terminates the current navigation task.
bool setInitialPose(const yarp::dev::Nav2D::Map2DLocation &loc) override
Sets the initial pose for the localization algorithm which estimates the current position of the robo...
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_LIST_X
bool getLocalizationStatus(yarp::dev::Nav2D::LocalizationStatusEnum &status) override
Gets the current status of the localization task.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GOTOABS
virtual bool isString() const
Checks if value is a string.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAVIGATION_WAYPOINTS
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAV_MAP
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAVIGATION_STATUS
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
bool write(ConnectionWriter &writer) const override
Output a representation of the bottle to a network connection.
An interface for writing to a network connection.
bool gotoTargetByRelativeLocation(double x, double y, double theta) override
Ask the robot to reach a position defined in the robot reference frame.
void push_back(yarp::dev::Nav2D::Map2DLocation loc)
Inserts a new location into the path @loc the location to be inserted.
virtual std::string asString() const
Get string value.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_REL_TARGET
constexpr yarp::conf::vocab32_t VOCAB_NAV_AREA
bool getEstimatedOdometry(yarp::dev::OdometryData &odom) override
Gets the estimated odometry the robot, including its velocity expressed in the world and in the local...
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_LOCALIZER_STATUS
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_X
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
constexpr yarp::conf::vocab32_t VOCAB_NAV_LOCALIZATION_START
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
NetInt32 encode(const std::string &str)
Convert a string into a vocabulary identifier.
void clear()
Remove all elements from the path.
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
constexpr yarp::conf::vocab32_t VOCAB_NAV_SET_INITIAL_POSCOV
size_t cols() const
Return number of columns.
void addVocab(int x)
Places a vocabulary item in the bottle, at the end of the list.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_CURRENT_POSCOV
void resize(size_t r, size_t c)
Resize the matrix, if matrix is not empty preserve old content.
virtual bool isList() const
Checks if value is a list.
bool close() override
Close the DeviceDriver.
bool deleteLocation(std::string location_name) override
Delete a location.
constexpr yarp::conf::vocab32_t VOCAB_ERR
An interface for reading from a network connection.
#define yCError(component,...)
bool storeCurrentPosition(std::string location_name) override
Store the current location of the robot.
constexpr yarp::conf::vocab32_t VOCAB_NAV_RESUME
virtual std::int32_t asInt32() const
Get 32-bit integer value.
An interface to the operating system, including Port based communication.
#define yCDebug(component,...)
std::string statusToString(NavigationStatusEnum status)
bool startLocalizationService() override
Starts the localization service.
constexpr yarp::conf::vocab32_t VOCAB_NAV_STOP
constexpr yarp::conf::vocab32_t VOCAB_NAV_STORE_X
virtual 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.
constexpr yarp::conf::vocab32_t VOCAB_NAV_RECOMPUTE_PATH
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
virtual Bottle * asList() const
Get list value.
bool getArea(std::string area_name, yarp::dev::Nav2D::Map2DArea &area) override
Retrieves an area previously stored by the user.
constexpr yarp::conf::vocab32_t VOCAB_NAV_GOTOREL
bool getCurrentPosition(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the current position of the robot w.r.t world reference frame.
bool getNameOfCurrentTarget(std::string &location_name) override
Gets the name of the current target, if available (set by gotoTargetByLocationName)
A single value (typically within a Bottle).
constexpr yarp::conf::vocab32_t VOCAB_NAV_LOCALIZATION_STOP
bool clearAllLocations() override
Delete all stored locations.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
constexpr yarp::conf::vocab32_t VOCAB_OK
constexpr yarp::conf::vocab32_t VOCAB_INAVIGATION
bool checkLocationInsideArea(yarp::dev::Nav2D::Map2DLocation loc)
Check if a Map2DLocation is inside a Map2DArea.
bool resumeNavigation() override
Resume a previously suspended navigation task.
constexpr yarp::conf::vocab32_t VOCAB_NAV_SET_INITIAL_POS
bool is_near_to(const Map2DLocation &other_loc, double linear_tolerance, double angular_tolerance) const
Compares two Map2DLocations.
bool getCurrentNavigationWaypoint(yarp::dev::Nav2D::Map2DLocation &curr_waypoint) override
Returns the current waypoint pursued by the navigation algorithm.