How islam4562/differential-simulator works
Differential Simulator is an interactive Python visualization of a car differential. The user presses arrow keys to change gears or steer; the animation updates simulated gear and wheel motion and redraws the differential alongside a tachometer, steering wheel, and gear indicator. The runtime is a single-file Matplotlib application, so its responsibilities share code.py. The README documents the controls and display capabilities; the excerpts show input state and rendering, but omit some wiring and simulation details.
Main entry points: code.py Animation update
Components 13
Input and state
- Key handlers
code.py - Key state
code.py - Gear selection
code.py
Vehicle simulation
- Animation update
code.py - Differential motion
code.py - Steering model
code.py
Visualization
- Canvas setup
code.py - Differential view
code.py - RPM display
code.py - Steering display
code.py - Gear display
code.py - Component labels
code.py
Other components
- Driver
Connections 16
- Driver → Key handlers: presses keys
- Key handlers → Key state: updates
- Key handlers → Gear selection: selects gear
- Key state → Animation update: reads input
- Gear selection → Animation update: reads gear
- Animation update → Differential motion: updates motion
- Animation update → Steering model: updates steering
- Canvas setup → Differential view: creates artists
- Canvas setup → RPM display: creates artists
- Canvas setup → Steering display: creates artists
- Canvas setup → Gear display: creates artists
- Canvas setup → Component labels: draws labels
- Animation update → Differential view: updates display
- Animation update → RPM display: updates needle
- Animation update → Steering display: updates wheel
- Animation update → Gear display: updates indicator