Skip to content

Daraan/LunaticAI-Driver-for-CARLA-Simulator

Repository files navigation

LunaticAI Driver for CARLA-Simulator

Documentation Status

The full documentation can be found online at ReadTheDocs.


This repository offers a modularized rule-based agent system for the CARLA simulatordrawing designed to be easily extendable and configurable.

If you are familiar with the CARLA simulator, our agent builds up on the standard agents provided by the CARLA team but remodels and extends them in many ways. The key changes are:

  • Rule System: Customizing the agent's behavior by defining rules and actions.
  • Full, dynamic and transparent Configuration: Allowing to adjust the agent's behavior at runtime building up from a YAML configuration.

Work in Progress

Most important Branches

main Supporting CARLA 0.9.14+, Python 3.7+ with/without RSS build Trying to keep it stable
dev/main Supporting CARLA 0.9.14+, Python 3.7+ with RSS build potentially unstable
dev/daniel Supporting CARLA 0.9.15+, Python 3.10+ with RSS build potentially unstable
WIP/dev_daniel Most recent development branch likely unstable

Installation

See the Installation Guide for more details.

Agent Classes

At the core is the LunaticAgent(agents/lunatic_agent.py) which offers full flexibility in terms of rules and actions and how you control it during a custom written game loop.

The LunaticChallenger(agents/leaderboard_agent.py) is a simplified version wrapped version to be compatible with the carla/leaderboard-2.0 interface, i.e. providing only a setup and run_step method.

You can look at the workflow diagram at the end of this document to see how the agent system is structured.

Rule and Phase System

Rules

Rules for the agent have three core components: a phase where it can be applied, a condition and lastly an action that is executed depending on the result of the condition.

For example, the following rule will slow down the agent when it is at a junction:

class SlowDownAtIntersectionRule(Rule):
    """
    Slow down the agent when it is at a junction.
    """
    phase = Phase.TURNING_AT_JUNCTION | Phase.BEGIN
    @EvaluationFunction
    def rule(self, ctx: Context) -> Hashable:
        return ctx.agent.is_at_junction
    def action(self, ctx: Context):
        ctx.agent.set_target_speed(agent.live_info.target_speed - 10)

For more details look into the Rules documentation.

Phases

The agent system is based on a phase system, which allows to define rules for specific situations. To see which phases are available and how they are defined, see the Phase class in constants.py.

At the beginning (Phase.BEGIN) and end (Phase.END) of a phase associated rules are evaluated and depending on their outcome the agent will perform certain actions.

Configuration

Behavioral aspects of the agent but also the environment and user interface are configured via YAML files. Hydra drawing is used to manage the configuration files and to provide a clean way to access and manage the configuration in a flexible way.

The configuration backend is designed to make coarse and fine-grained changes by using combination of different configs on demand or by adjusting single parameters or blocks via the command line. The configuration files are stored in the conf directory.

For more info continue read the Configuration section.

Workflow and Component Diagram of the Agent System

"Visualization of the agents components and its workflow"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published