Skip to content

Commit 4c4c0cd

Browse files
k-hazama-esolkyoichi-sugaharasoblin
authored
feat(behavior_path _planner): divide planner manager modules into dependent slots (autowarefoundation#8117, autowarefoundation#7881, autowarefoundation#7764) (#1926)
* feat(autoware_behavior_path_planner): remove max_module_size param (autowarefoundation#7764) * feat(behavior_path_planner): remove max_module_size param The max_module_size param has been removed from the behavior_path_planner scene_module_manager.param.yaml file. This param was unnecessary and has been removed to simplify the configuration. Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> --------- Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> * feat(autoware_behavior_path_planner): prevent infinite loop in approving scene module process (autowarefoundation#7881) * prevent infinite loop Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> * calculate max_iteration_num from number of scene modules Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> * add doxygen explanation for calculateMaxIterationNum Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> --------- Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> * feat(behavior_path _planner): divide planner manager modules into dependent slots (autowarefoundation#8117) Signed-off-by: k-hazama-esol <k-hazama@esol.co.jp> --------- Signed-off-by: kyoichi-sugahara <kyoichi.sugahara@tier4.jp> Signed-off-by: k-hazama-esol <k-hazama@esol.co.jp> Co-authored-by: Kyoichi Sugahara <kyoichi.sugahara@tier4.jp> Co-authored-by: Mamoru Sobue <hilo.soblin@gmail.com>
1 parent b104743 commit 4c4c0cd

34 files changed

+2110
-1725
lines changed

Diff for: planning/behavior_path_planner/autoware_behavior_path_dynamic_obstacle_avoidance_module/include/autoware/behavior_path_dynamic_obstacle_avoidance_module/manager.hpp

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class DynamicObstacleAvoidanceModuleManager : public SceneModuleManagerInterface
4747

4848
void updateModuleParams(const std::vector<rclcpp::Parameter> & parameters) override;
4949

50-
bool isAlwaysExecutableModule() const override;
51-
5250
private:
5351
std::shared_ptr<DynamicAvoidanceParameters> parameters_;
5452
};

Diff for: planning/behavior_path_planner/autoware_behavior_path_dynamic_obstacle_avoidance_module/src/manager.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@ void DynamicObstacleAvoidanceModuleManager::updateModuleParams(
287287
});
288288
}
289289

290-
bool DynamicObstacleAvoidanceModuleManager::isAlwaysExecutableModule() const
291-
{
292-
return true;
293-
}
294290
} // namespace autoware::behavior_path_planner
295291

296292
#include <pluginlib/class_list_macros.hpp>

Diff for: planning/behavior_path_planner/autoware_behavior_path_planner/config/behavior_path_planner.param.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**:
22
ros__parameters:
3-
max_iteration_num: 100
43
traffic_light_signal_timeout: 1.0
54
planning_hz: 10.0
65
backward_path_length: 5.0

Diff for: planning/behavior_path_planner/autoware_behavior_path_planner/config/scene_module_manager.param.yaml

+22-33
Original file line numberDiff line numberDiff line change
@@ -3,91 +3,80 @@
33
# NOTE: The smaller the priority number is, the higher the module priority is.
44
/**:
55
ros__parameters:
6+
# NOTE: modules which are not set true in the preset is ignored in the slot configuration
7+
slots:
8+
# NOTE: array of array is not supported
9+
- slot1
10+
- slot2
11+
- slot3
12+
- slot4
13+
slot1:
14+
- "start_planner"
15+
slot2:
16+
- "side_shift"
17+
- "avoidance_by_lane_change"
18+
- "static_obstacle_avoidance"
19+
- "lane_change_left"
20+
- "lane_change_right"
21+
- "external_request_lane_change_left"
22+
- "external_request_lane_change_right"
23+
slot3:
24+
- "goal_planner"
25+
slot4:
26+
- "dynamic_obstacle_avoidance"
27+
628
external_request_lane_change_left:
729
enable_rtc: false
830
enable_simultaneous_execution_as_approved_module: false
931
enable_simultaneous_execution_as_candidate_module: true
10-
keep_last: false
11-
priority: 6
12-
max_module_size: 1
1332

1433
external_request_lane_change_right:
1534
enable_rtc: false
1635
enable_simultaneous_execution_as_approved_module: false
1736
enable_simultaneous_execution_as_candidate_module: true
18-
keep_last: false
19-
priority: 6
20-
max_module_size: 1
2137

2238
lane_change_left:
2339
enable_rtc: false
2440
enable_simultaneous_execution_as_approved_module: true
2541
enable_simultaneous_execution_as_candidate_module: true
26-
keep_last: false
27-
priority: 5
28-
max_module_size: 1
2942

3043
lane_change_right:
3144
enable_rtc: false
3245
enable_simultaneous_execution_as_approved_module: true
3346
enable_simultaneous_execution_as_candidate_module: true
34-
keep_last: false
35-
priority: 5
36-
max_module_size: 1
3747

3848
start_planner:
3949
enable_rtc: false
4050
enable_simultaneous_execution_as_approved_module: false
4151
enable_simultaneous_execution_as_candidate_module: false
42-
keep_last: false
43-
priority: 0
44-
max_module_size: 1
4552

4653
side_shift:
4754
enable_rtc: false
4855
enable_simultaneous_execution_as_approved_module: false
4956
enable_simultaneous_execution_as_candidate_module: false
50-
keep_last: false
51-
priority: 2
52-
max_module_size: 1
5357

5458
goal_planner:
5559
enable_rtc: false
5660
enable_simultaneous_execution_as_approved_module: false
5761
enable_simultaneous_execution_as_candidate_module: false
58-
keep_last: true
59-
priority: 1
60-
max_module_size: 1
6162

6263
static_obstacle_avoidance:
6364
enable_rtc: false
6465
enable_simultaneous_execution_as_approved_module: true
6566
enable_simultaneous_execution_as_candidate_module: false
66-
keep_last: false
67-
priority: 4
68-
max_module_size: 1
6967

7068
avoidance_by_lane_change:
7169
enable_rtc: false
7270
enable_simultaneous_execution_as_approved_module: false
7371
enable_simultaneous_execution_as_candidate_module: false
74-
keep_last: false
75-
priority: 3
76-
max_module_size: 1
7772

7873
dynamic_obstacle_avoidance:
7974
enable_rtc: false
8075
enable_simultaneous_execution_as_approved_module: true
8176
enable_simultaneous_execution_as_candidate_module: true
82-
keep_last: false
83-
priority: 7
84-
max_module_size: 1
8577

8678
sampling_planner:
8779
enable_module: true
8880
enable_rtc: false
8981
enable_simultaneous_execution_as_approved_module: false
9082
enable_simultaneous_execution_as_candidate_module: false
91-
keep_last: true
92-
priority: 16
93-
max_module_size: 1

Diff for: planning/behavior_path_planner/autoware_behavior_path_planner/docs/behavior_path_planner_manager_design.md

+75-29
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,31 @@ Additionally, the manager generates root reference path, and if any other module
4646

4747
![manager_overview](../image/manager/manager_overview.svg)
4848

49+
### Slot
50+
51+
The manager owns several containers of sub-managers, namely _slots_, that holds/runs several sub-managers and send the output to the next slot. Given the initial reference path, each slot processes the input path and the ouptut path is processed by the next slot. The final slot output is utilized as the output of the manager. The slot passes following information
52+
53+
```cpp
54+
struct SlotOutput
55+
{
56+
BehaviorModuleOutput valid_output;
57+
58+
// if candidate module is running, valid_output contains the planning by candidate module. In
59+
// that case, downstream slots will just run aproved modules and do not try to launch new
60+
// modules
61+
bool is_upstream_candidate_exclusive{false};
62+
63+
// if this slot failed, downstream slots need to refresh approved/candidate modules and just
64+
// forward valid_output of this slot output
65+
bool is_upstream_failed_approved{false};
66+
67+
// if the approved module in this slot returned to isWaitingApproval, downstream slots need to
68+
// refresh candidate once
69+
bool is_upstream_waiting_approved{false};
70+
};
71+
72+
```
73+
4974
### Sub-managers
5075

5176
The sub-manager's main task is
@@ -88,7 +113,6 @@ struct ModuleConfigParameters
88113
bool enable_simultaneous_execution_as_approved_module{false};
89114
bool enable_simultaneous_execution_as_candidate_module{false};
90115
uint8_t priority{0};
91-
uint8_t max_module_size{0};
92116
};
93117
```
94118

@@ -101,7 +125,6 @@ Code is [here](https://github.com/autowarefoundation/autoware.universe/blob/b173
101125
| `enable_simultaneous_execution_as_candidate_module` | bool | if true, the manager allows its scene modules to run with other scene modules as **candidate module**. |
102126
| `enable_simultaneous_execution_as_approved_module` | bool | if true, the manager allows its scene modules to run with other scene modules as **approved module**. |
103127
| `priority` | uint8_t | the manager decides execution priority based on this parameter. The smaller the number is, the higher the priority is. |
104-
| `max_module_size` | uint8_t | the sub-manager can run some modules simultaneously. this parameter set the maximum number of the launched modules. |
105128

106129
### Scene modules
107130

@@ -138,13 +161,13 @@ There are 6 steps in one process:
138161

139162
At first, the manager set latest planner data, and run all approved modules and get output path. At this time, the manager checks module status and removes expired modules from approved modules stack.
140163

141-
![process_step1](../image/manager/process_step1.svg)
164+
![process_step1](../image/manager/process_step1.drawio.svg)
142165

143166
### Step2
144167

145168
Input approved modules output and necessary data to all registered modules, and the modules judge the necessity of path modification based on it. The manager checks which module makes execution request.
146169

147-
![process_step2](../image/manager/process_step2.svg)
170+
![process_step2](../image/manager/process_step2.drawio.svg)
148171

149172
### Step3
150173

@@ -154,19 +177,19 @@ Check request module existence.
154177

155178
The manager decides which module to execute as candidate modules from the modules that requested to execute path modification.
156179

157-
![process_step4](../image/manager/process_step4.svg)
180+
![process_step4](../image/manager/process_step4.drawio.svg)
158181

159182
### Step5
160183

161184
Decides the priority order of execution among candidate modules. And, run all candidate modules. Each modules outputs reference path and RTC cooperate status.
162185

163-
![process_step5](../image/manager/process_step5.svg)
186+
![process_step5](../image/manager/process_step5.drawio.svg)
164187

165188
### Step6
166189

167190
Move approved module to approved modules stack from candidate modules stack.
168191

169-
![process_step6](../image/manager/process_step6.svg)
192+
![process_step6](../image/manager/process_step6.drawio.svg)
170193

171194
---
172195

@@ -379,20 +402,20 @@ If a module that doesn't support simultaneous execution exists in approved modul
379402

380403
For example, if approved module's setting of `enable_simultaneous_execution_as_approved_module` is **ENABLE**, then only modules whose the setting is **ENABLE** proceed to the next step.
381404

382-
![request_step2](../image/manager/request_step2.svg)
405+
![request_step2](../image/manager/request_step2.drawio.svg)
383406

384407
Other examples:
385408

386-
| Process | Description |
387-
| :------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
388-
| ![request_step2-2](../image/manager/request_step2-2.svg) | If approved modules stack is empty, then all request modules proceed to the next step, regardless of the setting of `enable_simultaneous_execution_as_approved_module`. |
389-
| ![request_step2-3](../image/manager/request_step2-3.svg) | If approved module's setting of `enable_simultaneous_execution_as_approved_module` is **DISABLE**, then all request modules are discarded. |
409+
| Process | Description |
410+
| :-------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
411+
| ![request_step2-2](../image/manager/request_step2-2.drawio.svg) | If approved modules stack is empty, then all request modules proceed to the next step, regardless of the setting of `enable_simultaneous_execution_as_approved_module`. |
412+
| ![request_step2-3](../image/manager/request_step2-3.drawio.svg) | If approved module's setting of `enable_simultaneous_execution_as_approved_module` is **DISABLE**, then all request modules are discarded. |
390413

391414
### Step3
392415

393416
Sort `request_modules` by priority.
394417

395-
![request_step3](../image/manager/request_step3.svg)
418+
![request_step3](../image/manager/request_step3.drawio.svg)
396419

397420
### Step4
398421

@@ -446,26 +469,26 @@ Executable or not:
446469

447470
For example, if the highest priority module's setting of `enable_simultaneous_execution_as_candidate_module` is **DISABLE**, then all modules after the second priority are discarded.
448471

449-
![request_step4](../image/manager/request_step4.svg)
472+
![request_step4](../image/manager/request_step4.drawio.svg)
450473

451474
Other examples:
452475

453-
| Process | Description |
454-
| :------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
455-
| ![request_step4-2](../image/manager/request_step4-2.svg) | If a module with a higher priority exists, lower priority modules whose setting of `enable_simultaneous_execution_as_candidate_module` is **DISABLE** are discarded. |
456-
| ![request_step4-3](../image/manager/request_step4-3.svg) | If all modules' setting of `enable_simultaneous_execution_as_candidate_module` is **ENABLE**, then all modules proceed to the next step. |
476+
| Process | Description |
477+
| :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
478+
| ![request_step4-2](../image/manager/request_step4-2.drawio.svg) | If a module with a higher priority exists, lower priority modules whose setting of `enable_simultaneous_execution_as_candidate_module` is **DISABLE** are discarded. |
479+
| ![request_step4-3](../image/manager/request_step4-3.drawio.svg) | If all modules' setting of `enable_simultaneous_execution_as_candidate_module` is **ENABLE**, then all modules proceed to the next step. |
457480

458481
### Step5
459482

460483
Run all candidate modules.
461484

462-
![request_step5](../image/manager/request_step5.svg)
485+
![request_step5](../image/manager/request_step5.drawio.svg)
463486

464487
## How to decide which module's output to use?
465488

466489
Sometimes, multiple candidate modules are running simultaneously.
467490

468-
![multiple_candidates](../image/manager/multiple_candidates.svg)
491+
![multiple_candidates](../image/manager/multiple_candidates.drawio.svg)
469492

470493
In this case, the manager selects a candidate modules which output path is used as `behavior_path_planner` output by approval condition in the following rules.
471494

@@ -484,11 +507,11 @@ In this case, the manager selects a candidate modules which output path is used
484507
The smaller the number is, the higher the priority is.
485508

486509
<figure markdown>
487-
![module_select](../image/manager/module_select.svg){width=1000}
510+
![module_select](../image/manager/module_select.drawio.svg){width=1000}
488511
<figcaption>module priority</figcaption>
489512
</figure>
490513

491-
![output_module](../image/manager/output_module.svg)
514+
![output_module](../image/manager/output_module.drawio.svg)
492515

493516
Additionally, the manager moves the highest priority module to approved modules stack if it is already approved.
494517

@@ -504,32 +527,55 @@ This is because module C is planning output path with the output of module B as
504527

505528
As a result, the module A's output is used as approved modules stack.
506529

507-
![waiting_approve](../image/manager/waiting_approve.svg)
530+
![waiting_approve](../image/manager/waiting_approve.drawio.svg)
531+
532+
If this case happened in the slot, `is_upstream_waiting_approved` is set to true.
508533

509534
### Failure modules
510535

511536
The failure modules return the status `ModuleStatus::FAILURE`. The manager removes the module from approved modules stack as well as waiting approval modules, but the failure module is not moved to candidate modules stack.
512537

513538
As a result, the module A's output is used as approved modules stack.
514539

515-
![failure_modules](../image/manager/failure_modules.svg)
540+
![failure_modules](../image/manager/failure_modules.drawio.svg)
541+
542+
If this case happened in the slot, `is_upstream_failed_approved` is set to true.
516543

517544
### Succeeded modules
518545

519546
The succeeded modules return the status `ModuleStatus::SUCCESS`. The manager removes those modules based on **Last In First Out** policy. In other words, if a module added later to approved modules stack is still running (is in `ModuleStatus::RUNNING`), the manager doesn't remove the succeeded module. The reason for this is the same as in removal for waiting approval modules, and is to prevent sudden changes of the running module's output.
520547

521-
![success_modules_remove](../image/manager/success_modules_remove.svg)
548+
![success_modules_remove](../image/manager/success_modules_remove.drawio.svg)
522549

523-
![success_modules_skip](../image/manager/success_modules_skip.svg)
550+
![success_modules_skip](../image/manager/success_modules_skip.drawio.svg)
524551

525552
As an exception, if **Lane Change** module returns status `ModuleStatus::SUCCESS`, the manager doesn't remove any modules until all modules is in status `ModuleStatus::SUCCESS`. This is because when the manager removes the **Lane Change** (normal LC, external LC, avoidance by LC) module as succeeded module, the manager updates the information of the lane Ego is currently driving in, so root reference path (= module A's input path) changes significantly at that moment.
526553

527-
![lane_change_remove](../image/manager/lane_change_remove.svg)
554+
![lane_change_remove](../image/manager/lane_change_remove.drawio.svg)
528555

529-
![lane_change_skip](../image/manager/lane_change_skip.svg)
556+
![lane_change_skip](../image/manager/lane_change_skip.drawio.svg)
530557

531558
When the manager removes succeeded modules, the last added module's output is used as approved modules stack.
532559

560+
## Slot output propagation
561+
562+
As the initial solution, following _SlotOutput_ is passed to the first slot.
563+
564+
```cpp
565+
SlotOutput result_output = SlotOutput{
566+
getReferencePath(data),
567+
false,
568+
false,
569+
false,
570+
};
571+
```
572+
573+
If a slot turned out to be `is_upstream_failed_approved`, then all the subsequent slots are refreshed and have all of their approved_modules and candidate_modules cleared. The valid_output is just transferred to the end without any modification.
574+
575+
If a slot turned out to be `is_upstream_waiting_approved`, then all the subsequent slots clear their candidate_modules once and apply their approved_modules to obtain the slot output.
576+
577+
If a slot turned out to be `is_upstream_candidate_exclusive`, it means that a not `simultaneously_executable_as_candidate` module is running in that slot. Then all the subsequent modules just apply their approved_modules without trying to launch new candidate_modules.
578+
533579
## Reference path generation
534580
535581
The reference path is generated from the centerline of the **lanelet sequence** obtained from the **current route lanelet**, and it is not only used as an input to the first added module of approved modules stack, but also used as the output of `behavior_path_planner` if none of the modules are running.
@@ -547,7 +593,7 @@ The **current route lanelet** can be reset to the closest lanelet within the rou
547593
548594
![current_route_lanelet](../image/manager/current_route_lanelet.svg)
549595
550-
The manager needs to know the ego behavior and then generate a root reference path from the lanes that Ego should follow.
596+
The manager needs to know the ego behavior and then generate a root reference path from the lanes tghat Ego should follow.
551597
552598
For example, during autonomous driving, even if Ego moves into the next lane in order to avoid a parked vehicle, the target lanes that Ego should follow will **NOT** change because Ego will return to the original lane after the avoidance maneuver. Therefore, the manager does **NOT** reset the **current route lanelet**, even if the avoidance maneuver is finished.
553599

0 commit comments

Comments
 (0)