racer home

Car physics - reference

 

Home Every physical aspect of the car should be in the car.ini file.


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

 

Introduction

This document describes the various physical aspects of cars that you can tweak in Racer; it is the physics editor's Bible. As the featurelist grows, this list may not always be entirely complete; check out the file data/cars/default/car.ini, which will have 99.9% of all the possible variables set (these are used as default values in case specific car.ini files for other cars miss them). I'll try and add some generic information on how Racer simulates vehicles here as well, hopefully combining the completeness of a reference guide with accompanying information on how to use it (and what is and isn't simulated).

There is a special page for the Pacejka tire formula (which is used as part of the tire model). If you have a hard time getting a drivable car, the car physics troubleshooting page might help out. Also make sure you read the tutorial when you start a car (for info on car cameras etc).

Note this document isn't meant for setting up the car; that's a separate issue. This document describes the features behind the setting up, which are mostly static for the casual driver (who just changes suspension rates, things like that).

If you find settings (in car.ini files) that are missing from this document, please mail me so I can add the omitted parameter to this page.

Thanks go to Claes Wikdahl for creating the Mitsubishi Evo6 which I used in clarifying some concepts.

Changes

Throughout Racer's life, many new variables have entered the stage. See pitstop.totalnfs.net/racerwiki/index.php/Car_ini_changes for a list of changes sorted by Racer version.

Linearity - definition

Linearity is used in a number of places (controls, steering, throttle, engine mapping, braking). If we take steering as an example, 0 is fully non-linear, smoothing steering a lot when not fully applied (around the center, steering is slow; it gets faster as you come to the limits of the wheel rotation). 1 is fully linear. Values above 1, upto 2 actually increase response, exaggerating the actual input (giving an exponential response). Most controls will benefit from a mild non-linearity though (0..1).

The shape used to get non-linearity is an x^3 polynomial. To be more precise, here is the pseudocode, where 'l' is linearity.

function Linearize(v,L)
if L>1 then { L=2-L; if(v>=0){ invV=1-v; return v*L+(1-L)*(1-invV^3); } else { invV=1+v; return v*L+(1-L)*(-1+iv^3); }
else return v*L+(1-L)*v^3

General notes

Also, for aerodynamics for example, you can copy the default values and paste them into your car's car.ini file as a template for modifications. Added variables should generally not change you car's behavior (or not much) to keep forward compatibility.

Miscellaneous car aspects Chassis (body) properties
Steering Engine
Driveline (gearbox, clutch, handbrakes,...) Differential(s)
Aerodynamics Suspension
Tires/wheels Cameras
Driving aids Lights
Everything about lights is on its own page.

Car general information

You can specify some information about the car itself. Nothing much is done with this, other than it may be used in the future in the 'garage' (where you select a car).

Force feedback settings (since v0.8.24, more have been added):

 

Car sounds

The sounds now have their own page.

Car graphics

The car is split up into several models. The parts that have an associated 3D model use a model chunk. Within that chunk you can specify model.file, which indicates the DOF file to use (from the car directory), and a scale.x/y/z, with which you can scale the model. It is recommended you do NOT use the scaling, as this takes time when loading and may confuse you in the Modeler.

More information on the exact definition of model chunks can be found in the car models tutorial.

AI - artificial intelligence

A small section on AI modifies the car behavior when in AI mode (press Shift-A during a race to toggle AI). The following AI parameters are available per-car:

 

Body mass

The setting body.mass indicates the mass in kg. Note that the engine weight is added (engine.mass) as may others (a driver for example).

Body center of gravity

Very important for the handling, the center of gravity is specified in car.cg.x/y/z. For versions upto (and including) v0.5, the X and Z values were ignored; this is because the CG must match the center of the (graphical) body model. Now, a nullpoint is defined, which basically is where-ever you'd want it, but mostly it's quite close to the CG (and it is recommended to be close to the CG itself for all the offsets to make sense). The nullpoint makes it possible to independently move your 3D model and your CG to match up.

More information on the nullpoint way of thinking can be found here.

To the right you see a typical car. Notice the numbering of the wheels. Actually, the suspensions (their body attachment points) define the locations of the wheels.

The axis system is that which OpenGL uses (the SAE uses a different vehicle axis system, but I've adopted OpenGL's system for ease of graphics display). The Y goes up through the roof of the car.

This image shows the local coordinate system of the car as it was defined in the modeler.

You can move the CG relative to the nullpoint in car.cg.x/y/z. The nullpoint isn't shown here, but it's the point from which every other location is calculated. The nullpoint by definition IS location (0,0,0).

The lower the CG height (cg.y), the more stable the car. A height of about 0.3 to 0.4 (m) is typical for most cars (check the Ctrl-9 screen to see the actual CG height; this isn't the same as your cg.y, but is the result of all springs stabilizing in a steady state), although F1 cars might get lower ones. Values below 0 are not physically possible; the CG Y value will always lie somewhere in the bounding hull of the car (to visualize the hull, imagine pulling a cloth all over the car and pulling it tight; the shape of the cloth is then approximately the bounding hull).

Body inertia

The inertia values describe how willing the car is to rotate around its local X/Y/Z axes (so around the Center of Gravity, or CG). The higher the number, the more energy it takes to rotate the car (the less quickly it will start rotating). The numbers are stored in body.inertia.x/y/z and have the SI units kg*m^2. I don't have a general formula for these numbers, but it seems like normally the X value is highest, the Y value is a little lower (90%) and the Z value is lowest (perhaps ~60% of the X value).

An example Ferrari of 1280 kg has a X inertia value of 1950. Lower weight cars have lower inertiae. A good empirical method that is in use for Sports/Formula style car is the following:

For example: you have car that weighs 525 kg, has a weight distribution of 40/60, a wheelbase of 2.78 m and the front wheels are 1.6 m away from the CG.

Body collisions

Car collision handling now has its own page.

Steering

The steering wheel in Racer is simple. It has lock (how many degrees it can turn), can deliver Ackerman effects (one wheel turning more than the other) and has linearity added to modify steering responsiveness per car.

Steering graphics

The steering wheel is represented by a 3D model.

Steering lock

The maximum graphical angle of the steering wheel is specified in steer.lock (in degrees, not radians!). It's mostly a graphical option; the relationship to your real controller's lock may be preserved if you specified it in your controlset (not yet in v0.5.0).

The steering ratio (ratio of steering wheel rotation divided by wheel lock) is calculated based on this value, and the value of wheel 0's lock (wheel0.lock). So: steeringRatio=steer.lock/wheel0.lock.

Steering Ackerman effect

The Ackerman effect is that of the inner wheel turning more than the outer wheel in a tight turn. This improves turn-in for low-speed big-angle corners.

Theory: although Ackerman steering geometry is used on a lot of passenger cars, it is less common on racing cars. This is because at racing speeds the wheel deflection will generally not exceed 10 degrees, and the effect of Ackerman geometry would be very little, so leaving it out isn't a problem. At the opposite side, karts often have a LOT of Ackerman steering.

Steering linearity

For more control of the steering 'feel', you can adjust steering linearity per car. You do this with steer.linearity. The default is 1.0, meaning fully linear. For more info on this value, see linearity above.

Steering force feedback

Next to the global control settings, you can modify force feedback strength per car. This helps to subtly modify force feedback for some cars.

Engines

The engine now has its own page.

 

Gearbox ratios

You can specify the gearbox workings in the gearbox section.

Gearbox shifting

Stored in the engine subtree, shifting can be done manually or automatically. Mostly (without freeshifting) what happens is a 3-phase process; declutch (time_to_declutch), a moment in neutral (time_in_neutral) and lastly the clutch engages again with the new gear set (time_to_clutch). Note a separate set can be specified (v0.5.2b7.5+) for downshifting, which in conjuction with blip_throttle (see racer.ini).

These parameters define shifting:

Racer (from v0.5) can do freeshifting, so the user can attempt to put the car in a certain gear at any time. More parameters will deal with bad shifts later.

Clutch

The clutch is the part that splits the driveline into 2 parts; the preclutch part (the engine itself) and the postclutch part (driveshaft plus differentials and wheels). The parameters are:

Handbrakes (v0.5 beta1+)

The handbrakes can be applied to any and all wheels. The wheels that are affected are set in handbrakes.wheels. Set it to "23" for example and the handbrakes will work on wheel2 and wheel3 (see image). Mostly these are the 2 rear wheels, which should correspond to "23".

Then, for every wheel, define the maximum handbrake torque in wheel<x>.max_handbrake_torque. If not defined, the value of wheel<x>.max_braking is used, but that generally is too high. Theoretically, a handbrake will generate approximately 10% of what the normals brakes can generate.

Note that the combined effect of pedal braking and handbrakes will never exceed the max_braking torque. So they are added, but clipped at max_braking.

Camera positions

Mostly you'll edit camera positions from within Carlab. For consistency, here are the used parameters:

Note that for the new graphics engine some new entries will be added to allow for more natural car cameras.

Driver aids

To be able to drive the car, you can sometimes expect some help to be implemented. Currently (v0.5.2 beta 5) automatic shifting and traction control are implemented. ABS is scheduled for the future.

Driver aids - automatic shifting

Automatic shifting is possible by setting engine.shifting.automatic to 1. See Gearbox shifting for more details.

Driver aids - traction control

Traction control can be used to avoid spinning the (often rear) wheels while accelerating. It is allowed in certain classes to implement this. When the wheel speeds differ too much, TC kicks in and cuts the throttle, until the wheel speed ratio returns to acceptable levels.

Currently traction control uses wheel speeds (rotational velocities) to determine a ratio. The front wheel speed is the combined (averaged) rotational velocity of front wheels, and the rear speed is similarly an average of the rear wheels speed. Note that versions before v0.8.3 did an addition of all velocities, so if the number of front wheels and rear wheels isn't equal, you'd get incorrect traction control behavior.

The following variables determine the behavior:

Driver aids - ABS

ABS (anti-lock braking system) is implemented since Racer v0.5.2b5.3.

ABS can be used to avoid locking the wheels while braking. When the wheel speeds (see traction control) differ too much, ABS kicks in and releases the brakes, until the wheel speed ratio returns to acceptable levels.

The wheel speed ratio is calculated the same way as with traction control.

The following variables determine the behavior:


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

(last updated March 29, 2012 )