28 for (
size_t i = 0; i < waypoints.size(); i++)
29 if (this->waypoints[i].map_id == r.
waypoints[i].map_id ||
30 this->waypoints[i].x == r.
waypoints[i].x ||
31 this->waypoints[i].y == r.
waypoints[i].y ||
32 this->waypoints[i].theta == r.
waypoints[i].theta)
return false;
38 for (
size_t i = 0; i < waypoints.size(); i++)
39 if (this->waypoints[i].map_id != r.
waypoints[i].map_id ||
40 this->waypoints[i].x != r.
waypoints[i].x ||
41 this->waypoints[i].y != r.
waypoints[i].y ||
42 this->waypoints[i].theta != r.
waypoints[i].theta)
return false;
48 std::ostringstream stringStream;
49 stringStream.precision(2);
51 for (
size_t i = 0; i < waypoints.size(); i++)
53 stringStream <<
" waypoint " << i <<
"(" << waypoints[i].map_id <<
" " << waypoints[i].x <<
"," << waypoints[i].y <<
"," << waypoints[i].theta <<
")";
55 return stringStream.str();
60 this->waypoints.clear();
65 for (
const auto& map_waypoint : map_waypoints)
67 waypoints.push_back(map_waypoint);
77 return waypoints[index];
82 return this->waypoints.size();
88 for (
auto it = waypoints.begin(); it != waypoints.end(); it++)
90 ll += sqrt(pow(it->x,2)+ pow(it->y,2));
97 if (waypoints.size() == 0)
return true;
98 string mapname = waypoints[0].map_id;
99 for (
auto it = waypoints.begin(); it != waypoints.end(); it++)
101 if (it->map_id != mapname)
return false;
108 return waypoints.begin();
114 return waypoints.end();
119 return waypoints.cbegin();
124 return waypoints.cend();
129 waypoints.push_back(loc);
contains the definition of a Map2DPath type
std::vector< yarp::dev::Nav2D::Map2DLocation > waypoints
void push_back(yarp::dev::Nav2D::Map2DLocation loc)
Inserts a new location into the path @loc the location to be inserted.
std::vector< Map2DLocation >::const_iterator const_iterator
void clear()
Remove all elements from the path.
const_iterator cbegin() const noexcept
Returns a const iterator to the begin of the Path.
const_iterator cend() const noexcept
Returns a const iterator to the end of the Path.
std::string toString() const
Returns text representation of the path.
yarp::dev::Nav2D::Map2DLocation & operator[](size_t index)
Returns a waypoint in the path.
iterator begin() noexcept
Returns an iterator to the begin of the Path.
size_t size() const
Returns the size of the path.
bool operator==(const Map2DPath &r) const
Compares two Map2DArea.
bool isOnSingleMap() const
Checks if all the waypoints of the path belong to the same map return true if the test is successful.
bool operator!=(const Map2DPath &r) const
Compares two Map2DPath.
std::vector< Map2DLocation >::iterator iterator
double getLength() const
Returns the length of the path.
Map2DPath()
Default constructor: the map name is empty, coordinates are set to zero.
iterator end() noexcept
Returns an iterator to the end of the Path.
An interface for the device drivers.
An interface to the operating system, including Port based communication.