From 3df32d512b6ce78cd0b4e78b7e8a6c58f1252917 Mon Sep 17 00:00:00 2001 From: Muhammad Zulfaqar Azmi Date: Thu, 30 Nov 2023 17:23:26 +0900 Subject: [PATCH] update states Signed-off-by: Muhammad Zulfaqar Azmi --- .../behavior_path_planner_interface_design.md | 182 ++++++++++++++++++ 1 file changed, 182 insertions(+) diff --git a/planning/behavior_path_planner/docs/behavior_path_planner_interface_design.md b/planning/behavior_path_planner/docs/behavior_path_planner_interface_design.md index d401cbde5a16c..fbfbaa6c72afa 100644 --- a/planning/behavior_path_planner/docs/behavior_path_planner_interface_design.md +++ b/planning/behavior_path_planner/docs/behavior_path_planner_interface_design.md @@ -76,6 +76,188 @@ stop @enduml ``` +### Running Approved Modules + +```plantuml +@startuml +title PlannerManager::runApprovedModules Method Execution Flow + +skinparam defaultTextAlignment center +skinparam noteTextAlignment left +skinparam backgroundColor #FFFFFF +skinparam ArrowColor #333333 +skinparam ArrowFontColor #333333 + +start + +:Initialize results and output; +:output = getReferencePath(data); +:results.emplace("root", output); + +if (approved_module_ptrs_ is empty) then (yes) + :Return output; + stop +else (no) +endif + +partition #LightBlue "Module Reordering" { + :Move certain modules to end based on conditions; +} + +partition #LightGreen "Lock & Unlock Approved Modules" { + :Lock output paths of approved modules; + :Unlock last module if conditions met; +} + +partition #Orange "Execute Approved Modules" { + repeat :For each module_ptr in approved_module_ptrs_; + :Run module and store result; + repeat while (More module_ptr left) is (yes) +} + +partition #LightYellow "Handle Waiting Approval Modules" { + :Check and handle waiting approval modules; + :Update observers; + if (Modules found waiting for approval) then (yes) + :Clear and handle candidate modules; + :Update and erase modules from approved list; + :Update observers; + endif +} + +partition #LightGray "Remove Failure Modules" { + :Remove modules with FAILURE status; + :Update observers; + if (Modules removed) then (yes) + :Clear candidate modules; + endif +} + +if (approved_module_ptrs_ is empty after removal) then (yes) + :Return root result; + stop +else (no) +endif + +partition #Coral "Finalize Output" { + :Determine final output based on last module's result; + :Handle success modules and update root lanelet if necessary; + :Update observers; +} + +:Return approved_modules_output; + +stop +@enduml +``` + +### Getting Requested Modules + +```plantuml +@startuml +title PlannerManager::getRequestModules Method Execution Flow + +skinparam defaultTextAlignment center +skinparam noteTextAlignment left +skinparam backgroundColor #FFFFFF +skinparam ArrowColor #333333 +skinparam ArrowFontColor #333333 +skinparam partitionBackgroundColor #CCFF33 + +start +if (previous_module_output.path is null) then (yes) + :Log error: "Current module output is null..."; + stop +else (no) +endif + +:Initialize request_modules as empty vector; + +partition "Process Managers" { + repeat :For each manager_ptr in manager_ptrs_; + :stop_watch_.tic(manager_ptr->name()); + :Determine conditions for module execution; + if (skip_module) then (yes) + :toc(manager_ptr->name()); + else (no) + :Check and possibly add new module; + endif + :toc(manager_ptr->name()); + repeat while (Any manager_ptr left) +} + +:Return request_modules; + +stop +@enduml +``` + +### Running Requested Modules + +```plantuml +@startuml +title PlannerManager::runRequestModules Method Execution Flow + +skinparam defaultTextAlignment center +skinparam noteTextAlignment left +skinparam backgroundColor #FFFFFF +skinparam ArrowColor #333333 +skinparam ArrowFontColor #333333 + +start + +:Initialize vectors for modules and results; +:Sort request_modules by priority; + +partition #LightBlue "Remove Non-executable Modules" { + repeat :For each module_ptr in sorted_request_modules; + :Determine conditions for module execution; + if (Module is executable) then (yes) + :Add to executable_modules; + endif + repeat while (Any module_ptr left) is (yes) not (no) +} + +partition #LightGreen "Run Executable Modules" { + repeat :For each module_ptr in executable_modules; + :Run module and store result; + repeat while (Any module_ptr left) is (yes) not (no) +} + +partition #Orange "Remove Expired Modules" { + :Remove modules with FAILURE or SUCCESS status; + :Update observers of managers; +} + +if (executable_modules is empty) then (yes) + :clearCandidateModules(); + stop +else (no) +endif + +partition #LightYellow "Separate by Approval Condition" { + repeat :For each module in executable_modules; + if (Module is waiting approval) then (yes) + :Add to waiting_approved_modules; + else (no) + :Add to already_approved_modules; + endif + repeat while (Any module left) is (yes) not (no) +} + +partition #LightGray "Select Highest Priority Module" { + :Choose highest priority from approved or waiting modules; +} + +:Update candidate modules; +:Return highest priority module and its result; + +stop +@enduml +``` + +### Update Module State + ```plantuml @startuml skinparam defaultTextAlignment center