@@ -459,18 +459,33 @@ void GoalPlannerModule::updateData()
459
459
{
460
460
universe_utils::ScopedTimeTrack st (__func__, *time_keeper_);
461
461
462
- // extract static and dynamic objects in expanded pull over lanes
462
+ // extract static and dynamic objects in extraction polygon for path coliision check
463
463
{
464
464
const auto & p = parameters_;
465
465
const auto & rh = *(planner_data_->route_handler );
466
466
const auto objects = *(planner_data_->dynamic_object );
467
- const auto static_target_objects =
468
- goal_planner_utils::extractStaticObjectsInExpandedPullOverLanes (
469
- rh, left_side_parking_, p->backward_goal_search_length , p->forward_goal_search_length ,
470
- p->detection_bound_offset , objects, p->th_moving_object_velocity );
471
- const auto dynamic_target_objects = goal_planner_utils::extractObjectsInExpandedPullOverLanes (
472
- rh, left_side_parking_, p->backward_goal_search_length , p->forward_goal_search_length ,
473
- p->detection_bound_offset , objects);
467
+ const double vehicle_width = planner_data_->parameters .vehicle_width ;
468
+ const auto pull_over_lanes = goal_planner_utils::getPullOverLanes (
469
+ rh, left_side_parking_, p->backward_goal_search_length , p->forward_goal_search_length );
470
+ const auto objects_extraction_polygon = goal_planner_utils::generateObjectExtractionPolygon (
471
+ pull_over_lanes, left_side_parking_, p->detection_bound_offset ,
472
+ p->margin_from_boundary + p->max_lateral_offset + vehicle_width);
473
+ if (objects_extraction_polygon.has_value ()) {
474
+ debug_data_.objects_extraction_polygon = objects_extraction_polygon.value ();
475
+ }
476
+ PredictedObjects dynamic_target_objects{};
477
+ for (const auto & object : objects.objects ) {
478
+ const auto object_polygon = universe_utils::toPolygon2d (object);
479
+ if (
480
+ objects_extraction_polygon.has_value () &&
481
+ boost::geometry::intersects (object_polygon, objects_extraction_polygon.value ())) {
482
+ dynamic_target_objects.objects .push_back (object);
483
+ }
484
+ }
485
+ const auto static_target_objects = utils::path_safety_checker::filterObjectsByVelocity (
486
+ dynamic_target_objects, p->th_moving_object_velocity );
487
+
488
+ // these objects are used for path collision check not for safety check
474
489
thread_safe_data_.set_static_target_objects (static_target_objects);
475
490
thread_safe_data_.set_dynamic_target_objects (dynamic_target_objects);
476
491
}
@@ -739,7 +754,9 @@ bool GoalPlannerModule::planFreespacePath(
739
754
{
740
755
GoalCandidates goal_candidates{};
741
756
goal_candidates = thread_safe_data_.get_goal_candidates ();
742
- goal_searcher->update (goal_candidates, occupancy_grid_map, planner_data);
757
+ goal_searcher->update (
758
+ goal_candidates, occupancy_grid_map, planner_data,
759
+ thread_safe_data_.get_static_target_objects ());
743
760
thread_safe_data_.set_goal_candidates (goal_candidates);
744
761
debug_data_.freespace_planner .num_goal_candidates = goal_candidates.size ();
745
762
debug_data_.freespace_planner .is_planning = true ;
@@ -824,7 +841,7 @@ GoalCandidates GoalPlannerModule::generateGoalCandidates() const
824
841
// calculate goal candidates
825
842
const auto & route_handler = planner_data_->route_handler ;
826
843
if (utils::isAllowedGoalModification (route_handler)) {
827
- return goal_searcher_->search (occupancy_grid_map_, planner_data_);
844
+ return goal_searcher_->search (planner_data_);
828
845
}
829
846
830
847
// NOTE:
@@ -1282,9 +1299,9 @@ DecidingPathStatusWithStamp GoalPlannerModule::checkDecidingPathStatus(
1282
1299
// check goal pose collision
1283
1300
const auto modified_goal_opt = thread_safe_data_.get_modified_goal_pose ();
1284
1301
if (
1285
- modified_goal_opt &&
1286
- !goal_searcher-> isSafeGoalWithMarginScaleFactor (
1287
- modified_goal_opt. value (), hysteresis_factor, occupancy_grid_map, planner_data)) {
1302
+ modified_goal_opt && !goal_searcher-> isSafeGoalWithMarginScaleFactor (
1303
+ modified_goal_opt. value (), hysteresis_factor, occupancy_grid_map,
1304
+ planner_data, thread_safe_data_. get_static_target_objects () )) {
1288
1305
RCLCPP_DEBUG (getLogger (), " [DecidingPathStatus]: DECIDING->NOT_DECIDED. goal is not safe" );
1289
1306
return {DecidingPathStatus::NOT_DECIDED, clock_->now ()};
1290
1307
}
@@ -1443,7 +1460,9 @@ BehaviorModuleOutput GoalPlannerModule::planPullOverAsOutput()
1443
1460
1444
1461
// update goal candidates
1445
1462
auto goal_candidates = thread_safe_data_.get_goal_candidates ();
1446
- goal_searcher_->update (goal_candidates, occupancy_grid_map_, planner_data_);
1463
+ goal_searcher_->update (
1464
+ goal_candidates, occupancy_grid_map_, planner_data_,
1465
+ thread_safe_data_.get_static_target_objects ());
1447
1466
1448
1467
// Select a path that is as safe as possible and has a high priority.
1449
1468
const auto pull_over_path_candidates = thread_safe_data_.get_pull_over_path_candidates ();
@@ -2518,6 +2537,24 @@ void GoalPlannerModule::setDebugData()
2518
2537
// Visualize goal candidates
2519
2538
const auto goal_candidates = thread_safe_data_.get_goal_candidates ();
2520
2539
add (goal_planner_utils::createGoalCandidatesMarkerArray (goal_candidates, color));
2540
+
2541
+ // Visualize objects extraction polygon
2542
+ auto marker = autoware::universe_utils::createDefaultMarker (
2543
+ " map" , rclcpp::Clock{RCL_ROS_TIME}.now (), " objects_extraction_polygon" , 0 , Marker::LINE_LIST,
2544
+ autoware::universe_utils::createMarkerScale (0.1 , 0.0 , 0.0 ),
2545
+ autoware::universe_utils::createMarkerColor (0.0 , 1.0 , 1.0 , 0.999 ));
2546
+ const double ego_z = planner_data_->self_odometry ->pose .pose .position .z ;
2547
+ for (size_t i = 0 ; i < debug_data_.objects_extraction_polygon .outer ().size (); ++i) {
2548
+ const auto & current_point = debug_data_.objects_extraction_polygon .outer ().at (i);
2549
+ const auto & next_point = debug_data_.objects_extraction_polygon .outer ().at (
2550
+ (i + 1 ) % debug_data_.objects_extraction_polygon .outer ().size ());
2551
+ marker.points .push_back (
2552
+ autoware::universe_utils::createPoint (current_point.x (), current_point.y (), ego_z));
2553
+ marker.points .push_back (
2554
+ autoware::universe_utils::createPoint (next_point.x (), next_point.y (), ego_z));
2555
+ }
2556
+
2557
+ debug_marker_.markers .push_back (marker);
2521
2558
}
2522
2559
2523
2560
// Visualize previous module output
0 commit comments