Skip to content

Commit

Permalink
feat(lane_departure_checker): add braking distance offset to avoid un…
Browse files Browse the repository at this point in the history
…wanted move after stop (autowarefoundation#2712)

Signed-off-by: Berkay Karaman <[email protected]>
  • Loading branch information
brkay54 authored Jan 24, 2023
1 parent 403713d commit dd022c4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
max_longitudinal_deviation: 2.0
max_yaw_deviation_deg: 60.0
delta_yaw_threshold_for_closest_point: 1.570 #M_PI/2.0, delta yaw thres for closest point
min_braking_distance: 0.0
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct Param
double max_lateral_deviation;
double max_longitudinal_deviation;
double max_yaw_deviation_deg;
double min_braking_distance;
// nearest search to ego
double ego_nearest_dist_threshold;
double ego_nearest_yaw_threshold;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ Output LaneDepartureChecker::update(const Input & input)
const auto & raw_abs_velocity = std::abs(input.current_odom->twist.twist.linear.x);
const auto abs_velocity = raw_abs_velocity < min_velocity ? 0.0 : raw_abs_velocity;

const auto braking_distance =
calcBrakingDistance(abs_velocity, param_.max_deceleration, param_.delay_time);
const auto braking_distance = std::max(
param_.min_braking_distance,
calcBrakingDistance(abs_velocity, param_.max_deceleration, param_.delay_time));

output.resampled_trajectory = cutTrajectory(
resampleTrajectory(*input.predicted_trajectory, param_.resample_interval), braking_distance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ LaneDepartureCheckerNode::LaneDepartureCheckerNode(const rclcpp::NodeOptions & o
param_.max_yaw_deviation_deg = declare_parameter("max_yaw_deviation_deg", 30.0);
param_.ego_nearest_dist_threshold = declare_parameter<double>("ego_nearest_dist_threshold");
param_.ego_nearest_yaw_threshold = declare_parameter<double>("ego_nearest_yaw_threshold");
param_.min_braking_distance = declare_parameter<double>("min_braking_distance");

// Parameter Callback
set_param_res_ =
Expand Down Expand Up @@ -367,6 +368,7 @@ rcl_interfaces::msg::SetParametersResult LaneDepartureCheckerNode::onParameter(
update_param(parameters, "resample_interval", param_.resample_interval);
update_param(parameters, "max_deceleration", param_.max_deceleration);
update_param(parameters, "delay_time", param_.delay_time);
update_param(parameters, "min_braking_distance", param_.min_braking_distance);

if (lane_departure_checker_) {
lane_departure_checker_->setParam(param_);
Expand Down

0 comments on commit dd022c4

Please sign in to comment.