Skip to content

Commit

Permalink
fix: for pr299 function to work (#301)
Browse files Browse the repository at this point in the history
Signed-off-by: Azumi Suzuki <[email protected]>
  • Loading branch information
s-azumi authored Mar 3, 2023
1 parent dbe4cd7 commit 7047778
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,6 @@ void MotionVelocitySmootherNode::onExternalVelocityLimit(const VelocityLimit::Co
constexpr double eps = 1.0E-04;
const double margin = node_param_.margin_to_insert_external_velocity_limit;

// Set distance as zero if ego vehicle is stopped and external velocity limit is zero
if (
std::fabs(current_odometry_ptr_->twist.twist.linear.x) < eps &&
external_velocity_limit_ < eps) {
external_velocity_limit_dist_ = 0.0;
}

// calculate distance and maximum velocity
// to decelerate to external velocity limit with jerk and acceleration
// constraints.
Expand Down Expand Up @@ -425,6 +418,14 @@ void MotionVelocitySmootherNode::updateDataForExternalVelocityLimit()
return;
}

// Set distance as zero if ego vehicle is stopped and external velocity limit is zero
constexpr double eps = 1.0E-04;
if (
std::fabs(current_odometry_ptr_->twist.twist.linear.x) < eps &&
external_velocity_limit_ < eps) {
external_velocity_limit_dist_ = 0.0;
}

// calculate distance to insert external velocity limit
const double travel_dist = calcTravelDistance();
external_velocity_limit_dist_ -= travel_dist;
Expand Down

0 comments on commit 7047778

Please sign in to comment.