Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oseiskar/js-car

2D JavaScript car dynamics simulation
https://github.com/oseiskar/js-car

javascript physics physics-2d physics-simulation simulation

Last synced: 3 months ago
JSON representation

2D JavaScript car dynamics simulation

Awesome Lists containing this project

README

        

# JavaScript 2D car dynamics simulation

### Physics model features:

* auto-generated track
* collisions with the 4 walls
* basic static and dynamic friction
* air drag applied to the center of mass
* "arrow-key steering aids": velocity-based limitations to steering angle
and its change rate

The physics model is "as simple as possible": Frictional forces are applied to
two points: the center of the front and rear axle instead of the four wheels
separately. The car is therefore actually modeled more like a "motorcycle that
does not bank". This is the same as assuming a lot of symmetry between the
forces to the left and right wheel on each axle, i.e.,

* no tire slip due to deformations
* no suspension
* no roll
* equal coefficients of friction

*TODO*:

* brakes
* non-constant torque from engine
* noise

### AI drivers

* PID control with a few tricks
* Route planning with an ad-hoc "rubber band model" (uses a web worker)

*TODO*

* Physics-based controller (non-PID)