Skip to content

Commit

Permalink
Fix length computation (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaeyoung-Lim authored Apr 16, 2024
1 parent 4f2eecc commit 70883ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions terrain_navigation/include/terrain_navigation/path_segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ class PathSegment {
Eigen::Vector2d arc_center_2d = getArcCenter(segment_start_2d, segment_start_tangent_2d, curvature);
Eigen::Vector2d start_vector = (segment_start_2d - arc_center_2d).normalized();
Eigen::Vector2d end_vector = (segment_end_2d - arc_center_2d).normalized();

double psi = std::atan2(end_vector(1), end_vector(0)) - std::atan2(start_vector(1), start_vector(0));
double psi = curvature > 0
? std::atan2(end_vector(1), end_vector(0)) - std::atan2(start_vector(1), start_vector(0))
: std::atan2(start_vector(1), start_vector(0)) - std::atan2(end_vector(1), end_vector(0));
wrap_2pi(psi);
length = (1 / std::abs(curvature)) * psi;
}
Expand Down

0 comments on commit 70883ff

Please sign in to comment.