Next: , Previous: Dashboard, Up: Top


1.4 Cars

A number of different car definitions are provided. The car can be selected with -c <car> or --car=<car>, where <car> is one of the following

F1
A modern Formula One car.
F1-1967
A late sixties Formula One car. For reasons I don't yet understand, this car is very difficult to control.
front-drive
A front wheel drive car.
GT
default-car
A rear wheel drive sports car.
trainer
An under-powered car for beginners.

1.5 Car File Format

The car definition goes inside a car tag. You can assign a name to the car with the name attribute.

     <car name="GT">
       ...
     </car>

The sections below show how the various subsystems are defined.

1.5.1 View

The driver's point-of-view is set with the position tag. You may use whatever units you like, as long as you're consistent. See Units. The horizontal field-of-view is set with the field-width tag. The vertical field-of-view is calculated automatically from the current window geometry.

       <view>
         <position>[ 1.3, 1.0, 0.8 ]</position>
         <field-width>60.0</field-width>
       </view>

1.5.2 Steering

The maximum steering angle is set with the max-angle tag. The exponent detemines how linear the steering response is. A higher number makes the steering less sensitive at small angles.

       <steering>
         <max-angle>10.0</max-angle>
     	<exponent>3.0</exponent>
       </steering>

1.5.3 Drivetrain

The drivetrain section defines the engine, clutch, transmission and differential.

       <drivetrain>
         <engine>
           ...
         </engine>
     
         <clutch>
           ...
         </clutch>
     
         <transmission>
           ...
         </transmission>
     
         <differential>
           ...
         </differential>
       </drivetrain>

The subsections of the drivetrain are described below.

         <engine>
     	  <position>[ 1.5, 1.0, 0.2 ]</position>
     	  <mass>200.0</mass>
           <max-power>3.0e5</max-power>
     	  <peak-engine-rpm>8000.0</peak-engine-rpm>
     	  <rpm-limit>10000.0</rpm-limit>
     	  <inertia>0.10</inertia>
     	  <idle>0.05</idle>
     	  <start-rpm>1000</start-rpm>
     	  <stall-rpm>500</stall-rpm>
     	  <fuel-consumption>0.0001</fuel-consumption>
     
           <sound>
             <file>engine.wav</file>
     		<pitch>0.01</pitch>
     		<volume>0.8</volume>
     		<throttle-volume-factor>1.0</throttle-volume-factor>
     		<engine-speed-volume-factor>0.001</engine-speed-volume-factor>
     	  </sound>
         </engine>

The position and mass parameters affect the weight distribution of the car. The torque curve is calculated from max-power and peak-engine-rpm using a polynomial expression given in Motor Vehicle Dynamics, Genta (1997), where peak-engine-rpm is the engine speed at which the maximum power output (max-power) is achieved. A rev limit can be set with rpm-limit. The rotational inertia of the moving parts is inertia. idle is the throttle position at idle. Starting the engine initially sets the engine speed to start-rpm. Letting the engine speed drop below stall-rpm makes the engine stall. The rate of fuel consumption is set with fuel-consumption.

The engine sound is set in the sound section. file is the name of a WAV file in the data/sounds directory. throttle-volume-factor and engine-speed-volume-factor determine how the loudness of the sound changes.

         <clutch>
           <sliding>0.5</sliding>
     	  <radius>0.25</radius>
     	  <area>0.2</area>
     	  <max-pressure>1.0e4</max-pressure>
         </clutch>

The torque on the clutch is found by dividing the clutch pressure by the value in the area tag and multiplying by the radius and sliding (friction) parameters.

The gear ratios can be defined in two different ways inside the transmission tag. The ratios can be defined individually as in the example below. The first number inside the brackets is the gear (-1 is reverse), and the second is the clutch speed divided by the driveshaft speed.

         <transmission>
     	  <gear-ratio>[ -1, -2.69 ]</gear-ratio>
     	  <gear-ratio>[ 1, 2.53 ]</gear-ratio>
     	  <gear-ratio>[ 2, 1.71 ]</gear-ratio>
     	  <gear-ratio>[ 3, 1.42 ]</gear-ratio>
     	  <gear-ratio>[ 4, 1.19 ]</gear-ratio>
     	  <gear-ratio>[ 5, 1.04 ]</gear-ratio>
     	  <shift-delay>0.2</shift-delay>
         </transmission>

Alternatively, the number of gears and the highest and lowest ratios can be specified. The other gears will be calculate such that the reciprocals of the ratios are equally spaced.

         <transmission>
     	  <forward-gears>5</forward-gears>
     	  <first-ratio>3.21</first-ratio>
     	  <last-ratio>1.10</last-ratio>
     	  <shift-delay>0.2</shift-delay>
         </transmission>

The shift-delay tag tells how long it takes to change gears. For a paddle-shifter, like a modern Formula One car, shift-delay can be set to zero.

1.5.4 Fuel Tank

The fuel tank's position, the current volume of fuel and the density of the fuel affect the car's weight distribution. The capacity tag sets the maximum volume of fuel that the tank can hold. The initial volume is set with the volume tag. The density of the fuel is set with fuel-density.

       <fuel-tank>
         <position>[ 1.00, 1.00, 0.25 ]</position>
     	<capacity>100.0</capacity>
     	<volume>100.0</volume>
     	<fuel-density>0.8</fuel-density>
       </fuel-tank>

1.5.5 Wheels

The wheel section contains information about the suspension, tire, and brakes as well as the wheel itself. The side and end attributes tell where the wheel is located. The values of these attributes are important.

The steered tag tells that the wheel responds to steering input. The driven tag tells that torque from the engine is applied to the wheel. Only two wheels may have a steered tag, and only two may have a driven tag.

       <wheel side="right" end="front">
         <steered/>
         <driven/>
         <position>[ 3.0, 0.05, -0.1 ]</position>
     	<mass>30.0</mass>
     	<restitution>0.1</restitution>
         <suspension>
           ...
         </suspension>
         <tire>
           ...
         </tire>
         <brakes>
           ...
         </brakes>
       <wheel>

Values set in one wheel section are persistent; if you want the same value for another wheel, you do not need set it.

The suspension, tire, and brakes sections are described below.

1.5.6 Suspension

         <suspension>
     	  <position>[ 3.0, 0.35, -0.1 ]</position>
     	  <hinge>[ 2.0, 0.35, 0.3 ]</hinge>
     	  <spring-constant>22000.0</spring-constant>
     	  <bounce>2000.0</bounce>
     	  <rebound>2000.0</rebound>
     	  <travel>0.4</travel>
     	  <max-compression-velocity>10.0</max-compression-velocity>
     	  <camber>-2.0</camber>
     	  <caster>5.0</caster>
     	  <toe>-2.0</toe>
     	</suspension>

The hinge is the center of the wheel's path as the suspension moves. The location of the hinge is determined by suspension geometry, and may be outside of the car itself. Currently, this parameter has no effect of performance. It may be used in the future for configuring anti-dive and anti-squat suspension geometries.

bounce and rebound are the damping coefficients for compression and expansion of the suspension, respectively. If the speed at which the suspension is compressed, or expanded exceeds the value in max-compression-velocity, the dampers “lock up.”

Wheel alignment is set with the camber, caster, and toe tags. All angles are in degrees.

1.5.7 Tires

The longitudinal, transverse, and aligning section each contain a vector of “magic formula” coefficients as presented in Motor Vehicle Dynamics, Genta (1997). The two elements of rolling-resistance are the constant and velocity-squared terms, respectively.

     	<tire>
           <friction>
             <longitudinal>
               [ 1.65, 0.0, 1690.0, 0.0, 229.0, 0.0, 0.0, 0.0, -10.0, 0.0, 0.0 ]
             </longitudinal>
     	    <transverse>
     	      [ 1.80, 0.0, 1690.0, 800.0, 6.03, 0.0, -0.359, 1.0, 0.0, -6.11e-3, -3.22e-2, 0.0, 0.0, 0.0, 0.0 ]
     	    </transverse>
     	    <aligning>
     	      [ 2.07, -6.49, -21.9, 0.416, -21.3, 2.94e-2, 0.0, -1.20, 5.23, -14.8, 0.0, 0.0, -3.74e-3, 3.89e-2, 0.0, 0.0, 0.639, 1.69 ]
     	    </aligning>
     	  </friction>
     	  <radius>0.310</radius>
           <rolling-resistance>[ 1.3e-2, 6.5e-6 ]</rolling-resistance>
     	  <rotational-inertia>10.0</rotational-inertia>
         </tire>

1.5.8 Brakes

         <brakes>
     	  <friction>0.8</friction>
     	  <max-pressure>2.0e6</max-pressure>
           <front-bias>0.55</front-bias>
     	  <radius>0.2</radius>
     	  <area>0.01</area>
         </brakes>

front-bias is the fraction of braking pressure applied to the front brakes.

1.5.9 Particles and Contact Points

Particles affect the mass distribution of the car.

       <particle>
         <position>[ 2.0, 1.0, 0.5 ]</position>
     	<mass>100.0</mass>
       </particle>

Contact points are particles that participate in collisions. The material specified in the material tag (either “metal” or “rubber”) determines the sound made when contact is detected. The coefficients of friction and restitution are set with the friction and restitution tags, respectively.

       <contact-point>
         <mass>40.0</mass>
         <position>[ 0.0, 0.0, 0.0 ]</position>
     	<material>metal</material>
     	<friction>0.5</friction>
     	<restitution>0.1</restitution>
       </contact-point>

1.5.10 Drag and Wings

The aerodynamic properties of the car are determined by the drag and wing sections. The frontal area and coefficient of drag, set it frontal-area and drag-coefficient, are used to calculate the drag force.

       <drag>
         <position>[ 2.0, 1.0, 0.25 ]</position>
     	<frontal-area>2.0</frontal-area>
     	<drag-coefficient>0.3</drag-coefficient>
       </drag>

Downforce can be added with wings. The amount of downforce is determined by the value in the lift-coefficient tag. If the lift coefficient is positive, upforce is generated. This is usually undesirable for cars. The efficiency determines how much drag is added as downforce increases. The surface-area is the surface area of the wing. This value is also used in the drag calculation.

       <wing>
         <position>[ 0.0, 0.9, 0.5 ]</position>
     	<frontal-area>0.2</frontal-area>
     	<drag-coefficient>0.0</drag-coefficient>
     	<surface-area>0.5</surface-area>
     	<lift-coefficient>-4.0</lift-coefficient>
     	<efficiency>0.95</efficiency>
       </wing>