Skip to content

Commit

Permalink
Use periodic information for getLength (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaeyoung-Lim authored Mar 5, 2024
1 parent 27b19f4 commit 0d03b5e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions terrain_navigation/include/terrain_navigation/path_segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class PathSegment {
return theta;
}

double getLength(double epsilon = 0.001) const {
double getLength() const {
double length{0.0};
const Eigen::Vector3d segment_start = states.front().position;
const Eigen::Vector3d segment_end = states.back().position;
Expand All @@ -177,7 +177,7 @@ class PathSegment {
// Compute closest point on a Arc segment
Eigen::Vector2d segment_start_2d = segment_start.head(2);
Eigen::Vector2d segment_end_2d = segment_end.head(2);
if ((segment_start_2d - segment_end_2d).norm() < epsilon) {
if (is_periodic) {
// Return full circle length
length = 2 * M_PI * (1 / std::abs(curvature));
} else {
Expand Down
2 changes: 1 addition & 1 deletion terrain_navigation_ros/src/terrain_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void TerrainPlanner::cmdloopCallback(const ros::TimerEvent &event) {
double next_segment_curvature = reference_primitive_.segments[current_segment_idx + 1].curvature;

/// Blend current curvature with next curvature when close to the end
double segment_length = current_segment.getLength(1.0);
double segment_length = current_segment.getLength();
double cut_off_distance = 10.0;
double portion = std::min(
1.0, std::max((path_progress * segment_length - segment_length + cut_off_distance) / cut_off_distance, 0.0));
Expand Down

0 comments on commit 0d03b5e

Please sign in to comment.