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_cruise_planner): prior generation of collision distance #5619

Conversation

yuki-takagi-66
Copy link
Contributor

@yuki-takagi-66 yuki-takagi-66 commented Nov 17, 2023

Description

BEFORE:
The current implementation calculate the stop point by the closest collision point.
This cause inappropriate behavior for looped trajectories.
image-20231020-104158

AFTER:
Screenshot from 2023-11-17 16-54-44

The followings are achieved by this PR,

  • Proper handling of collision in extended trajectory is achieved (It is the main motivation of this PR).
  • The stop point modification around the goal point is now working properly.
  • goal_extension_length and goal_extension_interval may be no longer used and safe_distance_margin and decimate_trajectory_step_length are used instead.

This PR similar to #5512, but this PR maintain more compatibility.
In other words, the function that included in the above PR This PR contains the similar feature to #4952, and therefore approaching on curve is now provided as default setting. is obsoleted.

Related links

Tests performed

psim tests and Tier4 internal tests was performed in success.
No degrade directly related to this PR founds.
https://evaluation.tier4.jp/evaluation/reports/52d22759-d1af-5896-b016-3b45e73d4138?project_id=prd_jt

Notes for reviewers

While no longer used parameters remain, I will remove these parameters after this PR has been agreed upon.

Interface changes

No interface changes.

Effects on system behavior

Minor bugs mentioned above have been fixed.
The slow down planning and the cruise planning may not changed.

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
@github-actions github-actions bot added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label Nov 17, 2023
@yuki-takagi-66 yuki-takagi-66 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Nov 17, 2023
@yuki-takagi-66 yuki-takagi-66 changed the title Feat/obstacle cruise/prior generation of collision distance feat(obstacle cruise): prior generation of collision distance Nov 17, 2023
@yuki-takagi-66 yuki-takagi-66 changed the title feat(obstacle cruise): prior generation of collision distance feat(obstacle_cruise_planner): prior generation of collision distance Nov 17, 2023
@yuki-takagi-66 yuki-takagi-66 marked this pull request as ready for review November 17, 2023 08:24
Copy link

codecov bot commented Nov 17, 2023

Codecov Report

Attention: 50 lines in your changes are missing coverage. Please review.

Comparison is base (765a596) 15.32% compared to head (4ff7372) 15.35%.
Report is 121 commits behind head on main.

Files Patch % Lines
.../obstacle_cruise_planner/src/planner_interface.cpp 0.00% 22 Missing ⚠️
...ning/obstacle_cruise_planner/src/polygon_utils.cpp 0.00% 12 Missing ⚠️
planning/obstacle_cruise_planner/src/node.cpp 0.00% 6 Missing and 1 partial ⚠️
...rivable_area_expansion/drivable_area_expansion.cpp 40.00% 0 Missing and 3 partials ⚠️
planning/obstacle_cruise_planner/src/utils.cpp 40.00% 3 Missing ⚠️
...include/obstacle_cruise_planner/common_structs.hpp 0.00% 2 Missing ⚠️
...lude/obstacle_cruise_planner/planner_interface.hpp 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5619      +/-   ##
==========================================
+ Coverage   15.32%   15.35%   +0.02%     
==========================================
  Files        1721     1721              
  Lines      118559   118523      -36     
  Branches    37995    38078      +83     
==========================================
+ Hits        18169    18199      +30     
+ Misses      79657    79569      -88     
- Partials    20733    20755      +22     
Flag Coverage Δ *Carryforward flag
differential 8.39% <4.08%> (?)
total 15.35% <40.00%> (+0.03%) ⬆️ Carriedforward from 069439b

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 73 to 75
std::optional<double> calcCollisionDistanceForStopObstacle(
const std::vector<TrajectoryPoint> & traj_points, const std::vector<Polygon2d> & traj_polys,
const Obstacle & obstacle) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::optional<double> calcCollisionDistanceForStopObstacle(
const std::vector<TrajectoryPoint> & traj_points, const std::vector<Polygon2d> & traj_polys,
const Obstacle & obstacle) const;

Seems this function declaration is not required.

const std::vector<TrajectoryPoint> & traj_points, const std::vector<Polygon2d> & traj_polys,
const Obstacle & obstacle)
{
auto obstacle_polygon = tier4_autoware_utils::toPolygon2d(obstacle.pose, obstacle.shape);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto obstacle_polygon = tier4_autoware_utils::toPolygon2d(obstacle.pose, obstacle.shape);
const auto obstacle_polygon = tier4_autoware_utils::toPolygon2d(obstacle.pose, obstacle.shape);

for (size_t col_i = 0; col_i < traj_polys.size(); ++col_i) {
if (boost::geometry::intersects(traj_polys.at(col_i), obstacle_polygon)) {
try {
double prev_index_dist =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
double prev_index_dist =
const double prev_index_dist =

auto obstacle_polygon = tier4_autoware_utils::toPolygon2d(obstacle.pose, obstacle.shape);
for (size_t col_i = 0; col_i < traj_polys.size(); ++col_i) {
if (boost::geometry::intersects(traj_polys.at(col_i), obstacle_polygon)) {
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use try here?
I think we can handle the corner case without using try, which is a better implementation

@@ -401,12 +373,13 @@ std::vector<TrajectoryPoint> PlannerInterface::generateStopTrajectory(

stop_planning_debug_info_.set(
StopPlanningDebugInfo::TYPE::STOP_CURRENT_OBSTACLE_DISTANCE,
closest_obstacle_dist - abs_ego_offset); // TODO(murooka)
closest_stop_obstacle->dist_to_collide); // TODO(murooka)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Seems dist_to_collide does not consider the following distances

  • the distance from the path start point and the ego position
  • the distance from the base link to the ego front position.

: TargetObstacleInterface(arg_uuid, arg_stamp, arg_pose, arg_lon_velocity, arg_lat_velocity),
shape(arg_shape),
collision_point(arg_collision_point)
collision_point(arg_collision_point),
Copy link
Contributor

@takayuki5168 takayuki5168 Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it hard to remove the collision_point here so that the developer will not get confused about which (collision point or dist_to_collide) to use?
If this still exists here, it will be used for some calculation by mistake.

Actually, the nearest search is applied to this collision point, which is not expected.

motion_utils::findNearestSegmentIndex(planner_data.traj_points, stop_obstacle.collision_point);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this variable has to exist for the debug information, we'd better change the variable name to collision_point_for_debug for example so that the developer can understand the reason for this variable to exist.

Comment on lines 274 to 276
double dist_to_collide_on_ref_traj =
motion_utils::calcSignedArcLength(planner_data.traj_points, 0, ego_segment_idx) +
closest_stop_obstacle->dist_to_collide;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot consider the detailed ego position since ego_segment_idx means the resampled index for the ego position.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the distance from the base link to the ego front position (abs_ego_offset) seems not considered with this PR's change.

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
@yuki-takagi-66 yuki-takagi-66 merged commit fd58f69 into autowarefoundation:main Dec 1, 2023
@yuki-takagi-66 yuki-takagi-66 deleted the feat/obstacle_cruise/prior-generation-of-collision-distance branch December 1, 2023 04:29
tkimura4 pushed a commit to tier4/autoware.universe that referenced this pull request Dec 1, 2023
…autowarefoundation#5619)

* set goal extension param as unused
* change to use collision point
* fill out z coordinate value
* handle with the backward paths

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
danielsanchezaran pushed a commit to tier4/autoware.universe that referenced this pull request Dec 15, 2023
…autowarefoundation#5619)

* set goal extension param as unused
* change to use collision point
* fill out z coordinate value
* handle with the backward paths

Signed-off-by: Yuki Takagi <yuki.takagi@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:planning Route planning, decision-making, and navigation. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants