30 m_navigation_server_name.clear();
31 m_map_locations_server_name.clear();
32 m_localization_server_name.clear();
35 m_navigation_server_name = config.
find(
"navigation_server").
asString();
36 m_map_locations_server_name = config.
find(
"map_locations_server").
asString();
37 m_localization_server_name = config.
find(
"localization_server").
asString();
39 if (m_local_name ==
"")
41 yCError(NAVIGATION2DCLIENT,
"open() error you have to provide a valid 'local' param");
45 if (m_navigation_server_name ==
"")
47 yCError(NAVIGATION2DCLIENT,
"open() error you have to provide a valid 'navigation_server' param");
51 if (m_map_locations_server_name ==
"")
53 yCError(NAVIGATION2DCLIENT,
"open() error you have to provide valid 'map_locations_server' param");
57 if (m_localization_server_name ==
"")
59 yCError(NAVIGATION2DCLIENT,
"open() error you have to provide valid 'localization_server' param");
63 if (config.
check(
"period"))
70 yCWarning(NAVIGATION2DCLIENT,
"Using default period of %d ms" , m_period);
81 remote_streaming_name,
84 local_rpc_1 = m_local_name +
"/navigation/rpc";
85 local_rpc_2 = m_local_name +
"/locations/rpc";
86 local_rpc_3 = m_local_name +
"/localization/rpc";
87 local_rpc_4 = m_local_name +
"/user_commands/rpc";
88 remote_rpc_1 = m_navigation_server_name +
"/rpc";
89 remote_rpc_2 = m_map_locations_server_name +
"/rpc";
90 remote_rpc_3 = m_localization_server_name +
"/rpc";
91 remote_streaming_name = m_localization_server_name +
"/stream:o";
92 local_streaming_name = m_local_name +
"/stream:i";
94 if (!m_rpc_port_navigation_server.open(local_rpc_1))
96 yCError(NAVIGATION2DCLIENT,
"open() error could not open rpc port %s, check network", local_rpc_1.c_str());
100 if (!m_rpc_port_map_locations_server.open(local_rpc_2))
102 yCError(NAVIGATION2DCLIENT,
"open() error could not open rpc port %s, check network", local_rpc_2.c_str());
106 if (!m_rpc_port_localization_server.open(local_rpc_3))
108 yCError(NAVIGATION2DCLIENT,
"open() error could not open rpc port %s, check network", local_rpc_3.c_str());
114 ok = Network::connect(local_rpc_1, remote_rpc_1);
117 yCError(NAVIGATION2DCLIENT,
"open() error could not connect to %s", remote_rpc_1.c_str());
121 ok = Network::connect(local_rpc_2, remote_rpc_2);
124 yCError(NAVIGATION2DCLIENT,
"open() error could not connect to %s", remote_rpc_2.c_str());
128 ok = Network::connect(local_rpc_3, remote_rpc_3);
131 yCError(NAVIGATION2DCLIENT,
"open() error could not connect to %s", remote_rpc_3.c_str());
135 if (!m_rpc_port_user_commands.open(local_rpc_4.c_str()))
137 yCError(NAVIGATION2DCLIENT,
"Failed to open port %s", local_rpc_4.c_str());
140 m_rpc_port_user_commands.setReader(*
this);
147 m_rpc_port_navigation_server.close();
148 m_rpc_port_map_locations_server.close();
149 m_rpc_port_localization_server.close();
150 m_rpc_port_user_commands.close();
158 yCError(NAVIGATION2DCLIENT) <<
"General error in parse_respond_string";
165 reply.
addString(
"Available commands are:");
169 reply.
addString(
"store_location <location_name> <map_id> <x> <y> <y>");
170 reply.
addString(
"store_current_location <location_name>");
171 reply.
addString(
"delete_location <location_name>");
175 reply.
addString(
"get_navigation_status");
182 reply.
addString(
"initLoc <map_name> <x> <y> <angle in degrees>");
184 else if (command.
get(0).
asString() ==
"store_current_location")
189 reply.
addString(
"store_current_location done");
193 reply.
addString(
"store_current_location failed");
202 if (command.
size() == 5)
211 bool ret = this->gotoTargetByAbsoluteLocation(loc);
214 reply.
addString(
"gotoTargetByAbsoluteLocation() executed successfully");
218 reply.
addString(
"gotoTargetByAbsoluteLocation() returned an error");
228 if (command.
size() == 4)
231 ret = this->gotoTargetByRelativeLocation(x, y,
t);
235 ret = this->gotoTargetByRelativeLocation(x, y);
240 reply.
addString(
"gotoTargetByRelativeLocation() executed successfully");
244 reply.
addString(
"gotoTargetByRelativeLocation() returned an error");
247 else if (command.
get(0).
asString() ==
"get_location_list")
249 std::vector<std::string> locations;
250 bool ret = getLocationsList(locations);
253 for (
size_t i=0; i < locations.size(); i++)
260 reply.
addString(
"get_location_list failed");
263 else if (command.
get(0).
asString() ==
"get_navigation_status")
266 bool ret = this->getNavigationStatus(ss);
274 reply.
addString(
"getNavigationStatus() failed");
281 bool ret1 = this->getCurrentPosition(curr_loc);
284 std::string s = std::string(
"Current Location is: ") + curr_loc.
toString();
289 reply.
addString(
"getCurrentPosition(curr_loc) failed");
295 bool ret2 = this->getCurrentPosition(curr_loc, cov);
298 std::string s = std::string(
"Current Location with covariance is: ") + curr_loc.
toString() +
"\n" + cov.
toString();
303 reply.
addString(
"getCurrentPosition(curr_loc, covariance) failed");
311 if (command.
size() == 5)
317 ret = this->setInitialPose(init_loc);
319 else if (command.
size() == 6)
326 if (b && b->
size()==9)
329 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(); } }
330 ret = this->setInitialPose(init_loc, cov);
338 std::string s = std::string(
"Localization initialized to: ") + init_loc.
toString();
343 reply.
addString(
"setInitialPose() failed");
346 else if (command.
get(0).
asString() ==
"store_location")
348 if (command.
size() != 6)
350 reply.
addString(
"store_location failed (invalid params)");
366 reply.
addString(
"store_location failed");
370 else if (command.
get(0).
asString() ==
"delete_location")
379 reply.
addString(
"delete_location failed");
382 else if (command.
get(0).
asString() ==
"clear_all_locations")
384 std::vector<std::string> locations;
385 bool ret = getLocationsList(locations);
388 for (
size_t i = 0; i < locations.size(); i++)
390 bool ret = this->deleteLocation(locations[i]);
393 reply.
addString(
"clear_all_locations failed");
396 reply.
addString(
"clear_all_locations done");
400 reply.
addString(
"clear_all_locations failed");
405 bool ret = this->gotoTargetByLocationName(command.
get(1).
asString());
416 else if (command.
get(0).
asString() ==
"get_last_target")
418 std::string last_target;
419 bool b = this->getNameOfCurrentTarget(last_target);
426 yCError(NAVIGATION2DCLIENT) <<
"get_last_target failed: goto <location_name> target not found.";
432 this->stopNavigation();
437 this->stopLocalizationService();
438 reply.
addString(
"Stopping localization service.");
443 if (command.
size() > 1) {
446 this->suspendNavigation(time);
449 else if (command.
get(0).
asString() ==
"resume_nav")
451 this->resumeNavigation();
456 this->startLocalizationService();
457 reply.
addString(
"Starting localization service.");
461 yCError(NAVIGATION2DCLIENT) <<
"Unknown command";
471 bool ok = command.
read(connection);
479 parse_respond_string(command, reply);
483 yCError(NAVIGATION2DCLIENT) <<
"Invalid command type";
488 if (returnToSender !=
nullptr)
490 reply.
write(*returnToSender);
502 bool ret = m_rpc_port_navigation_server.write(b, resp);
507 yCError(NAVIGATION2DCLIENT) <<
"getNavigationStatus() received error from navigation server";
518 yCError(NAVIGATION2DCLIENT) <<
"getNavigationStatus() error on writing on rpc port";
536 bool ret = m_rpc_port_navigation_server.write(b, resp);
541 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByAbsoluteLocation() received error from navigation server";
547 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByAbsoluteLocation() error on writing on rpc port";
557 if (getCurrentPosition(curr_loc) ==
false)
559 yCError(NAVIGATION2DCLIENT) <<
"checkInsideArea() unable to get robot position";
563 return curr_loc.
is_near_to(loc, linear_tolerance, angular_tolerance);
570 if (this->getLocation(location_name, loc) ==
false)
572 yCError(NAVIGATION2DCLIENT) <<
"Location" << location_name <<
"not found";
576 if (getCurrentPosition(curr_loc) ==
false)
578 yCError(NAVIGATION2DCLIENT) <<
"checkInsideArea() unable to get robot position";
582 return curr_loc.
is_near_to(loc, linear_tolerance, angular_tolerance);
588 if (getCurrentPosition(curr_loc) ==
false)
590 yCError(NAVIGATION2DCLIENT) <<
"checkInsideArea() unable to get robot position";
607 if (this->getArea(area_name, area) ==
false)
609 yCError(NAVIGATION2DCLIENT) <<
"Area" << area_name <<
"not found";
613 if (getCurrentPosition(curr_loc) ==
false)
615 yCError(NAVIGATION2DCLIENT) <<
"checkInsideArea() unable to get robot position";
634 bool found = this->getLocation(location_name, loc);
639 found = this->getArea(location_name, area);
649 yCError(NAVIGATION2DCLIENT) <<
"Location not found";
664 bool ret = m_rpc_port_navigation_server.write(b, resp);
669 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByLocationName() received error from navigation server";
675 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByLocationName() error on writing on rpc port";
692 bool ret = m_rpc_port_navigation_server.write(b, resp);
697 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByRelativeLocation() received error from navigation server";
703 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByRelativeLocation() error on writing on rpc port";
721 bool ret = m_rpc_port_navigation_server.write(b, resp);
726 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByRelativeLocation() received error from navigation server";
732 yCError(NAVIGATION2DCLIENT) <<
"gotoTargetByRelativeLocation() error on writing on rpc port";
747 bool ret = m_rpc_port_navigation_server.write(b, resp);
752 yCError(NAVIGATION2DCLIENT) <<
"recomputeCurrentNavigationPath() received error from navigation server";
758 yCError(NAVIGATION2DCLIENT) <<
"recomputeCurrentNavigationPath() error on writing on rpc port";
776 bool ret = m_rpc_port_localization_server.write(b, resp);
781 yCError(NAVIGATION2DCLIENT) <<
"setInitialPose() received error from localization server";
787 yCError(NAVIGATION2DCLIENT) <<
"setInitialPose() error on writing on rpc port";
795 if (cov.
rows() != 3 || cov.
cols() != 3)
797 yCError(NAVIGATION2DCLIENT) <<
"Covariance matrix is expected to have size (3,3)";
810 for (
int i = 0; i < 3; i++) {
for (
int j = 0; j < 3; j++) { mc.
addFloat64(cov[i][j]); } }
812 bool ret = m_rpc_port_localization_server.write(b, resp);
817 yCError(NAVIGATION2DCLIENT) <<
"setInitialPose() received error from localization server";
823 yCError(NAVIGATION2DCLIENT) <<
"setInitialPose() error on writing on rpc port";
837 bool ret = m_rpc_port_localization_server.write(b, resp);
842 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() received error from localization server";
847 if (cov.
rows() != 3 || cov.
cols() != 3)
849 yCDebug(NAVIGATION2DCLIENT) <<
"Performance warning: covariance matrix is not (3,3), resizing...";
860 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(); } }
866 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() error on writing on rpc port";
880 bool ret = m_rpc_port_localization_server.write(b, resp);
885 yCError(NAVIGATION2DCLIENT) <<
"getEstimatedOdometry() received error from localization server";
904 yCError(NAVIGATION2DCLIENT) <<
"getEstimatedOdometry() error on writing on rpc port";
918 bool ret = m_rpc_port_localization_server.write(b, resp);
923 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() received error from localization server";
937 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() error on writing on rpc port";
952 bool ret = m_rpc_port_navigation_server.write(b, resp);
957 yCError(NAVIGATION2DCLIENT) <<
"suspendNavigation() received error from navigation server";
963 yCError(NAVIGATION2DCLIENT) <<
"suspendNavigation() error on writing on rpc port";
977 bool ret = m_rpc_port_navigation_server.write(b, resp);
982 yCError(NAVIGATION2DCLIENT) <<
"getAbsoluteLocationOfCurrentTarget() received error from navigation server";
996 yCError(NAVIGATION2DCLIENT) <<
"getAbsoluteLocationOfCurrentTarget() error on writing on rpc port";
1010 bool ret = m_rpc_port_navigation_server.write(b, resp);
1015 yCError(NAVIGATION2DCLIENT) <<
"getNameOfCurrentTarget() received error from navigation server";
1026 yCError(NAVIGATION2DCLIENT) <<
"getNameOfCurrentTarget() error on writing on rpc port";
1040 bool ret = m_rpc_port_navigation_server.write(b, resp);
1045 yCError(NAVIGATION2DCLIENT) <<
"getRelativeLocationOfCurrentTarget() received error from navigation server";
1058 yCError(NAVIGATION2DCLIENT) <<
"getRelativeLocationOfCurrentTarget() error on writing on rpc port";
1074 bool ret_nav = m_rpc_port_localization_server.write(b_nav, resp_nav);
1079 yCError(NAVIGATION2DCLIENT) <<
"storeCurrentPosition() received error from localization server";
1092 yCError(NAVIGATION2DCLIENT) <<
"storeCurrentPosition() error on writing on rpc port";
1105 bool ret_loc = m_rpc_port_map_locations_server.write(b_loc, resp_loc);
1110 yCError(NAVIGATION2DCLIENT) <<
"storeCurrentPosition() received error from locations server";
1116 yCError(NAVIGATION2DCLIENT) <<
"storeCurrentPosition() error on writing on rpc port";
1136 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1141 yCError(NAVIGATION2DCLIENT) <<
"storeLocation() received error from locations server";
1147 yCError(NAVIGATION2DCLIENT) <<
"storeLocation() error on writing on rpc port";
1162 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1167 yCError(NAVIGATION2DCLIENT) <<
"getLocationsList() received error from locations server";
1176 for (
size_t i = 0; i < list->
size(); i++)
1184 yCError(NAVIGATION2DCLIENT) <<
"getLocationsList() error while reading from locations server";
1191 yCError(NAVIGATION2DCLIENT) <<
"getLocationsList() error on writing on rpc port";
1207 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1212 yCError(NAVIGATION2DCLIENT) <<
"getLocation() received error from locations server";
1225 yCError(NAVIGATION2DCLIENT) <<
"getLocation() error on writing on rpc port";
1243 bool ret = m_rpc_port_map_locations_server.write(b_loc, resp_loc);
1248 yCError(NAVIGATION2DCLIENT) <<
"getArea() received error from locations server";
1254 if (Property::copyPortable(b, area) ==
false)
1256 yCError(NAVIGATION2DCLIENT) <<
"getArea() received error from locations server";
1263 yCError(NAVIGATION2DCLIENT) <<
"getArea() error on writing on rpc port";
1280 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1285 yCError(NAVIGATION2DCLIENT) <<
"deleteLocation() received error from locations server";
1291 yCError(NAVIGATION2DCLIENT) <<
"deleteLocation() error on writing on rpc port";
1306 bool ret = m_rpc_port_map_locations_server.write(b, resp);
1311 yCError(NAVIGATION2DCLIENT) <<
"clearAllLocations() received error from locations server";
1317 yCError(NAVIGATION2DCLIENT) <<
"clearAllLocations() error on writing on rpc port";
1331 bool ret = m_rpc_port_navigation_server.write(b, resp);
1336 yCError(NAVIGATION2DCLIENT) <<
"stopNavigation() received error from navigation server";
1342 yCError(NAVIGATION2DCLIENT) <<
"stopNavigation() error on writing on rpc port";
1356 bool ret = m_rpc_port_navigation_server.write(b, resp);
1361 yCError(NAVIGATION2DCLIENT) <<
"resumeNavigation() received error from navigation server";
1367 yCError(NAVIGATION2DCLIENT) <<
"resumeNavigation() error on writing on rpc port";
1382 bool ret = m_rpc_port_navigation_server.write(b, resp);
1387 yCError(NAVIGATION2DCLIENT) <<
"getNavigationWaypoints() received error from navigation server";
1394 if (waypoints_bottle == 0) {
yCError(NAVIGATION2DCLIENT) <<
"getNavigationWaypoints parsing error";
return false; }
1395 for (
size_t i = 0; i < waypoints_bottle->
size(); i++)
1398 if (the_waypoint == 0) {
yCError(NAVIGATION2DCLIENT) <<
"getNavigationWaypoints parsing error";
return false; }
1417 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() error on writing on rpc port";
1431 bool ret = m_rpc_port_navigation_server.write(b, resp);
1436 yCError(NAVIGATION2DCLIENT) <<
"getCurrentNavigationWaypoint() received error from navigation server";
1439 else if (resp.
size() == 5)
1450 curr_waypoint.
map_id =
"invalid";
1451 curr_waypoint.
x = std::nan(
"");
1452 curr_waypoint.
y = std::nan(
"");
1453 curr_waypoint.
theta = std::nan(
"");
1459 yCError(NAVIGATION2DCLIENT) <<
"getCurrentPosition() error on writing on rpc port";
1474 bool ret = m_rpc_port_navigation_server.write(b, resp);
1479 yCError(NAVIGATION2DCLIENT) <<
"getCurrentNavigationMap() received error from server";
1485 if (Property::copyPortable(b, map))
1491 yCError(NAVIGATION2DCLIENT) <<
"getCurrentNavigationMap() failed copyPortable()";
1498 yCError(NAVIGATION2DCLIENT) <<
"getCurrentNavigationMap() error on writing on rpc port";
1512 bool ret = m_rpc_port_localization_server.write(b, resp);
1517 yCError(NAVIGATION2DCLIENT) <<
"getLocalizationStatus() received error from localization server";
1528 yCError(NAVIGATION2DCLIENT) <<
"getLocalizationStatus() error on writing on rpc port";
1546 bool ret = m_rpc_port_navigation_server.write(b, resp);
1551 yCError(NAVIGATION2DCLIENT) <<
"applyVelocityCommand() received error from navigation server";
1557 yCError(NAVIGATION2DCLIENT) <<
"applyVelocityCommand() error on writing on rpc port";
1572 bool ret = m_rpc_port_localization_server.write(b, resp);
1577 yCError(NAVIGATION2DCLIENT) <<
"getEstimatedPoses() received error from localization server";
1584 for (
int i = 0; i < nposes; i++)
1598 yCError(NAVIGATION2DCLIENT) <<
"getEstimatedPoses() parsing error";
1601 poses.push_back(loc);
1608 yCError(NAVIGATION2DCLIENT) <<
"getEstimatedPoses() error on writing on rpc port";
1615 double Navigation2DClient::normalize_angle(
double angle)
1617 angle = std::remainder(angle, 360);
1619 if (angle > 180 && angle < 360)
1621 angle = angle - 360;
1624 if (angle<-180 && angle>-360)
1626 angle = angle + 360;
1639 bool ret = m_rpc_port_localization_server.write(b, resp);
1644 yCError(NAVIGATION2DCLIENT) <<
"startLocalizationService() received error from navigation server";
1650 yCError(NAVIGATION2DCLIENT) <<
"startLocalizationService() error on writing on rpc port";
1664 bool ret = m_rpc_port_localization_server.write(b, resp);
1669 yCError(NAVIGATION2DCLIENT) <<
"stopLocalizationService() received error from navigation server";
1675 yCError(NAVIGATION2DCLIENT) <<
"stopLocalizationService() error on writing on rpc port";
constexpr yarp::conf::vocab32_t VOCAB_OK
constexpr yarp::conf::vocab32_t VOCAB_ERR
constexpr yarp::conf::vocab32_t VOCAB_NAV_DELETE_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_LOCALIZER_POSES
constexpr yarp::conf::vocab32_t VOCAB_NAV_GOTOABS_AND_NAME
constexpr yarp::conf::vocab32_t VOCAB_NAV_VELOCITY_CMD
constexpr yarp::conf::vocab32_t VOCAB_INAVIGATION
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_LIST_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_AREA
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_ABS_TARGET
constexpr yarp::conf::vocab32_t VOCAB_NAV_RECOMPUTE_PATH
constexpr yarp::conf::vocab32_t VOCAB_NAV_STORE_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_REL_TARGET
constexpr yarp::conf::vocab32_t VOCAB_NAV_LOCALIZATION_STOP
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_SET_INITIAL_POSCOV
constexpr yarp::conf::vocab32_t VOCAB_NAV_LOCATION
constexpr yarp::conf::vocab32_t VOCAB_NAV_GOTOREL
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAME_TARGET
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_CURRENT_POS
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_LOCALIZER_STATUS
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_ESTIMATED_ODOM
constexpr yarp::conf::vocab32_t VOCAB_NAV_SET_INITIAL_POS
constexpr yarp::conf::vocab32_t VOCAB_NAV_CLEARALL_X
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_CURRENT_POSCOV
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAVIGATION_STATUS
constexpr yarp::conf::vocab32_t VOCAB_NAV_GOTOABS
constexpr yarp::conf::vocab32_t VOCAB_NAV_LOCALIZATION_START
constexpr yarp::conf::vocab32_t VOCAB_NAV_RESUME
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_CURRENT_WAYPOINT
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAVIGATION_WAYPOINTS
constexpr yarp::conf::vocab32_t VOCAB_NAV_GET_NAV_MAP
constexpr yarp::conf::vocab32_t VOCAB_NAV_STOP
constexpr yarp::conf::vocab32_t VOCAB_NAV_SUSPEND
bool getLocation(std::string location_name, yarp::dev::Nav2D::Map2DLocation &loc) override
Retrieves a location previously stored by the user.
bool storeCurrentPosition(std::string location_name) override
Store the current location of the robot.
bool getCurrentPosition(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the current position of the robot w.r.t world reference frame.
bool gotoTargetByRelativeLocation(double x, double y, double theta) override
Ask the robot to reach a position defined in the robot reference frame.
bool getNavigationStatus(yarp::dev::Nav2D::NavigationStatusEnum &status) override
Gets the current status of the navigation task.
bool parse_respond_string(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
bool getEstimatedOdometry(yarp::dev::OdometryData &odom) override
Gets the estimated odometry the robot, including its velocity expressed in the world and in the local...
bool getLocalizationStatus(yarp::dev::Nav2D::LocalizationStatusEnum &status) override
Gets the current status of the localization task.
bool getEstimatedPoses(std::vector< yarp::dev::Nav2D::Map2DLocation > &poses) override
Gets a set of pose estimates computed by the localization algorithm.
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 getAllNavigationWaypoints(yarp::dev::Nav2D::TrajectoryTypeEnum trajectory_type, yarp::dev::Nav2D::Map2DPath &waypoints) override
Returns the list of waypoints generated by the navigation algorithm.
bool getAbsoluteLocationOfCurrentTarget(yarp::dev::Nav2D::Map2DLocation &loc) override
Gets the last navigation target in the world reference frame.
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual bool checkInsideArea(yarp::dev::Nav2D::Map2DArea area) override
Check if the robot is currently inside the specified area.
bool applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout=0.1) override
Apply a velocity command.
bool getNameOfCurrentTarget(std::string &location_name) override
Gets the name of the current target, if available (set by gotoTargetByLocationName)
bool deleteLocation(std::string location_name) override
Delete a location.
bool getRelativeLocationOfCurrentTarget(double &x, double &y, double &theta) override
Gets the last navigation target in the robot reference frame.
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.
bool recomputeCurrentNavigationPath() override
Forces the navigation system to recompute the path from the current robot position to the current goa...
bool getArea(std::string area_name, yarp::dev::Nav2D::Map2DArea &area) override
Retrieves an area previously stored by the user.
bool stopNavigation() override
Terminates the current navigation task.
bool suspendNavigation(const double time_s) override
Ask to the robot to suspend the current navigation task for a defined amount of time.
bool stopLocalizationService() override
Stops the localization service.
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...
bool clearAllLocations() override
Delete all stored locations.
bool gotoTargetByAbsoluteLocation(yarp::dev::Nav2D::Map2DLocation loc) override
Ask the robot to reach a position defined in the world reference frame.
bool close() override
Close the DeviceDriver.
bool gotoTargetByLocationName(std::string location_name) override
Ask the robot to reach a previously stored location/area.
bool startLocalizationService() override
Starts the localization service.
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 getCurrentNavigationWaypoint(yarp::dev::Nav2D::Map2DLocation &curr_waypoint) override
Returns the current waypoint pursued by the navigation algorithm.
bool getLocationsList(std::vector< std::string > &locations) override
Get a list of all stored locations.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool resumeNavigation() override
Resume a previously suspended navigation task.
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.
void push_back(yarp::dev::Nav2D::Map2DLocation loc)
Inserts a new location into the path @loc the location to be inserted.
void clear()
Remove all elements from the path.
double base_vel_x
velocity of the robot [m/s] expressed in the robot reference frame
double odom_vel_y
velocity of the robot [m/s] expressed in the world reference frame
double base_vel_theta
angular velocity of the robot [deg/s] expressed in the robot reference frame
double odom_vel_theta
angular velocity of the robot [deg/s] expressed in the world reference frame
double base_vel_y
velocity of the robot [m/s] expressed in the robot reference frame
double odom_x
position of the robot [m], expressed in the world reference frame
double odom_y
position of the robot [m], expressed in the world reference frame
double odom_theta
orientation the robot [deg], expressed in the world reference frame
double odom_vel_x
velocity of the robot [m/s] expressed in the world reference frame
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.
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
size_type size() const
Gets the number of elements in the bottle.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
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.
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.
A base class for nested structures that can be searched.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A single value (typically within a Bottle).
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual bool isString() const
Checks if value is a string.
virtual yarp::conf::vocab32_t asVocab32() const
Get vocabulary identifier as an integer.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual bool isList() const
Checks if value is a list.
virtual Bottle * asList() const
Get list value.
virtual std::string asString() const
Get string value.
void resize(size_t r, size_t c)
Resize the matrix, if matrix is not empty preserve old content.
size_t cols() const
Return number of columns.
size_t rows() const
Return number of rows.
std::string toString(int precision=-1, int width=-1, const char *endRowStr="\n") const
Print matrix to a string.
#define yCError(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
std::string statusToString(NavigationStatusEnum status)
An interface for the device drivers.
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.
std::string toString() const
Returns text representation of the location.