Skip to content
Snippets Groups Projects
Commit 6da7f923 authored by Fabian Reister's avatar Fabian Reister
Browse files

trajectory: projection with additional info

parent 6fb08c32
No related branches found
No related tags found
No related merge requests found
......@@ -188,6 +188,22 @@ namespace armarx::nav::core
bestProj.wayPointAfter = wpAfter;
bestProj.projection.waypoint.pose = ip.Get(t);
bestProj.segment = [&]
{
if (i == 0)
{
return Projection::Segment::FIRST;
}
if (i == (pts.size() - 1))
{
return Projection::Segment::FINAL;
}
return Projection::Segment::INTERMEDIATE;
}();
switch (velocityInterpolation)
{
case VelocityInterpolation::LinearInterpolation:
......@@ -324,13 +340,9 @@ namespace armarx::nav::core
pointOnPath += dir * eps;
resampledPath.push_back(pointOnPath);
float d = (nav::conv::to2D(pointOnPath) - lineSegment.end).norm();
d += 1;
}
// find the segment that is sufficiently away from the current pointOnPath
// find the segment that is sufficiently far away from the current pointOnPath
// skip those segments that are too close
// => find the first segment that penetrates the epsilon-region
const float distanceEnd = (lineSegment.end - nav::conv::to2D(pointOnPath)).norm();
......@@ -378,6 +390,12 @@ namespace armarx::nav::core
resampledPath.push_back(pointOnPath);
}
// remove first "waypoint" => this is the start
resampledPath.erase(resampledPath.begin());
// remove last "waypoint" => this is the end
resampledPath.pop_back();
// TODO(fabian.reister): debug
ARMARX_INFO << "Resampled path contains " << resampledPath.size() << " waypoints";
......
......@@ -43,6 +43,15 @@ namespace armarx::nav::core
TrajectoryPoint wayPointBefore;
TrajectoryPoint wayPointAfter;
enum class Segment
{
FIRST,
INTERMEDIATE,
FINAL
};
Segment segment;
};
enum class VelocityInterpolation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment