|
1 | 1 | # ACC (Adaptive Cruise Control)
|
2 | 2 |
|
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. |
4 | 5 |
|
5 | 6 | - [ROS Data Interface](#ros-data-interface)
|
6 | 7 | - [Published Topics](#published-topics)
|
7 | 8 | - [Subscribed Topics](#subscribed-topics)
|
8 |
| -- [Node Creation + Running Tests](#node-creation--running-tests) |
| 9 | + - [Services](#services) |
| 10 | +- [Debugging](#debugging) |
9 | 11 | - [Functionality](#functionality)
|
10 | 12 |
|
11 | 13 | ## ROS Data Interface
|
|
15 | 17 | This module publishes the following topics:
|
16 | 18 |
|
17 | 19 | - `/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. |
21 | 22 |
|
22 | 23 | ### Subscribed Topics
|
23 | 24 |
|
24 | 25 | This module subscribes to the following topics:
|
25 | 26 |
|
26 | 27 | - `/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 |
34 | 34 |
|
35 |
| -## Node Creation + Running Tests |
| 35 | +This module provides the following service: |
36 | 36 |
|
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. |
38 | 38 |
|
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). |
45 | 44 |
|
46 | 45 | ## Functionality
|
47 | 46 |
|
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 | +  |
| 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 | +  |
| 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. |
49 | 81 |
|
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. |
0 commit comments