@@ -258,32 +258,10 @@ void GoalPlannerModule::initializeOccupancyGridMap()
258
258
259
259
void GoalPlannerModule::processOnEntry ()
260
260
{
261
- const auto & route_handler = planner_data_->route_handler ;
262
-
263
261
// Initialize occupancy grid map
264
262
if (parameters_->use_occupancy_grid ) {
265
263
initializeOccupancyGridMap ();
266
264
}
267
-
268
- // initialize when receiving new route
269
- if (!last_received_time_ || *last_received_time_ != route_handler->getRouteHeader ().stamp ) {
270
- // Initialize parallel parking planner status
271
- resetStatus ();
272
-
273
- // calculate goal candidates
274
- const Pose goal_pose = route_handler->getGoalPose ();
275
- refined_goal_pose_ = calcRefinedGoal (goal_pose);
276
- if (allow_goal_modification_) {
277
- goal_searcher_->setPlannerData (planner_data_);
278
- goal_candidates_ = goal_searcher_->search (refined_goal_pose_);
279
- } else {
280
- GoalCandidate goal_candidate{};
281
- goal_candidate.goal_pose = goal_pose;
282
- goal_candidate.distance_from_original_goal = 0.0 ;
283
- goal_candidates_.push_back (goal_candidate);
284
- }
285
- }
286
- last_received_time_ = std::make_unique<rclcpp::Time>(route_handler->getRouteHeader ().stamp );
287
265
}
288
266
289
267
void GoalPlannerModule::processOnExit ()
@@ -486,8 +464,34 @@ void GoalPlannerModule::returnToLaneParking()
486
464
RCLCPP_INFO (getLogger (), " return to lane parking" );
487
465
}
488
466
467
+ void GoalPlannerModule::generateGoalCandidates ()
468
+ {
469
+ // initialize when receiving new route
470
+ const auto & route_handler = planner_data_->route_handler ;
471
+ if (!last_received_time_ || *last_received_time_ != route_handler->getRouteHeader ().stamp ) {
472
+ // Initialize parallel parking planner status
473
+ resetStatus ();
474
+
475
+ // calculate goal candidates
476
+ const Pose goal_pose = route_handler->getGoalPose ();
477
+ refined_goal_pose_ = calcRefinedGoal (goal_pose);
478
+ if (allow_goal_modification_) {
479
+ goal_searcher_->setPlannerData (planner_data_);
480
+ goal_candidates_ = goal_searcher_->search (refined_goal_pose_);
481
+ } else {
482
+ GoalCandidate goal_candidate{};
483
+ goal_candidate.goal_pose = goal_pose;
484
+ goal_candidate.distance_from_original_goal = 0.0 ;
485
+ goal_candidates_.push_back (goal_candidate);
486
+ }
487
+ }
488
+ last_received_time_ = std::make_unique<rclcpp::Time>(route_handler->getRouteHeader ().stamp );
489
+ }
490
+
489
491
BehaviorModuleOutput GoalPlannerModule::plan ()
490
492
{
493
+ generateGoalCandidates ();
494
+
491
495
if (allow_goal_modification_) {
492
496
return planWithGoalModification ();
493
497
} else {
0 commit comments