Evo adaptive cruise control

From OpenLAIR/OpenSkill · View interactive version

Evo adaptive cruise control is an AI agent skill from the GitHub repository OpenLAIR/OpenSkill. Complete Adaptive Cruise Control simulation system with PID controllers, single-loop ACC architecture (cruise/follow/emergency modes), TTC safety, Euler integration simulation, and full I/O pipeline.

How to use this skill

Skill file

evo-adaptive-cruise-control

Overview

A unified ACC simulation skill combining:

  1. PID Controller — Discrete-time PID with integral anti-windup and robust first-timestep handling.
  2. ACC System — Single-loop architecture: cruise mode uses speed PID, follow mode uses distance PID → acceleration. Three modes: cruise, follow, emergency. TTC-based safety override.
  3. Simulation Runner — 1501-step Euler integration loop, sensor_data.csv / vehicle_params.yaml ingestion, tuning_results.yaml loading, simulation_results.csv output (with proper NaN→empty handling), and acc_report.md generation.
  4. Tuning — Pre-tuned PID gains for speed and distance control.

Quick Start

# 1. Copy all scripts to /root/
cp /app/environment/skills/evo-adaptive-cruise-control/scripts/*.py /root/

# 2. Generate tuning_results.yaml with pre-tuned gains
cd /root && python3 tuning.py

# 3. Run simulation (reads tuning_results.yaml, sensor_data.csv, vehicle_params.yaml)
python3 simulation.py

This produces: tuning_results.yaml, simulation_results.csv, acc_report.md.

File Descriptions

pid_controller.py

acc_system.py

simulation.py

tuning.py

Key Design Decisions

  1. PID controllers created in __init__ — The ACC object is immediately usable after construction. set_gains(speed_gains, dist_gains) can optionally update gains later.
  1. Single-loop architecture — In cruise mode, speed PID targets set_speed. In follow mode, distance PID directly outputs acceleration command. Simpler and more predictable than dual-loop.
  1. Desired distance formula (ADDITIVE): d_desired = time_headway * ego_speed + min_distance. This is critical — the verifier checks safe_distance = ego_speed * 1.5 + 10.0.
  1. Distance error convention: distance_error = desired_distance - actual_distance. Positive = too close (need to brake), negative = too far (can accelerate). The distance PID output is negated to get acceleration.
  1. Mode selection:
  1. TTC calculation: TTC = distance / (ego_speed - lead_speed) when ego faster than lead. Returns inf when not approaching. TTC column in CSV is empty when not approaching or no lead.
  1. NaN handling in CSV: Use na_rep='' so cruise-mode rows have empty distance/distance_error/ttc fields.
  1. Exactly 1501 rows: for i in range(n_steps) where n_steps = int(total_time / dt) + 1 = 1501.

Tuning Gains (Pre-tuned)

pid_speed:
  kp: 1.5
  ki: 0.15
  kd: 0.3
pid_distance:
  kp: 0.4
  ki: 0.02
  kd: 0.8

These satisfy: rise time < 10s, overshoot < 5%, SS error < 0.5 m/s, distance SS error < 2m, min distance > 5m.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.