Waypoints fixes, but still inverted for now

This commit is contained in:
Marc Garcia Puig 2019-03-21 21:13:00 +01:00
parent e9bd864426
commit f9dbee7ba6
4 changed files with 7 additions and 6 deletions

View File

@ -55,11 +55,12 @@ namespace geom {
p.y = -p.y;
start_pos.y = -start_pos.y;
heading = -heading;
curvature = -curvature;
// since this algorithm is working for positive curvatures,
// and we are only calculating distances, we can invert the y
// axis (along with the curvature and the heading), so if the
// curvature is negative, so the algorithm will work as expected
// curvature is negative, the algorithm will work as expected
if (curvature < 0.0) {
p.y = -p.y;
start_pos.y = -start_pos.y;

View File

@ -214,7 +214,7 @@ namespace road {
lane_tangent = computed_width.second;
}
// get a directed pooint in s and apply the computed lateral offet
// get a directed point in s and apply the computed lateral offet
DirectedPoint dp = road->GetDirectedPointIn(waypoint.s);
geom::Rotation rot(

View File

@ -177,7 +177,7 @@ namespace road {
const auto lane_offset = _info.GetInfo<element::RoadInfoLaneOffset>(clamped_s);
const float offset = lane_offset->GetPolynomial().Evaluate(clamped_s);
element::DirectedPoint p = geometry->GetGeometry().PosFromDist(clamped_s);
element::DirectedPoint p = geometry->GetGeometry().PosFromDist(clamped_s - geometry->GetDistance());
p.ApplyLateralOffset(offset);
const auto elevation_info = GetElevationOn(s);

View File

@ -157,11 +157,11 @@ namespace element {
assert(std::fabs(_curvature) > 1e-15);
const double radius = 1.0 / _curvature;
DirectedPoint p(_start_position, _heading);
p.location.x -= radius * std::cos(p.tangent + geom::Math::pi_half());
p.location.y -= radius * std::sin(p.tangent + geom::Math::pi_half());
p.tangent -= dist * _curvature;
p.location.x += radius * std::cos(p.tangent + geom::Math::pi_half());
p.location.y += radius * std::sin(p.tangent + geom::Math::pi_half());
p.tangent += dist * _curvature;
p.location.x -= radius * std::cos(p.tangent + geom::Math::pi_half());
p.location.y -= radius * std::sin(p.tangent + geom::Math::pi_half());
return p;
}