@@ -72,6 +72,9 @@ PullOverModule::PullOverModule(
72
72
73
73
left_side_parking_ = parameters_->parking_policy == ParkingPolicy::LEFT_SIDE;
74
74
75
+ // planner when goal modification is not allowed
76
+ fixed_goal_planner_ = std::make_unique<DefaultFixedGoalPlanner>();
77
+
75
78
// set enabled planner
76
79
if (parameters_->enable_shift_parking ) {
77
80
pull_over_planners_.push_back (std::make_shared<ShiftPullOver>(
@@ -289,7 +292,7 @@ void PullOverModule::processOnEntry()
289
292
// todo: remove `checkOriginalGoalIsInShoulder()`
290
293
// the function here is temporary condition for backward compatibility.
291
294
// if the goal is in shoulder, allow goal_modification
292
- enable_goal_search_ =
295
+ allow_goal_modification_ =
293
296
route_handler->isAllowedGoalModification () || checkOriginalGoalIsInShoulder ();
294
297
295
298
// initialize when receiving new route
@@ -301,7 +304,7 @@ void PullOverModule::processOnEntry()
301
304
// calculate goal candidates
302
305
const Pose goal_pose = route_handler->getGoalPose ();
303
306
refined_goal_pose_ = calcRefinedGoal (goal_pose);
304
- if (enable_goal_search_ ) {
307
+ if (allow_goal_modification_ ) {
305
308
goal_searcher_->setPlannerData (planner_data_);
306
309
goal_candidates_ = goal_searcher_->search (refined_goal_pose_);
307
310
} else {
@@ -336,15 +339,24 @@ bool PullOverModule::isExecutionRequested() const
336
339
lanelet::utils::query::getClosestLanelet (current_lanes, current_pose, ¤t_lane);
337
340
const double self_to_goal_arc_length =
338
341
utils::getSignedDistance (current_pose, goal_pose, current_lanes);
339
- if (self_to_goal_arc_length > calcModuleRequestLength ()) {
342
+ const bool allow_goal_modification =
343
+ route_handler->isAllowedGoalModification () || checkOriginalGoalIsInShoulder ();
344
+ const double request_length =
345
+ allow_goal_modification ? calcModuleRequestLength () : parameters_->minimum_request_length ;
346
+ if (self_to_goal_arc_length > request_length) {
340
347
return false ;
341
348
}
342
349
343
- // check if target lane is shoulder lane and goal_pose is in the lane
344
- const bool goal_is_in_shoulder = checkOriginalGoalIsInShoulder ();
345
- // if allow_goal_modification is set false and goal is in road lane, do not execute pull over
346
- if (!route_handler->isAllowedGoalModification () && !goal_is_in_shoulder) {
347
- return false ;
350
+ // if goal modification is not allowed and goal_pose in current_lanes,
351
+ // plan path to the original fixed goal
352
+ if (!allow_goal_modification) {
353
+ if (std::any_of (
354
+ current_lanes.begin (), current_lanes.end (),
355
+ [&](const lanelet::ConstLanelet & current_lane) {
356
+ return lanelet::utils::isInLanelet (goal_pose, current_lane);
357
+ })) {
358
+ return true ;
359
+ }
348
360
}
349
361
350
362
// if (A) or (B) is met execute pull over
@@ -490,6 +502,15 @@ bool PullOverModule::returnToLaneParking()
490
502
}
491
503
492
504
BehaviorModuleOutput PullOverModule::plan ()
505
+ {
506
+ if (allow_goal_modification_) {
507
+ return planWithGoalModification ();
508
+ } else {
509
+ return fixed_goal_planner_->plan (planner_data_);
510
+ }
511
+ }
512
+
513
+ BehaviorModuleOutput PullOverModule::planWithGoalModification ()
493
514
{
494
515
const auto & current_pose = planner_data_->self_odometry ->pose .pose ;
495
516
const double current_vel = planner_data_->self_odometry ->twist .twist .linear .x ;
@@ -686,7 +707,7 @@ BehaviorModuleOutput PullOverModule::plan()
686
707
687
708
// Publish the modified goal only when it is updated
688
709
if (
689
- enable_goal_search_ && status_.is_safe && modified_goal_pose_ &&
710
+ allow_goal_modification_ && status_.is_safe && modified_goal_pose_ &&
690
711
(!prev_goal_id_ || *prev_goal_id_ != modified_goal_pose_->id )) {
691
712
PoseWithUuidStamped modified_goal{};
692
713
modified_goal.uuid = route_handler->getRouteUuid ();
@@ -731,6 +752,15 @@ CandidateOutput PullOverModule::planCandidate() const
731
752
}
732
753
733
754
BehaviorModuleOutput PullOverModule::planWaitingApproval ()
755
+ {
756
+ if (allow_goal_modification_) {
757
+ return planWaitingApprovalWithGoalModification ();
758
+ } else {
759
+ return fixed_goal_planner_->plan (planner_data_);
760
+ }
761
+ }
762
+
763
+ BehaviorModuleOutput PullOverModule::planWaitingApprovalWithGoalModification ()
734
764
{
735
765
updateOccupancyGrid ();
736
766
BehaviorModuleOutput out;
@@ -1215,7 +1245,7 @@ bool PullOverModule::isCrossingPossible(
1215
1245
return true ;
1216
1246
}
1217
1247
1218
- // Travesing is not allowed between road lanes
1248
+ // Traversing is not allowed between road lanes
1219
1249
if (!is_shoulder_lane) {
1220
1250
continue ;
1221
1251
}
@@ -1273,7 +1303,7 @@ void PullOverModule::setDebugData()
1273
1303
tier4_autoware_utils::appendMarkerArray (added, &debug_marker_);
1274
1304
};
1275
1305
1276
- if (enable_goal_search_ ) {
1306
+ if (allow_goal_modification_ ) {
1277
1307
// Visualize pull over areas
1278
1308
const auto color = status_.has_decided_path ? createMarkerColor (1.0 , 1.0 , 0.0 , 0.999 ) // yellow
1279
1309
: createMarkerColor (0.0 , 1.0 , 0.0 , 0.999 ); // green
0 commit comments