36 #define BOOST_PARAMETER_MAX_ARITY 7 43 PolyLine::PolyLine(
const std::vector < Eigen::Vector3f > &points) :
Line(points[points.size()-1] - points[0], points[0])
45 int n = points.size();
47 for (
int i = 0; i < n-1; i++) {
59 Eigen::Vector3f& foot_point,
60 double& distance_to_goal,
62 double& foot_alpha)
const 64 double min_len = DBL_MAX;
65 Eigen::Vector3f
point;
66 double from_start_to_foot = 0;
67 double distance_from_start = 0;
69 for(
int i = 0; i <
segments.size(); i++) {
71 double dist =
segments[i]->distanceWithInfo(from, point, to_goal);
76 foot_alpha = (
segments[i]->length() - to_goal);
77 from_start_to_foot = distance_from_start + foot_alpha;
79 distance_from_start +=
segments[i]->length();
81 distance_to_goal = distance_from_start - from_start_to_foot;
94 Eigen::Vector3f& foot_point)
const 103 segments[index]->getDirection(output);
114 double distance_from_start = 0;
115 for(
int i = 0; i <
segments.size(); i++) {
116 distance_from_start +=
segments[i]->length();
118 return distance_from_start;
129 marker.type = visualization_msgs::Marker::LINE_STRIP;
131 marker.scale.x = 0.02;
132 marker.color.a = 1.0;
133 marker.color.r = 0.0;
134 marker.color.g = 1.0;
135 marker.color.b = 1.0;
137 marker.pose.position.x = 0;
138 marker.pose.position.y = 0;
139 marker.pose.position.z = 0;
140 marker.pose.orientation.x = 0;
141 marker.pose.orientation.y = 0;
142 marker.pose.orientation.z = 0;
143 marker.pose.orientation.w = 1;
145 marker.points.resize(0);
146 for(
int i = 0; i <
segments.size(); i++) {
149 geometry_msgs::Point pt;
153 marker.points.push_back(pt);
158 geometry_msgs::Point pt;
162 marker.points.push_back(pt);
170 os <<
", " << pl.
origin_[2] <<
"]";
172 for (
int i = 0; i < pl.
segments.size(); i++) {
175 os <<
" -- [" << p[0];
177 os <<
", " << p[2] <<
"]";
friend std::ostream & operator<<(std::ostream &os, const PolyLine &pl)
virtual double distanceWithInfo(const Eigen::Vector3f &from, Eigen::Vector3f &foot_point, double &distance_to_goal, int &foot_index, double &foot_alpha) const
compute a distance to a point, get various information
std::vector< Segment::Ptr > segments
virtual PolyLine::Ptr flipPolyLine() const
void toMarker(visualization_msgs::Marker &marker) const
PolyLine(const std::vector< Eigen::Vector3f > &points)
Construct a polyline from points. The polyline consists of lines which starts with p[i] and ends with...
virtual void point(double alpha, Eigen::Vector3f &ouptut)
Compute a point on normal from alpha parameter.
Class to represent 3-D polyline (not closed).
Class to represent 3-D straight line which has finite length.
virtual double length() const
get total length of the polyline
virtual Segment::Ptr at(int index) const
virtual double distance(const Eigen::Vector3f &point, Eigen::Vector3f &foot_point) const
compute a distance to a point
virtual Eigen::Vector3f getDirection() const
get normalized direction vector of the line.
Class to represent 3-D straight line.