Skip to content

Commit

Permalink
Merge branch 'main' into 373-unstuck-behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
bilinskaA authored Nov 3, 2024
2 parents 968ad94 + cae64fd commit 0c800a0
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 0 deletions.
82 changes: 82 additions & 0 deletions doc/research/paf24/general/driving_score.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Driving Score Computation

**Summary:** The Driving score is the main performance metric of the agent and therefore has to be examined.

- [A Starting Point for Metrics and Measurements](#a-starting-point-for-metrics-and-measurements)
- [Driving score](#driving-score)
- [Route completion](#route-completion)
- [Infraction penalty](#infraction-penalty)
- [Infractions](#infractions)
- [Off-road driving](#off-road-driving)
- [Additional Events](#additional-events)
- [Sources](#sources)

## A Starting Point for Metrics and Measurements

The CARLA Leaderboard sets a public example for evaluation and comparison.
The driving proficiency of an agent can be characterized by multiple metrics. For this leaderboard, the CARLA team selected a set of metrics that help understand different aspects of driving.

## Driving score

$\frac{1}{N}\sum^i_N R_i P_i$

- The main metric of the leaderboard, serving as an aggregate of the average route completion and the number of traffic infractions. Here $N$ stands for the number of routes, $R_i$ is the percentage of completion of the $i$-th route, and $P_i$ is the infraction penalty of the $i$-th route.

## Route completion

$\frac{1}{N}\sum^i_N R_i$

- Percentage of route distance completed by an agent, averaged across $N$ routes.

## Infraction penalty

$\prod_j^{ped, veh, ... stop} (p_j^i)^{n_{infractions}}$

- Aggregates the number of infractions triggered by an agent as a geometric series. Agents start with an ideal 1.0 base score, which is reduced by a penalty coefficient for every instance of these.

## Infractions

The CARLA leaderboard offers individual metrics for a series of infractions. Each of these has a penalty coefficient that will be applied every time it happens. Ordered by severity, the infractions are the following.

- Collisions with pedestrians $0.50$
- Collisions with other vehicles $0.60$
- Collisions with static elements $0.65$
- Running a red light $0.70$
- Running a stop sign $0.80$

Some scenarios feature behaviors that can block the ego-vehicle indefinitely. These scenarios will have a timeout of 4 minutes after which the ego-vehicle will be released to continue the route. However, a penalty is applied when the time limit is breached

- Scenario Timeout $0.70$

The agent is expected to maintain a minimum speed in keeping with nearby traffic. The agent’s speed will be compared with the speed of nearby vehicles. Failure to maintain a suitable speed will result in a penalty.
The penalty applied is dependent on the magnitude of the speed difference, up to the following value:

- Failure to maintain speed $0.70$

The agent should yield to emergency vehicles coming from behind. Failure to allow the emergency vehicle to pass will incur a penalty:

- Failure to yield to emergency vehicle $0.70$

Besides these, there is one additional infraction which has no coefficient, and instead affects the computation of route completion $(R_i)$.

## Off-road driving

If an agent drives off-road, that percentage of the route will not be considered towards the computation of the route completion score.

## Additional Events

Some events will interrupt the simulation, preventing the agent to continue.

- Route deviation
If an agent deviates more than $30$ meters from the assigned route.
- Agent blocked
If an agent is blocked in traffic without taking any actions for $180$ simulation seconds.
- Simulation timeout
If no client-server communication can be established in $60$ seconds.
- Route timeout
This timeout is triggered if the simulation of a route takes more than the allowed time. This allowed time is computed by multiplying the route distance in meters by a factor of $0.8$.

## Sources

- [Alpha Drive Carla Leaderboard Case Study](https://alphadrive.ai/industries/automotive/carla-leaderboard-case-study/)
- [Carla Leaderboard](https://leaderboard.carla.org/)
57 changes: 57 additions & 0 deletions doc/research/paf24/general/old_research_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Research Summary

**Summary:** The research of the previous groups is condensed into this file to make it an entry point for this year's project.

- [Research and Resources](#research-and-resources)
- [Acting and Control Modules](#acting-and-control-modules)
- [Planning and Trajectory Generation](#planning-and-trajectory-generation)
- [State Machine for Decision-Making](#state-machine-for-decision-making)
- [OpenDrive Integration and Navigation Data](#opendrive-integration-and-navigation-data)

## Research and Resources

- This section provides an extensive foundation for the autonomous vehicle project by consolidating previous research from **PAF22** and **PAF23**.
- **PAF22**: Established core methods for autonomous vehicle control and perception, including traffic light detection and emergency braking features. It also set up the base components of the CARLA simulator integration, essential sensor configurations, and data processing pipelines.
- **PAF23**: Enhanced lane-change algorithms and expanded intersection-handling strategies. This project introduced a more robust approach to decision-making at intersections, factoring in pedestrian presence, oncoming traffic, and improved signal detection. Additionally, **PAF23** refined vehicle
- behavior for more fluid lane-change maneuvers, optimizing control responses to avoid obstacles and maintain lane positioning during highway merging and overtaking scenarios.
- The resources also include CARLA-specific tools such as the CARLA Leaderboard and ROS Bridge integration, which link CARLA’s simulation environment to the Robot Operating System (ROS). Detailed references to CARLA’s sensor suite are provided, covering RGB cameras, LIDAR, radar, GNSS, and IMU
sensors essential for perception and control.

## Acting and Control Modules

- The **acting module** focuses on the vehicle’s control actions, including throttle, steering, and braking.
- **Core Controllers**: Contains controllers like the **PID controller** for longitudinal (speed) control and **Pure Pursuit** and **Stanley controllers** for lateral (steering) control. These controllers work in unison to achieve precise vehicle handling, especially on turns and at varying speeds.
- **PAF22 Contributions**: Implemented the PID-based longitudinal controller and integrated the Pure Pursuit controller for basic trajectory following, setting a solid foundation for steering and throttle control. PAF22 also laid out the preliminary **emergency braking** logic, designed to override
other controls in hazardous situations.
- **PAF23 Contributions**: Introduced refinements in lateral control, including the adaptive Stanley controller, which adjusts steering sensitivity based on vehicle speed to maintain a smooth trajectory. **PAF23** also optimized the emergency braking logic to respond more quickly to obstacles, with
improvements in lane-changing safety.
- **Sensor Integration**: The acting module subscribes to **navigation and sensor data** topics to remain updated on vehicle position and velocity, integrating sensor feedback for real-time control adjustments.

## Planning and Trajectory Generation

- The **planning module** is critical for determining safe, efficient routes by combining **global and local path planning** techniques.
- **Global Planning**: Uses the **CommonRoad route planner** from TUM, creating a high-level path based on predefined waypoints. **PAF22** initially set up this planner, while **PAF23** added finer adjustments for lane selection and obstacle navigation.
- **Local Planning**: Tailored for dynamic obstacles, this component focuses on immediate adjustments to the vehicle’s path, particularly useful in urban environments with unpredictable elements.
Local planning includes **trajectory tracking** using Pure Pursuit and Stanley controllers to maintain a steady path.
- **PAF23 Enhancements**: Improved **collision avoidance** algorithms and added real-time updates to the trajectory based on sensor data. The local planner now adapts quickly to lane-change requests or route deviations due to traffic, creating a seamless flow between global and local path planning.
Furthermore, the integration of **behavior trees** has been researched, offering some advantages in computing power and explainability. Its drawbacks in uncertain situations and complex environments have been presented.

## State Machine for Decision-Making

- This modular state machine handles various driving behaviors, including **lane changes**, **intersections**, and **traffic light responses**.
- **Core State Machines**: The **driving state machine** manages normal vehicle navigation, controlling target speed and ensuring lane compliance. The **lane-change state machine** makes safe decisions based on lane availability and traffic,
while the **intersection state machine** manages vehicle approach, stop, and turn behaviors at intersections.

- **PAF22 Contributions**: Developed the base decision-making states, enabling lane following, simple lane-change maneuvers, and basic intersection handling.
- **PAF23 Contributions**: Significantly enhanced the state machine by adding specialized states for complex maneuvers, like responding to oncoming traffic at intersections, merging onto highways, and making priority-based decisions at roundabouts.
The **intersection state machine** now incorporates detailed behaviors for handling left turns, straight passes, and right turns, considering pedestrian zones and cross-traffic. **PAF23** also introduced an adaptive lane-change state,
which calculates safety based on vehicle speed, distance to adjacent vehicles, and road type.

## OpenDrive Integration and Navigation Data

- **OpenDrive** files provide a structured road network description, detailing lanes, road segments, intersections, and traffic signals. The navigation data is published in CARLA as ROS topics containing GPS/world coordinates and route instructions.
- **PAF22 Setup**: Established OpenDrive as the core format for map data, integrating it with the CARLA simulator. Initial work involved parsing road and lane data to create accurate trajectories.
- **PAF23 Enhancements**: Improved the parsing of OpenDrive files, focusing on high-level map data relevant to the vehicle's route, such as signal placements and lane restrictions. This project also optimized the navigation data integration with ROS,
ensuring the vehicle receives consistent updates on its location relative to the route, intersections, and nearby obstacles.
- **Navigation Data Structure**: The system uses navigation data points, including **GPS coordinates, world coordinates, and high-level route instructions** (e.g., turn left, change lanes) to guide the vehicle. Each point is matched with a **road option command**,
instructing the vehicle on how to proceed at specific waypoints.

0 comments on commit 0c800a0

Please sign in to comment.