Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(obstacle_stop_planner): add margin behind goal #2953

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions planning/obstacle_stop_planner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ This module has parameter `hold_stop_margin_distance` in order to prevent from t

#### Stop position

| Parameter | Type | Description |
| --------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `max_longitudinal_margin` | double | margin between obstacle and the ego's front [m] |
| `min_longitudinal_margin` | double | if any obstacle exists within `max_longitudinal_margin`, this module set margin as the value of _stop margin_ to `min_longitudinal_margin` [m] |
| `hold_stop_margin_distance` | double | parameter for restart prevention (See above section) [m] |
| Parameter | Type | Description |
| ------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `max_longitudinal_margin` | double | margin between obstacle and the ego's front [m] |
| `max_longitudinal_margin_behind_goal` | double | margin between obstacle and the ego's front when the stop point is behind the goal[m] |
| `min_longitudinal_margin` | double | if any obstacle exists within `max_longitudinal_margin`, this module set margin as the value of _stop margin_ to `min_longitudinal_margin` [m] |
| `hold_stop_margin_distance` | double | parameter for restart prevention (See above section) [m] |

#### Obstacle detection area

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
stop_planner:
# params for stop position
stop_position:
max_longitudinal_margin: 5.0 # stop margin distance from obstacle on the path [m]
min_longitudinal_margin: 2.0 # stop margin distance when any other stop point is inserted in stop margin [m]
hold_stop_margin_distance: 0.0 # the ego keeps stopping if the ego is in this margin [m]
max_longitudinal_margin: 5.0 # stop margin distance from obstacle on the path [m]
max_longitudinal_margin_behind_goal: 3.0 # stop margin distance from obstacle behind the goal on the path [m]
min_longitudinal_margin: 2.0 # stop margin distance when any other stop point is inserted in stop margin [m]
hold_stop_margin_distance: 0.0 # the ego keeps stopping if the ego is in this margin [m]

# params for detection area
detection_area:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ struct StopParam

// margin between obstacle and the ego's front [m]
double max_longitudinal_margin;
double max_longitudinal_margin_behind_goal;

// margin between obstacle and the ego's front [m]
// if any other stop point is inserted within max_longitudinal_margin.
Expand Down
10 changes: 9 additions & 1 deletion planning/obstacle_stop_planner/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ ObstacleStopPlannerNode::ObstacleStopPlannerNode(const rclcpp::NodeOptions & nod
// params for stop position
p.max_longitudinal_margin =
declare_parameter<double>(ns + "stop_position.max_longitudinal_margin");
p.max_longitudinal_margin_behind_goal =
declare_parameter<double>(ns + "stop_position.max_longitudinal_margin_behind_goal");
p.min_longitudinal_margin =
declare_parameter<double>(ns + "stop_position.min_longitudinal_margin");
p.hold_stop_margin_distance =
Expand All @@ -104,6 +106,7 @@ ObstacleStopPlannerNode::ObstacleStopPlannerNode(const rclcpp::NodeOptions & nod

// apply offset
p.max_longitudinal_margin += i.max_longitudinal_offset_m;
p.max_longitudinal_margin_behind_goal += i.max_longitudinal_offset_m;
p.min_longitudinal_margin += i.max_longitudinal_offset_m;
p.stop_search_radius =
p.step_length +
Expand Down Expand Up @@ -1297,8 +1300,13 @@ StopPoint ObstacleStopPlannerNode::searchInsertPoint(
const int idx, const TrajectoryPoints & base_trajectory, const double dist_remain,
const StopParam & stop_param)
{
const bool is_behind_goal = static_cast<size_t>(idx) == base_trajectory.size() - 1;
const double max_longitudinal_margin = is_behind_goal
? stop_param.max_longitudinal_margin_behind_goal
: stop_param.max_longitudinal_margin;

const auto max_dist_stop_point =
createTargetPoint(idx, stop_param.max_longitudinal_margin, base_trajectory, dist_remain);
createTargetPoint(idx, max_longitudinal_margin, base_trajectory, dist_remain);
const auto min_dist_stop_point =
createTargetPoint(idx, stop_param.min_longitudinal_margin, base_trajectory, dist_remain);

Expand Down