Skip to content

Commit

Permalink
add vel lpf and disable_target_acceleration
Browse files Browse the repository at this point in the history
Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
  • Loading branch information
takayuki5168 committed Dec 19, 2022
1 parent 9980b1b commit b41842b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class PIDBasedPlanner : public PlannerInterface
double output_ratio_during_accel;
double vel_to_acc_weight;
bool enable_jerk_limit_to_output_acc{false};
bool disable_target_acceleration{false};
};
VelocityLimitBasedPlannerParam velocity_limit_based_planner_param_;

Expand Down Expand Up @@ -131,6 +132,7 @@ class PIDBasedPlanner : public PlannerInterface
std::shared_ptr<LowpassFilter1d> lpf_normalized_error_cruise_dist_ptr_;

// lpf for output
std::shared_ptr<LowpassFilter1d> lpf_output_vel_ptr_;
std::shared_ptr<LowpassFilter1d> lpf_output_acc_ptr_;
std::shared_ptr<LowpassFilter1d> lpf_output_jerk_ptr_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ PIDBasedPlanner::PIDBasedPlanner(
velocity_limit_based_planner_param_.enable_jerk_limit_to_output_acc =
node.declare_parameter<bool>(
"pid_based_planner.velocity_limit_based_planner.enable_jerk_limit_to_output_acc");

velocity_limit_based_planner_param_.disable_target_acceleration =
node.declare_parameter<bool>("pid_based_planner.velocity_limit_based_planner.disable_target_acceleration");
}

{ // velocity insertion based planner
Expand Down Expand Up @@ -139,6 +142,7 @@ PIDBasedPlanner::PIDBasedPlanner(
lpf_dist_to_obstacle_ptr_ = std::make_shared<LowpassFilter1d>(0.5);
lpf_obstacle_vel_ptr_ = std::make_shared<LowpassFilter1d>(0.5);
lpf_error_cruise_dist_ptr_ = std::make_shared<LowpassFilter1d>(0.5);
lpf_output_vel_ptr_ = std::make_shared<LowpassFilter1d>(0.5);
lpf_output_acc_ptr_ = std::make_shared<LowpassFilter1d>(0.5);
lpf_output_jerk_ptr_ = std::make_shared<LowpassFilter1d>(0.5);
}
Expand Down Expand Up @@ -324,6 +328,7 @@ Trajectory PIDBasedPlanner::planCruise(
prev_target_acc_ = {};
lpf_normalized_error_cruise_dist_ptr_->reset();
lpf_output_acc_ptr_->reset();
lpf_output_vel_ptr_->reset();
lpf_output_jerk_ptr_->reset();

// delete marker
Expand Down Expand Up @@ -357,10 +362,15 @@ VelocityLimit PIDBasedPlanner::doCruiseWithVelocityLimit(
}();

const double positive_target_vel =
std::max(min_cruise_target_vel_, planner_data.current_vel + additional_vel);
lpf_output_vel_ptr_->filter(
std::max(min_cruise_target_vel_, planner_data.current_vel + additional_vel));

// calculate target acceleration
const double target_acc = [&]() {
if (p.disable_target_acceleration) {
return min_accel_during_cruise_;
}

double target_acc = p.vel_to_acc_weight * additional_vel;

// apply acc limit
Expand Down Expand Up @@ -629,6 +639,10 @@ void PIDBasedPlanner::updateParam(const std::vector<rclcpp::Parameter> & paramet
tier4_autoware_utils::updateParam<bool>(
parameters, "pid_based_planner.velocity_limit_based_planner.enable_jerk_limit_to_output_acc",
p.enable_jerk_limit_to_output_acc);

tier4_autoware_utils::updateParam<bool>(
parameters, "pid_based_planner.velocity_limit_based_planner.disable_target_acceleration",
p.disable_target_acceleration);
}

{ // velocity insertion based planner
Expand Down

0 comments on commit b41842b

Please sign in to comment.