Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Heuristic:CARLA simulator Carla Behavior Agent Profiles

From Leeroopedia
Knowledge Sources
Domains Autonomous_Driving, Optimization
Last Updated 2026-02-15 07:00 GMT

Overview

Three pre-defined driving behavior profiles (Cautious, Normal, Aggressive) with tuned parameters for speed, safety distance, braking, and tailgating behavior.

Description

The BehaviorAgent uses one of three pre-configured behavior profiles that control driving style. Each profile defines: maximum speed, speed limit distance offset, speed decrease when following, safety time (TTC threshold), minimum proximity threshold for obstacle detection, braking distance for emergency stops, and a tailgate counter that controls lane-change willingness. These profiles encode tribal knowledge about what constitutes safe, normal, and aggressive driving in CARLA's simulation environment.

Usage

Use this heuristic when configuring BehaviorAgent driving styles or when creating custom behavior profiles for specific simulation scenarios. The profiles affect:

  • Car-following distance (via `safety_time` and TTC computation)
  • Emergency braking trigger distance (`braking_distance`)
  • Lane change aggressiveness (`tailgate_counter`: -1 means always willing to tailgate)
  • Speed management (how much below the speed limit to drive)

The Insight (Rule of Thumb)

Parameter Cautious Normal Aggressive Unit
max_speed 40 50 70 km/h
speed_lim_dist 6 3 1 km/h below limit
speed_decrease 12 10 8 km/h reduction when following
safety_time 3 3 3 seconds (TTC threshold)
min_proximity_threshold 12 10 8 meters
braking_distance 6 5 4 meters (emergency brake)
tailgate_counter 0 0 -1 ticks (negative = always tailgate)
  • Action: Choose profile based on desired driving behavior, or create custom profile by subclassing.
  • Trade-off: Cautious = safer but slower; Aggressive = faster but more collision-prone. All profiles use the same `safety_time` of 3 seconds.
  • Intersection behavior: All profiles reduce speed by 5 km/h below the limit at intersections with turns (behavior_agent.py:291-294).

Reasoning

The profiles were empirically tuned for CARLA's vehicle dynamics and typical urban road scenarios. Key design choices:

  • `safety_time = 3` for all profiles: represents a 3-second TTC (time-to-collision) threshold. Below this, the agent actively reduces speed. Between 1x and 2x safety_time, it matches the leading vehicle's speed.
  • `tailgate_counter = -1` for Aggressive: negative value means the agent is always willing to change lanes to pass slower traffic, making it more assertive.
  • `speed_lim_dist`: Offset below the speed limit. Cautious drives 6 km/h under, Aggressive only 1 km/h under.
# PythonAPI/carla/agents/navigation/behavior_types.py:7-37
class Cautious(object):
    max_speed = 40
    speed_lim_dist = 6
    speed_decrease = 12
    safety_time = 3
    min_proximity_threshold = 12
    braking_distance = 6
    tailgate_counter = 0

class Normal(object):
    max_speed = 50
    speed_lim_dist = 3
    speed_decrease = 10
    safety_time = 3
    min_proximity_threshold = 10
    braking_distance = 5
    tailgate_counter = 0

class Aggressive(object):
    max_speed = 70
    speed_lim_dist = 1
    speed_decrease = 8
    safety_time = 3
    min_proximity_threshold = 8
    braking_distance = 4
    tailgate_counter = -1

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment