Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#376 Road Rules definitions in Carla #414

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
123 changes: 123 additions & 0 deletions carla_traffic_rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Traffic Rules and Principles in CARLA

## Table of Contents

- [Introduction](#introduction)
- [Key Traffic Principles and Complex Interactions](#key-traffic-principles-and-complex-interactions)
- [CARLA Maps and Their Traffic Scenarios](#carla-maps-and-their-traffic-scenarios)
- [Overview of CARLA Maps](#overview-of-carla-maps)
- [Rural and Highway Scenarios](#rural-and-highway-scenarios)
- [Custom Maps with ASAM OpenDRIVE®](#custom-maps-with-asam-opendrive)
- [Units of Measurement](#units-of-measurement)
- [References](#references)

## Introduction

CARLA (Car Learning to Act) is an open-source simulator for testing and developing self-driving car systems.

It includes essential traffic rules, creating a flexible environment to test driving behaviors and interactions without strictly adhering to the traffic laws of any specific country.

## Key Traffic Principles and Complex Interactions

- **Traffic Signals**: Vehicles must stop at red lights and go on green.

- **Stop Signs**: Vehicles must stop at stop signs and yield to pedestrians
and other cars.

- **Lane Management**: Cars should remain in their designated lanes.

- **Speed Limits**: Different speed limits in various areas of the map allow
testing of speed control and adherence to traffic laws.

- **Pedestrian Rights**: Vehicles must yield to pedestrians at crosswalks,
which is vital for pedestrian detection and ensuring safe stops.

- **Intersection Management**: Vehicles must navigate intersections
effectively, managing stop lights and stop signs while yielding when
necessary to keep traffic moving.

- **Roundabout Navigation**: Vehicles should yield to cars already in the
roundabout. This tests their ability to navigate circular roads and merge
correctly.

- **Crosswalk Behavior**: Vehicles need to detect and stop for pedestrians
at crosswalks, highlighting the importance of pedestrian safety.

- **Bicycle Lane Navigation**: Vehicles should be able to detect and safely
navigate around cyclists in traffic.

- **Parking Maneuvers**: Vehicles are tested on their ability to park in
tight spaces, simulating real-life parking challenges.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add country-specific regulations and variations.

While the principles are well-documented, the following aspects mentioned in issue #376 are missing:

  • Country-specific traffic regulations and their variations in CARLA
  • Differences in sign positioning and road markings across regions
  • Speed measurement variations (km/h vs. mph)

Consider adding a new subsection addressing these regional variations to help users understand how CARLA handles different traffic rule systems.

Would you like me to help draft content for the country-specific regulations section?

🧰 Tools
🪛 LanguageTool

[misspelling] ~18-~18: This word is normally spelled with a hyphen.
Context: ...les, creating a flexible environment to test driving behaviors and interactions without stri...

(EN_COMPOUNDS_TEST_DRIVING)

🪛 Markdownlint

24-24: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


29-29: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


32-32: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


35-35: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


36-36: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


39-39: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


40-40: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


43-43: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


46-46: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


49-49: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


## CARLA Maps and Their Traffic Scenarios

CARLA has 12 maps, each designed to test different aspects of self-driving, from basic navigation to complex urban and rural situations. Users can also create custom maps, allowing for additional testing scenarios tailored to specific needs.

### Overview of CARLA Maps

- **Town 1**: A small town with T-junctions and bridges, focusing on managing
intersections and staying in lanes.

- **Town 2**: Similar to Town 1, this town includes shops and homes, testing
navigation and awareness of the surroundings.

- **Town 3**: A larger city area with roundabouts and underpasses, assessing
navigation in roundabouts and speed adjustments.

- **Town 4**: A small town with a figure-eight road, testing navigation in
multiple lanes and interactions with pedestrians.

- **Town 5**: An urban area with multilane roads and a highway, focusing on
highway driving and commercial strategies.

- **Town 6**: A less populated town with unique junctions, testing navigation
in multiple lanes and the use of slip roads.

- **Town 7**: A rural community with no marked roads, which tests navigation
and parking in residential areas.

- **Town 8 & Town 9**: Hidden maps used for the Leaderboard challenge.

- **Town 10**: An inner-city area with various junctions and pedestrian
activity, testing skills in complex traffic situations.

- **Town 11**: A basic map for testing navigation in open areas with fewer
visual guides.

- **Town 12**: A large map based on Amarillo, Texas, featuring urban,
residential, and rural areas to test navigation and visual skills across
diverse environments.

### Rural and Highway Scenarios

Maps like **Town 7** and **Town 12** focus on rural and highway driving,
simulating open and high-speed areas. They test long-distance driving,
speed management, and safe overtaking, requiring drivers to adapt to
unmarked roads and agricultural settings.

## Road Network Creation with ASAM OpenDRIVE®

Road networks in CARLA are built using **ASAM OpenDRIVE®**, which standardizes
road descriptions:

- **Hierarchical Structure**: Roads are organized into nodes for better
integration.

- **Reference Line**: Each road has a reference line that defines its shape.

- **Interconnectivity**: Roads can connect to each other for realistic
traffic flow.

## Units of Measurement

To keep tests consistent, CARLA uses standardized units:

- **Speed**: Measured in meters per second (m/s).

- **Distance**: Measured in meters.

## References

- CARLA Documentation: [CARLA](https://carla.readthedocs.io/en/latest/)

- ASAM OpenDRIVE® Standard: [ASAM OpenDRIVE](https://www.asam.net/standards/detail/opendrive/)
94 changes: 94 additions & 0 deletions doc/research/paf24/general/carla_traffic_rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Traffic Rules and Principles in CARLA

## Table of Contents

- [Introduction](#introduction)
- [Key Traffic Principles and Complex Interactions](#key-traffic-principles-and-complex-interactions)
- [CARLA Maps and Their Traffic Scenarios](#carla-maps-and-their-traffic-scenarios)
- [Overview of CARLA Maps](#overview-of-carla-maps)
- [Rural and Highway Scenarios](#rural-and-highway-scenarios)
- [Custom Maps with ASAM OpenDRIVE®](#custom-maps-with-asam-opendrive)
- [Units of Measurement](#units-of-measurement)
- [References](#references)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add regional traffic standards section to Table of Contents.

To fully address issue #376, consider adding a new section for regional traffic standards that covers:

  • Country-specific regulations
  • Traffic sign variations and positioning
  • Speed measurement units (km/h vs. mph)
  • Road marking differences
🧰 Tools
🪛 LanguageTool

[uncategorized] ~6-~6: Possible missing preposition found.
Context: ...

  • Introduction
  • [Key Traffic Principles and Complex Interact...

(AI_HYDRA_LEO_MISSING_TO)

## Introduction

CARLA (Car Learning to Act) is an open-source simulator specifically designed for testing and developing autonomous driving systems. It incorporates essential traffic rules to create a flexible environment. This flexibility allows users to modify traffic regulations and design custom maps, enabling the evaluation of driving behaviors and interactions without strictly adhering to the traffic laws of any specific country.

## Key Traffic Principles and Complex Interactions

- **Traffic Signals**: Vehicles must stop at red lights and proceed on green, facilitating the testing of traffic light detection and timing adjustments.

- **Stop Signs**: Vehicles are required to halt at stop signs, yielding to pedestrians and other vehicles, which is essential for ensuring safety in traffic scenarios.

- **Lane Management**: Cars are expected to stay within designated lanes, aiding the development of lane-keeping and lane-following algorithms.

- **Speed Limits**: Varying speed limits across different map zones allow for the testing of speed regulation and adherence to traffic laws.

- **Pedestrian Rights**: Vehicles must yield to pedestrians at crosswalks, which is crucial for pedestrian detection and ensuring safe braking.

- **Intersection Management**: Vehicles must effectively navigate intersections, managing stop lights and stop signs while yielding as necessary to maintain traffic flow.

- **Roundabout Navigation**: Vehicles are required to yield to cars already within the roundabout, supporting testing of circular navigation and merging strategies.

- **Crosswalk Behavior**: Vehicles must detect and stop for pedestrians at crosswalks, highlighting the importance of pedestrian safety.

- **Bicycle Lane Navigation**: Vehicles should be able to detect and navigate around cyclists, ensuring safe interactions in mixed traffic environments.

- **Parking Maneuvers**: Vehicles are tested on their ability to maneuver in tight parking spaces, simulating real-life parking constraints.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add regional variations to traffic principles.

Each principle should address common regional variations. For example:

  • Traffic Signals: Different signal patterns/colors by region
  • Speed Limits: Unit variations (km/h vs. mph) and typical ranges
  • Lane Management: Left vs. right-hand driving
  • Stop Signs: Design variations across regions

## CARLA Maps and Their Traffic Scenarios

CARLA features 12 maps, each designed to test various aspects of autonomous driving, ranging from basic navigation to complex urban and rural settings.

### Overview of CARLA Maps

- **Town 1**: A small town with T-junctions and bridges, focusing on intersection management and lane discipline.

- **Town 2**: Similar to Town 1, it includes commercial and residential areas, testing navigation and environmental awareness.

- **Town 3**: A larger urban area with roundabouts and underpasses, assessing roundabout navigation and adaptive speed control.

- **Town 4**: A small town with a figure-eight ring road, testing multi-lane navigation and pedestrian interactions.

- **Town 5**: An urban environment featuring multilane roads and a highway, focusing on highway navigation and commercial driving strategies.

- **Town 6**: A low-density town with unique junctions, testing multi-lane navigation and slip road utilization.

- **Town 7**: A rural community with unmarked roads, challenging navigation and parking in residential areas.

- **Town 8 & Town 9**: Secret maps used for the Leaderboard challenge.

- **Town 10**: An inner-city area with diverse junctions and pedestrian activity, testing negotiation skills in complex traffic.

- **Town 11**: A minimally decorated map for testing navigation over expansive areas with fewer visual cues.

- **Town 12**: A large map inspired by Amarillo, Texas, with urban, residential, and rural areas, testing navigation and visual perception across diverse environments.

### Rural and Highway Scenarios

Maps like **Town 7** and **Town 12** emphasize rural and highway scenarios, simulating open and high-speed environments. They test long-distance driving, speed regulation, and safe overtaking, requiring adaptability to unmarked roads and agricultural structures in rural settings.

## Road Network Creation with ASAM OpenDRIVE®

Road networks in CARLA are created using **ASAM OpenDRIVE®**, which standardizes road descriptions:

- **Hierarchical Structure**: Roads are organized in nodes for better application integration.

- **Reference Line**: Each road has a reference line to define its shape.

- **Interconnectivity**: Roads can connect for realistic traffic flow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Expand OpenDRIVE section with regional variations.

The OpenDRIVE section should address how different regional standards are handled:

  1. Traffic sign variations across regions
  2. Road marking differences
  3. Lane width standards
  4. Speed limit representations

This would help address the country-specific requirements from issue #376.

## Units of Measurement

To ensure consistency across tests, CARLA employs standardized units:

- **Speed**: Measured in meters per second (m/s).

- **Distance**: Measured in meters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance units section with conversion information.

Add details about:

  1. How CARLA handles unit conversions internally
  2. Converting between m/s and regional units (km/h, mph)
  3. Configuring preferred units for simulation

## References

- CARLA Documentation: [CARLA](https://carla.readthedocs.io/en/latest/)

- ASAM OpenDRIVE® Standard: [ASAM OpenDRIVE](https://www.asam.net/standards/detail/opendrive/)
Loading