Skip to content

Commit 3705418

Browse files
authored
Merge pull request #781 from una-auxme/744-general-update-acc-documentation
744-general-update-acc-documentation
2 parents ee5b55a + 52b1bc4 commit 3705418

8 files changed

+237
-168
lines changed
Loading
Loading
-1.41 MB
Binary file not shown.
24.2 KB
Loading

doc/assets/planning/behaviour_tree.drawio.xml

+171-133
Large diffs are not rendered by default.

doc/planning/ACC.md

+54-26
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# ACC (Adaptive Cruise Control)
22

3-
**Summary:** The ACC module is a ROS node responsible for adaptive speed control in an autonomous vehicle. It receives information about possible collisions, the current speed, the trajectory, and the speed limits. Based on this information, it calculates the desired speed and publishes it.
3+
**Summary:** The ACC module is a ROS node responsible for adaptive speed control in an autonomous vehicle. It receives information about the leading vehicle (if there is one), the current speed, the trajectory, and the speed limits.
4+
Based on this information, it calculates the desired speed and publishes it.
45

56
- [ROS Data Interface](#ros-data-interface)
67
- [Published Topics](#published-topics)
78
- [Subscribed Topics](#subscribed-topics)
8-
- [Node Creation + Running Tests](#node-creation--running-tests)
9+
- [Services](#services)
10+
- [Debugging](#debugging)
911
- [Functionality](#functionality)
1012

1113
## ROS Data Interface
@@ -15,40 +17,66 @@
1517
This module publishes the following topics:
1618

1719
- `/paf/hero/acc_velocity`: The desired speed for the vehicle.
18-
- `/paf/hero/current_wp`: The current waypoint.
19-
- `/paf/hero/speed_limit`: The current speed limit.
20-
- `/paf/hero/acc/debug_markers`: Markers that show debugging data e.g. which vehicle is recognized as leading vehicle.
20+
- `/paf/hero/emergency`: A flag indicating whether an emergency brake is required.
21+
- `/paf/hero/acc/debug_markers`: Markers that show debugging data, e.g., collision masks, leading vehicle, and trajectory intersections.
2122

2223
### Subscribed Topics
2324

2425
This module subscribes to the following topics:
2526

2627
- `/paf/hero/mapping/init_data`: The map published by the intermediate layer.
27-
- `/paf/hero/unstuck_flag`: A flag indicating whether the vehicle is stuck.
28-
- `/paf/hero/unstuck_distance`: The distance the vehicle needs to travel to get unstuck.
29-
- `/paf/hero/speed_limits_OpenDrive`: The speed limits from OpenDrive.
30-
- `/paf/hero/trajectory_global`: The global trajectory of the vehicle (without overtakes etc).
31-
- `/paf/hero/trajectory`: The trajectory of the vehicle including overtakes etc.
32-
- `/paf/hero/current_pos`: The current position of the vehicle.
33-
- `/paf/hero/current_heading`: The current heading of the vehicle.
28+
- `/paf/hero/speed_limit`: The current speed limit.
29+
- `/paf/hero/trajectory_local`: The local trajectory of the vehicle.
30+
- `/paf/hero/curr_behavior`: The current behavior of the vehicle.
31+
- `/paf/hero/pure_pursuit_steer`: The current steering angle of the vehicle.
32+
33+
### Services
3434

35-
## Node Creation + Running Tests
35+
This module provides the following service:
3636

37-
To run this node insert the following statement in the [planning.launch](../../code/planning/launch/planning.launch) file:
37+
- `/paf/hero/acc/speed_alteration`: A service to override the speed or set an external speed limit.
3838

39-
```xml
40-
<node pkg="planning" type="ACC.py" name="ACC" output="screen">
41-
<param name="role_name" value="hero" />
42-
<param name="control_loop_rate" value="0.3" />
43-
</node>
44-
```
39+
This service is currently used by the unstuck routine to drive backwards or stop. Apart from that, the intersection behavior uses it to be able to drive slowlier when going straight forward through an intersection (hotfix to avoid crashing into a firetruck).
40+
41+
## Debugging
42+
43+
During development, the debugger can be a helpful tool. In order to be able to use the debugger, the planning.launch file has to be adapted. For more details, check the [debugging guide](../development/debugging.md).
4544

4645
## Functionality
4746

48-
Each time the map from the intermediate layer is received, the ACC triggers the function `update_velocity` where the main logic of the ACC can be found. The most important steps are:
47+
Each time the map from the intermediate layer is received, the ACC triggers the function `update_velocity` where the main logic of the ACC can be found.
48+
49+
The following key functions are performed by the ACC node:
50+
51+
1. **Initialization**:
52+
- Subscribes to various topics to receive data about the map, speed limits, trajectory, current behavior, and steering angle.
53+
- Publishes the desired speed, emergency brake flag, and debugging markers.
54+
- Provides a service to handle speed alterations.
55+
56+
2. **Update Velocity**:
57+
- Checks if the necessary data (map and trajectory) is available.
58+
- Defines a trajectory mask and a rectangle in front of the car that is used to set the area in which a leading vehicle is searched. The rectangle is able to detect possible collisions that are close to the car while the trajectory mask checks the area at a higher distance from the car.
59+
- Publishes markers to visualize the masks, the chosen leading vehicle, and trajectory intersections.
60+
![Leading vehicle markers visualization](../assets/planning/ACC_trajectory_mask_visualization.PNG)
61+
- Identifies the leading vehicle based on the trajectory mask and the rectangle.
62+
- Calculates a reasonable speed depending on the leading vehicle using the function `calculate_velocity_based_on_lead`.
63+
- Considers speed limits, external speed limits, and trajectory-based cornering speeds.
64+
- Publishes the desired speed (minimum of the considered speeds), debugging markers, and emergency brake flag if necessary.
65+
66+
3. **Calculate Velocity Based on Lead**:
67+
- Calculation of the desired speed using the function `calculate_velocity_based_on_lead`. This function uses a PI controller to calculate the desired speed based on the distance and speed of the leading vehicle.
68+
69+
4. **Calculate Velocity Based on Trajectory**:
70+
- Approximates a maximum safe cornering speed by tracing lines at an angle from the front of the car and measuring the distance at which they intersect with the trajectory.
71+
![Cornering speed visualization](../assets/planning/ACC_curve_speed_visualization.PNG)
72+
- Uses linear interpolation to calculate the desired speed based on the intersection distance.
73+
74+
5. **Emergency Braking**:
75+
- Emergency braking if a slow obstacle is detected and the speed difference is too high.
76+
- Triggers an emergency brake if a slow obstacle is detected, the speed difference is too high, and the vehicle is moving fast.
77+
- Publishes an emergency flag to notify the [vehicle controller](../../code/control/src/vehicle_controller.py).
78+
79+
6. **Handle Speed Alteration**:
80+
- Handles requests to override the speed or set an external speed limit. This enables other components (such as the unsuck routine or the intersection behavior) to set a maximum speed or a fixed speed if necessary.
4981

50-
- Definition of a trajectory mask and a rectangle in front of the car that is used to set the area in which a leading vehicle is searched. The rectangle is able to detect possible collisions that are close to the car while the trajectory mask checks the area at a higher distance from the car.
51-
- Calculation of the leading vehicle based on the trajectory mask and the rectangle.
52-
- Calculation of the desired speed using the function `calculate_velocity_based_on_lead`.
53-
- Publishing of the markers to visualize the masks and the chosen leading vehicle.
54-
82+
The ACC node ensures that the vehicle maintains a safe speed by considering potential collisions, speed limits, trajectory-based cornering speeds, and emergency braking conditions.

doc/planning/Local_Planning.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ The Local Planning component is responsible for evaluating short term decisions
1212

1313
The Local Planning in this project is divided in two components: Adaptive Cruise Control (ACC) and Motion Planning.
1414

15-
The architecture can be seen below:
16-
17-
![Planning_architecture.png](../assets/planning/Planning_architecture.png)
18-
19-
The theoretical concepts of each Local Planning component are listed below.
15+
The responsibilities of each Local Planning component are listed below.
2016

2117
## Adaptive Cruise Control (ACC)
2218

doc/planning/README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Documentation of Planning
22

3+
- [Architecture Diagram](#architecture-diagram)
4+
- [Overview](#overview)
5+
- [Global Planner (/global\_planner)](#global-planner-global_planner)
6+
- [Preplanning / OpenDrive Converter (preplanning\_trajectory.py)](#preplanning--opendrive-converter-preplanning_trajectorypy)
7+
- [Global Planner (global\_planner\_node.py)](#global-planner-global_planner_nodepy)
8+
- [Global Planner Distance Publisher (global\_plan\_distance\_publisher.py)](#global-planner-distance-publisher-global_plan_distance_publisherpy)
9+
- [Local Planner (/local\_planner)](#local-planner-local_planner)
10+
- [Decision making (/behavior\_agent)](#decision-making-behavior_agent)
11+
312
## Architecture Diagram
413

5-
![Planning Architecture Diagram](../assets/planning/planning_structure.png)
14+
To get an overview over the general architecture, check the [architecture diagram](link).
615

716
## Overview
817

@@ -33,11 +42,9 @@ The decision making uses this information for triggering special events (e.g. la
3342
This module includes the Nodes: \
3443
[ACC (ACC.py)](./ACC.md) and [MotionPlanning (motion_planning.py)](./motion_planning.md)
3544

36-
The Local Planning package is responsible for evaluating short term decisions in the local environment of the ego vehicle. It contains components responsible for detecting collisions and reacting e. g. lowering speed.
45+
The Local Planning package is responsible for planning a local trajectory and adjusting the speed accordingly. It contains components responsible for detecting collisions and reacting e. g. lowering speed.
3746
The local planning also executes behaviors e.g. changes the trajectory for an overtake.
3847

39-
![Overtake](../assets/planning/Overtake_car_trajectory.png)
40-
4148
### [Decision making (/behavior_agent)](./Behavior_tree.md)
4249

4350
This module includes the Nodes: BehaviorTree and its subbehaviors

0 commit comments

Comments
 (0)