File tree 4 files changed +14
-14
lines changed
planning/behavior_path_planner
include/behavior_path_planner
4 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ class BehaviorPathPlannerNode : public rclcpp::Node
173
173
/* *
174
174
* @brief publish reroute availability
175
175
*/
176
- void publish_reroute_availability ();
176
+ void publish_reroute_availability () const ;
177
177
178
178
/* *
179
179
* @brief publish steering factor from intersection
Original file line number Diff line number Diff line change @@ -226,6 +226,13 @@ class PlannerManager
226
226
*/
227
227
bool hasApprovedModules () const { return !approved_module_ptrs_.empty (); }
228
228
229
+ bool hasNonAlwaysExecutableApprovedModules () const
230
+ {
231
+ return std::any_of (
232
+ approved_module_ptrs_.begin (), approved_module_ptrs_.end (),
233
+ [this ](const auto & m) { return !getManager (m)->isAlwaysExecutableModule (); });
234
+ }
235
+
229
236
/* *
230
237
* @brief check if there are candidate modules.
231
238
*/
Original file line number Diff line number Diff line change @@ -551,18 +551,14 @@ void BehaviorPathPlannerNode::publish_steering_factor(
551
551
steering_factor_interface_ptr_->publishSteeringFactor (get_clock ()->now ());
552
552
}
553
553
554
- void BehaviorPathPlannerNode::publish_reroute_availability ()
554
+ void BehaviorPathPlannerNode::publish_reroute_availability () const
555
555
{
556
- const bool has_approved_modules = planner_manager_->hasApprovedModules ();
557
- const bool has_candidate_modules = planner_manager_->hasCandidateModules ();
558
-
559
- // In the current behavior path planner, we might get unexpected behavior when rerouting while
560
- // modules other than lane follow are active. Therefore, rerouting will be allowed only when the
561
- // lane follow module is running Note that if there is a approved module or candidate module, it
562
- // means non-lane-following modules are runnning.
556
+ // In the current behavior path planner, we might encounter unexpected behavior when rerouting
557
+ // while modules other than lane following are active. If non-lane-following module except
558
+ // always-executable module is approved and running, rerouting will not be possible.
563
559
RerouteAvailability is_reroute_available;
564
560
is_reroute_available.stamp = this ->now ();
565
- if (has_approved_modules || has_candidate_modules ) {
561
+ if (planner_manager_-> hasNonAlwaysExecutableApprovedModules () ) {
566
562
is_reroute_available.availability = false ;
567
563
} else {
568
564
is_reroute_available.availability = true ;
Original file line number Diff line number Diff line change @@ -263,10 +263,7 @@ std::vector<SceneModulePtr> PlannerManager::getRequestModules(
263
263
// Condition 1: always executable module can be added regardless of the existence of other
264
264
// modules, so skip checking the existence of other modules.
265
265
// in other cases, need to check the existence of other modules and which module can be added.
266
- const bool has_non_always_executable_module = std::any_of (
267
- approved_module_ptrs_.begin (), approved_module_ptrs_.end (),
268
- [this ](const auto & m) { return !getManager (m)->isAlwaysExecutableModule (); });
269
- if (!manager_ptr->isAlwaysExecutableModule () && has_non_always_executable_module) {
266
+ if (!manager_ptr->isAlwaysExecutableModule () && hasNonAlwaysExecutableApprovedModules ()) {
270
267
// pairs of find_block_module and is_executable
271
268
std::vector<std::pair<std::function<bool (const SceneModulePtr &)>, std::function<bool ()>>>
272
269
conditions;
You can’t perform that action at this time.
0 commit comments