Agent skill
vehicle-dynamics
Use this skill when simulating vehicle motion, calculating safe following distances, time-to-collision, speed/position updates, or implementing vehicle state machines for cruise control modes.
Install this agent skill to your Project
npx add-skill https://github.com/benchflow-ai/skillsbench/tree/main/tasks-no-skills/adaptive-cruise-control/environment/skills/vehicle-dynamics
SKILL.md
Vehicle Dynamics Simulation
Basic Kinematic Model
For vehicle simulations, use discrete-time kinematic equations.
Speed Update:
new_speed = current_speed + acceleration * dt
new_speed = max(0, new_speed) # Speed cannot be negative
Position Update:
new_position = current_position + speed * dt
Distance Between Vehicles:
# When following another vehicle
relative_speed = ego_speed - lead_speed
new_distance = current_distance - relative_speed * dt
Safe Following Distance
The time headway model calculates safe following distance:
def safe_following_distance(speed, time_headway, min_distance):
"""
Calculate safe distance based on current speed.
Args:
speed: Current vehicle speed (m/s)
time_headway: Time gap to maintain (seconds)
min_distance: Minimum distance at standstill (meters)
"""
return speed * time_headway + min_distance
Time-to-Collision (TTC)
TTC estimates time until collision at current velocities:
def time_to_collision(distance, ego_speed, lead_speed):
"""
Calculate time to collision.
Returns None if not approaching (ego slower than lead).
"""
relative_speed = ego_speed - lead_speed
if relative_speed <= 0:
return None # Not approaching
return distance / relative_speed
Acceleration Limits
Real vehicles have physical constraints:
def clamp_acceleration(accel, max_accel, max_decel):
"""Constrain acceleration to physical limits."""
return max(max_decel, min(accel, max_accel))
State Machine Pattern
Vehicle control often uses mode-based logic:
def determine_mode(lead_present, ttc, ttc_threshold):
"""
Determine operating mode based on conditions.
Returns one of: 'cruise', 'follow', 'emergency'
"""
if not lead_present:
return 'cruise'
if ttc is not None and ttc < ttc_threshold:
return 'emergency'
return 'follow'
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
csv-processing
Use this skill when reading sensor data from CSV files, writing simulation results to CSV, processing time-series data with pandas, or handling missing values in datasets.
pid-controller
Use this skill when implementing PID control loops for adaptive cruise control, vehicle speed regulation, throttle/brake management, or any feedback control system requiring proportional-integral-derivative control.
yaml-config
Use this skill when reading or writing YAML configuration files, loading vehicle parameters, or handling config file parsing with proper error handling.
simulation-metrics
Use this skill when calculating control system performance metrics such as rise time, overshoot percentage, steady-state error, or settling time for evaluating simulation results.
web-interface-guidelines
Vercel's comprehensive UI guidelines for building accessible, performant web interfaces. Use this skill when reviewing or building UI components for compliance with best practices around accessibility, performance, animations, and visual stability.
browser-testing
VERIFY your changes work. Measure CLS, detect theme flicker, test visual stability, check performance. Use BEFORE and AFTER making changes to confirm fixes. Includes ready-to-run scripts: measure-cls.ts, detect-flicker.ts
Didn't find tool you were looking for?