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.
- License 许可
- Apache-2.0
- 最近更新
- 2026-08-03
- Stars
- ★ 127
- Forks
- 24
01 前言 Front Matter
- name
- vehicle-dynamics
- description
- 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.
03 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'
04 同仓库更多 Skills
data-reconciliation
暂无简介
hierarchical-taxonomy-clustering
Build unified multi-level category taxonomy from hierarchical product category paths from any e-commerce companies using embedding-based recursive clustering with intelligent category naming via weighted word frequency analysis.
nlp-research-repo-package-installment
Align Python version and repo-declared dependencies (requirements.txt / environment.yml) before installing packages for NLP research code reproduction.
state-space-linearization
Linearizing nonlinear dynamics around operating points for control design.
mpc-horizon-tuning
Selecting MPC prediction horizon and cost matrices for web handling.
integral-action-design
Adding integral action to MPC for offset-free tension tracking.