OpenCDA API Overview¶
Complete API Documentation
For comprehensive OpenCDA API documentation, visit the Official OpenCDA Documentation.
| Component | Purpose | Status |
|---|---|---|
| CavWorld | Global CAV registry & shared ML models | ✅ Enhanced |
| ScenarioManager | Simulation setup & vehicle spawning | ✅ Stable |
| VehicleManager | Individual vehicle coordination | ✅ Enhanced |
| PerceptionManager | Sensor fusion & object detection | ✅ YOLOv8 |
| LocalizationManager | Position tracking & filtering | ✅ Stable |
| BehaviorAgent | Path planning & decision making | ✅ Stable |
| V2XManager | Vehicle-to-vehicle communication | ✅ Stable |
Key Updates¶
- YOLOv8 Integration: ~20% performance improvement with automatic YOLOv5 fallback
- Thread Safety: Fixed GIL issues in multi-threaded scenarios
- Memory Efficiency: Shared model instances across all vehicles
- Compatibility: Maintained existing camera-lidar fusion interfaces
- Version Management: Centralized in
opencda/__init__.py - CARLA Version: Fixed to 0.9.15 for consistency
- Package Manager: Pixi-based environment management
- Documentation: Enhanced API structure with examples
Core Workflow¶
What it does: Orchestrates simulation setup, vehicle management, and execution loop
from opencda.scenario_testing.utils.customized_map_api import customized_map_helper
# Load configuration and create CAV world
scenario_params = load_yaml(config_yaml)
cav_world = CavWorld(apply_ml=True)
# Initialize scenario manager
scenario_manager = ScenarioManager(
scenario_params, apply_ml=True,
xodr_path=xodr_path, cav_world=cav_world
)
| Principle | Implementation | Benefits |
|---|---|---|
| Manager Pattern | Dedicated manager for each subsystem | Clear responsibilities, easy testing |
| Configuration-Driven | YAML configs with inheritance | Flexible scenarios, easy experimentation |
| Plugin Architecture | Custom algorithms in opencda/customize/ |
Extensible without core changes |
Integration Guide¶
Quick Start
Get started with OpenCDA in 4 steps: - Installation
- Quick Test - Basic Scenario - Custom DevelopmentIntegration Points: CARLA 0.9.15, SUMO co-simulation, V2X communication, PyTorch ML models