vicovermeer Wrote:In what files (functions) do we find the physical ODE model? Is a description (paper or thesis) available?
Unfortunately the physical ODE (ordinary differential equation) model used by Vamos is spread throughout a number of files: basically, everything in the include/vamos/body and src/vamos/body folders. The car chassis is treated as a rigid body, and forces are applied to the body using F=ma, a=F/m. The acceleration term is numerically integrated with a fixed timestep (dt=0.004 seconds, by default) to generate velocity and position. Rotation is similar. The numerical integration is the first-order
euler method. I attempted to convert the integration to use the second-order
verlet integration method, but due to how Vamos is structured I believe it ends up mathematically reducing to the first-order euler method in most cases.
Here is the way that vamos generates forces for each physics update:
Code:
NOTE: particles can be suspension, suspension hinge, wheel, drag, contact_point, particle, engine, fuel tank
car propagate (false)
* chassis propagate (false)
* * update center of mass
* * propagate particles (false)
* * * wheel propagate (false)
* * * * tire propagate (false)
* * * * * calculate rotational speed based on applied torque / inertia
* * * * calculate ang pos using tire ang vel, tire torque, and tire inertial
* * * engine propagate (false)
* * * * if clutch engaged, set rotational speed to transmission speed
* * * * else set rotational speed to velocity verlet of drive torque / inertia
* * set [ang] accel, delta [ang] pos, and cm & ang velocity to velocity verlet of torque / inertia and force / mass
* * set velocity using euler of this position & last position
* drivetrain input
* * set drivetrain speed to differential speed
world interact
* car chassis contact
* * wheel contact
* * * updates wheel posn/vel, adds wheel force to suspension force
car propagate (true)
* drivetrain findforces
* * find drag based on engine rotational speed
* * if in gear
* * * if clutch engaged, engine input, set torque to drive torque
* * * else set torque to drag, engine input
* * * * engine input just sets transmission speed to value passed in
* * else
* * * engine input
* * set differential left & right wheel torques based on drivetrain torque
* set wheel drive torque to drivetrain torque
* chassis findforces
* * particle findforces
* * * suspension findforces
* * * * calculate force based on constants, displacement, and compression velocity
* * * wheel findforces
* * * * tire input ... based on wheel velocity, suspenison force, etc
* * * * * sets velocity, normal force, etc
* * * * tire findforces
* * * * * set force based on pacejka of velocity, normal force, etc
* * * * set wheel force & torque to tire force & torque
* * * drag findforces
* * * * set force based on velocity, etc
* * * contact_point findforces
* * * * if no contact, set force to zero
* * * engine findforces
* * * * set drive torque based on gas & rotational speed & drag
* * add particle force to chassis force
* * add particle torque to chassis torque
* * add gravity to chassis force
* chassis propagate (true)
* * propagate particles (true)
* * * wheel propagate (true)
* * * * tire propagate (true)
* * * * * calculate rotational speed based on applied torque / inertia
* * * engine propagate (true)
* * * * if clutch engaged, set rotational speed to transmission speed
* * * * else set rotational speed to velocity verlet of drive torque / inertia
* * set cm & ang velocity to velocity verlet of torque / inertia and force / mass
* set distance traveled using euler of velocity