vehicle-dynamics
$
npx mdskill add elizaOS/eliza/vehicle-dynamicsFor vehicle simulations, use discrete-time kinematic equations.
SKILL.md
.github/skills/vehicle-dynamicsView on GitHub ↗
---
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.
---
# Vehicle Dynamics Simulation
## Basic Kinematic Model
For vehicle simulations, use discrete-time kinematic equations.
**Speed Update:**
```python
new_speed = current_speed + acceleration * dt
new_speed = max(0, new_speed) # Speed cannot be negative
```
**Position Update:**
```python
new_position = current_position + speed * dt
```
**Distance Between Vehicles:**
```python
# 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:
```python
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:
```python
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:
```python
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:
```python
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'
```
More from elizaOS/eliza
- ac-branch-pi-modelAC branch pi-model power flow equations (P/Q and |S|) with transformer tap ratio and phase shift, matching `acopf-math-model.md` and MATPOWER branch fields. Use when computing branch flows in either direction, aggregating bus injections for nodal balance, checking MVA (rateA) limits, computing branch loading %, or debugging sign/units issues in AC power flow.
- academic-pdf-redactionRedact text from PDF documents for blind review anonymization
- ada-plan-view-accessibilityUse when checking simplified ADA-derived plan-view bathroom accessibility constraints such as turning space, door clear width, toilet centerline, grab bars, and lavatory knee/toe clearance.
- analyze-ciAnalyze failed GitHub Action jobs for a pull request.
- architectural-dxf-extractionUse when extracting plan-view architectural geometry from DXF files with semantic CAD layers, especially when outputs must normalize rooms, doors, fixtures, clearances, and grab bars into machine-checkable JSON.
- attitude-controller-plannerUse this skill when implementing the inner control loop for a quadrotor — attitude (roll/pitch/yaw) PID control and attitude planning (converting desired acceleration to desired Euler angles). Covers gain layout, integral reset pattern, and the attitude planner inverse kinematics.
- azure-bgpAnalyze and resolve BGP oscillation and BGP route leaks in Azure Virtual WAN–style hub-and-spoke topologies (and similar cloud-managed BGP environments). Detect preference cycles, identify valley-free violations, and propose allowed policy-level mitigations while rejecting prohibited fixes.
- box-least-squaresBox Least Squares (BLS) periodogram for detecting transiting exoplanets and eclipsing binaries. Use when searching for periodic box-shaped dips in light curves. Alternative to Transit Least Squares, available in astropy.timeseries. Based on Kovács et al. (2002).
- browser-testingVERIFY 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
- cache-policy-comparisonCompare and implement eviction policies (LRU, LFU, FIFO, S3FIFO, ARC) for bounded-capacity caches. Use when choosing or implementing an eviction policy for a buffer pool, page cache, CDN edge, or LLM KV cache, or when writing a replay simulator that supports multiple policies. Clarifies recency vs frequency semantics, queue topology, saturating counters, ghost buffers, and the second-chance rule that distinguishes modern FIFO-family policies from classic LRU.