Skip to content

Commit

Permalink
fix(autoware_pure_pursuit): fix redundantInitialization redundantInit…
Browse files Browse the repository at this point in the history
…ialization (autowarefoundation#8225)

* fix(autoware_pure_pursuit): fix redundantInitialization redundantInitialization

Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>

* style(pre-commit): autofix

* Update control/autoware_pure_pursuit/src/autoware_pure_pursuit_core/interpolate.cpp

---------

Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Takayuki Murooka <takayuki5168@gmail.com>
  • Loading branch information
3 people authored and kyoichi-sugahara committed Aug 5, 2024
1 parent 321a313 commit 1433ae5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,13 @@ boost::optional<PpOutput> PurePursuitLateralController::calcTargetCurvature(
const bool is_reverse = (target_vel < 0);
const double min_lookahead_distance =
is_reverse ? param_.reverse_min_lookahead_distance : param_.min_lookahead_distance;
double lookahead_distance = min_lookahead_distance;
if (is_control_output) {
lookahead_distance = calcLookaheadDistance(
lateral_error, current_curvature, current_odometry_.twist.twist.linear.x,
min_lookahead_distance, is_control_output);
} else {
lookahead_distance = calcLookaheadDistance(
lateral_error, current_curvature, target_vel, min_lookahead_distance, is_control_output);
}
double lookahead_distance =
is_control_output
? calcLookaheadDistance(
lateral_error, current_curvature, current_odometry_.twist.twist.linear.x,
min_lookahead_distance, is_control_output)
: calcLookaheadDistance(
lateral_error, current_curvature, target_vel, min_lookahead_distance, is_control_output);

// Set PurePursuit data
pure_pursuit_->setCurrentPose(pose);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ void SplineInterpolate::generateSpline(const std::vector<double> & x)
std::vector<double> w_;
w_.push_back(0.0);

double tmp;
for (int i = 1; i < N - 1; i++) {
tmp = 1.0 / (4.0 - w_[i - 1]);
const double tmp = 1.0 / (4.0 - w_[i - 1]);
c_[i] = (c_[i] - c_[i - 1]) * tmp;
w_.push_back(tmp);
}
Expand Down

0 comments on commit 1433ae5

Please sign in to comment.