Skip to content

Commit 64799b6

Browse files
fix(bpp): transition from IDLE to WAITING APPROVAL (#6051)
* fix(bpp): explicitly set the initial state Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * remove isWaitingApproval() from state transition Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * Update planning/behavior_path_planner_common/include/behavior_path_planner_common/interface/scene_module_interface.hpp Co-authored-by: Fumiya Watanabe <rej55.g@gmail.com> * explicitly set the initial state Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * remove setInitState in start_planner_module Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> --------- Signed-off-by: Muhammad Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> Co-authored-by: Fumiya Watanabe <rej55.g@gmail.com>
1 parent 6be9a00 commit 64799b6

File tree

9 files changed

+11
-41
lines changed

9 files changed

+11
-41
lines changed

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/scene.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ class AvoidanceModule : public SceneModuleInterface
7878

7979
bool canTransitFailureState() override { return false; }
8080

81-
bool canTransitIdleToRunningState() override { return true; }
82-
8381
/**
8482
* @brief update RTC status for candidate shift line.
8583
* @param candidate path.

planning/behavior_path_dynamic_avoidance_module/include/behavior_path_dynamic_avoidance_module/scene.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ class DynamicAvoidanceModule : public SceneModuleInterface
345345

346346
bool canTransitFailureState() override { return false; }
347347

348-
bool canTransitIdleToRunningState() override { return false; }
348+
ModuleStatus setInitState() const override { return ModuleStatus::IDLE; }
349349

350350
bool isLabelTargetObstacle(const uint8_t label) const;
351351
void updateTargetObjects();

planning/behavior_path_goal_planner_module/include/behavior_path_goal_planner_module/goal_planner_module.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ class GoalPlannerModule : public SceneModuleInterface
356356
// If terminating it, it may switch to lane following and could generate an inappropriate path.
357357
bool canTransitSuccessState() override { return false; }
358358
bool canTransitFailureState() override { return false; }
359-
bool canTransitIdleToRunningState() override { return true; }
360359

361360
mutable StartGoalPlannerData goal_planner_data_;
362361

planning/behavior_path_goal_planner_module/src/goal_planner_module.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,9 @@ void GoalPlannerModule::updateSafetyCheckTargetObjectsData(
18631863

18641864
std::pair<bool, bool> GoalPlannerModule::isSafePath() const
18651865
{
1866+
if (!thread_safe_data_.get_pull_over_path()) {
1867+
return {false, false};
1868+
}
18661869
const auto pull_over_path = thread_safe_data_.get_pull_over_path()->getCurrentPath();
18671870
const auto & current_pose = planner_data_->self_odometry->pose.pose;
18681871
const double current_velocity = std::hypot(

planning/behavior_path_lane_change_module/include/behavior_path_lane_change_module/interface.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class LaneChangeInterface : public SceneModuleInterface
126126

127127
bool canTransitFailureState() override;
128128

129-
bool canTransitIdleToRunningState() override;
129+
ModuleStatus setInitState() const override { return ModuleStatus::WAITING_APPROVAL; };
130130

131131
void updateDebugMarker() const;
132132

planning/behavior_path_lane_change_module/src/interface.cpp

-23
Original file line numberDiff line numberDiff line change
@@ -297,29 +297,6 @@ bool LaneChangeInterface::canTransitFailureState()
297297
return false;
298298
}
299299

300-
bool LaneChangeInterface::canTransitIdleToRunningState()
301-
{
302-
updateDebugMarker();
303-
304-
auto log_debug_throttled = [&](std::string_view message) -> void {
305-
RCLCPP_DEBUG(getLogger(), "%s", message.data());
306-
};
307-
308-
log_debug_throttled(__func__);
309-
310-
if (!isActivated() || isWaitingApproval()) {
311-
if (module_type_->specialRequiredCheck()) {
312-
return true;
313-
}
314-
log_debug_throttled("Module is idling.");
315-
return false;
316-
}
317-
318-
log_debug_throttled("Can lane change safely. Executing lane change.");
319-
module_type_->toNormalState();
320-
return true;
321-
}
322-
323300
void LaneChangeInterface::updateDebugMarker() const
324301
{
325302
if (!parameters_->publish_debug_marker) {

planning/behavior_path_planner_common/include/behavior_path_planner_common/interface/scene_module_interface.hpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,10 @@ class SceneModuleInterface
373373
RCLCPP_DEBUG(getLogger(), "%s", message.data());
374374
};
375375
if (current_state_ == ModuleStatus::IDLE) {
376-
if (canTransitIdleToRunningState()) {
377-
log_debug_throttled("transiting from IDLE to RUNNING");
378-
return ModuleStatus::RUNNING;
379-
}
380-
381-
log_debug_throttled("transiting from IDLE to IDLE");
382-
return ModuleStatus::IDLE;
376+
auto init_state = setInitState();
377+
RCLCPP_DEBUG(
378+
getLogger(), "transiting from IDLE to %s", magic_enum::enum_name(init_state).data());
379+
return init_state;
383380
}
384381

385382
if (current_state_ == ModuleStatus::RUNNING) {
@@ -460,9 +457,9 @@ class SceneModuleInterface
460457
virtual bool canTransitFailureState() = 0;
461458

462459
/**
463-
* @brief State transition condition IDLE -> RUNNING
460+
* @brief Explicitly set the initial state
464461
*/
465-
virtual bool canTransitIdleToRunningState() = 0;
462+
virtual ModuleStatus setInitState() const { return ModuleStatus::RUNNING; }
466463

467464
/**
468465
* @brief Get candidate path. This information is used for external judgement.

planning/behavior_path_side_shift_module/include/behavior_path_side_shift_module/scene.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ class SideShiftModule : public SceneModuleInterface
7575

7676
bool canTransitFailureState() override { return false; }
7777

78-
bool canTransitIdleToRunningState() override { return true; }
79-
8078
void initVariables();
8179

8280
// non-const methods

planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/start_planner_module.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ class StartPlannerModule : public SceneModuleInterface
139139

140140
bool canTransitFailureState() override { return false; }
141141

142-
bool canTransitIdleToRunningState() override { return true; }
143-
144142
/**
145143
* @brief init member variables.
146144
*/

0 commit comments

Comments
 (0)