Skip to content

Commit 94d2d5c

Browse files
authored
fix(goal_planner): generate goal candidates after execution (#3854)
Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
1 parent 451b504 commit 94d2d5c

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

planning/behavior_path_planner/include/behavior_path_planner/scene_module/goal_planner/goal_planner_module.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class GoalPlannerModule : public SceneModuleInterface
185185

186186
// goal seach
187187
Pose calcRefinedGoal(const Pose & goal_pose) const;
188+
void generateGoalCandidates();
188189

189190
// stop or decelerate
190191
void decelerateForTurnSignal(const Pose & stop_pose, PathWithLaneId & path) const;

planning/behavior_path_planner/src/scene_module/goal_planner/goal_planner_module.cpp

+26-22
Original file line numberDiff line numberDiff line change
@@ -258,32 +258,10 @@ void GoalPlannerModule::initializeOccupancyGridMap()
258258

259259
void GoalPlannerModule::processOnEntry()
260260
{
261-
const auto & route_handler = planner_data_->route_handler;
262-
263261
// Initialize occupancy grid map
264262
if (parameters_->use_occupancy_grid) {
265263
initializeOccupancyGridMap();
266264
}
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);
287265
}
288266

289267
void GoalPlannerModule::processOnExit()
@@ -486,8 +464,34 @@ void GoalPlannerModule::returnToLaneParking()
486464
RCLCPP_INFO(getLogger(), "return to lane parking");
487465
}
488466

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+
489491
BehaviorModuleOutput GoalPlannerModule::plan()
490492
{
493+
generateGoalCandidates();
494+
491495
if (allow_goal_modification_) {
492496
return planWithGoalModification();
493497
} else {

0 commit comments

Comments
 (0)