TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
car.cpp
Go to the documentation of this file.
1/***************************************************************************
2
3 file : car.cpp
4 created : Sun Mar 19 00:05:43 CET 2000
5 copyright : (C) 2000-2017 by Eric Espie, Bernhard Wymann
6 email : torcs@free.fr
7 version : $Id$
8
9 ***************************************************************************/
10
11/***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
19
20
21
22#include <stdio.h>
23
24#include "sim.h"
25
26const tdble aMax = 1.04f; // 60 degrees DOF limit
27
28void
30{
31 void *hdle = car->params;
32 tdble k;
33 tdble w;
34 tdble gcfrl, gcrrl, gcfr;
35 tdble wf0, wr0;
36 tdble overallwidth;
37 int i;
38 tCarElt *carElt = car->carElt;
39
40 car->dimension.x = GfParmGetNum(hdle, SECT_CAR, PRM_LEN, (char*)NULL, 4.7f);
41 car->dimension.y = GfParmGetNum(hdle, SECT_CAR, PRM_WIDTH, (char*)NULL, 1.9f);
42 overallwidth = GfParmGetNum(hdle, SECT_CAR, PRM_OVERALLWIDTH, (char*)NULL, car->dimension.y);
43 car->dimension.z = GfParmGetNum(hdle, SECT_CAR, PRM_HEIGHT, (char*)NULL, 1.2f);
44 car->mass = GfParmGetNum(hdle, SECT_CAR, PRM_MASS, (char*)NULL, 1500);
45 car->Minv = 1.0 / car->mass;
46 gcfr = GfParmGetNum(hdle, SECT_CAR, PRM_FRWEIGHTREP, (char*)NULL, .5);
47 gcfrl = GfParmGetNum(hdle, SECT_CAR, PRM_FRLWEIGHTREP, (char*)NULL, .5);
48 gcrrl = GfParmGetNum(hdle, SECT_CAR, PRM_RRLWEIGHTREP, (char*)NULL, .5);
49 car->statGC.y = - (gcfr * gcfrl + (1 - gcfr) * gcrrl) * car->dimension.y + car->dimension.y / 2.0;
50 car->statGC.z = GfParmGetNum(hdle, SECT_CAR, PRM_GCHEIGHT, (char*)NULL, .5);
51
52 car->tank = GfParmGetNum(hdle, SECT_CAR, PRM_TANK, (char*)NULL, 80);
53 car->fuel = GfParmGetNum(hdle, SECT_CAR, PRM_FUEL, (char*)NULL, 80);
54 k = GfParmGetNum(hdle, SECT_CAR, PRM_CENTR, (char*)NULL, 1.0);
55 carElt->_drvPos_x = GfParmGetNum(hdle, SECT_DRIVER, PRM_XPOS, (char*)NULL, 0.0);
56 carElt->_drvPos_y = GfParmGetNum(hdle, SECT_DRIVER, PRM_YPOS, (char*)NULL, 0.0);
57 carElt->_drvPos_z = GfParmGetNum(hdle, SECT_DRIVER, PRM_ZPOS, (char*)NULL, 0.0);
58 carElt->_bonnetPos_x = GfParmGetNum(hdle, SECT_BONNET, PRM_XPOS, (char*)NULL, carElt->_drvPos_x);
59 carElt->_bonnetPos_y = GfParmGetNum(hdle, SECT_BONNET, PRM_YPOS, (char*)NULL, carElt->_drvPos_y);
60 carElt->_bonnetPos_z = GfParmGetNum(hdle, SECT_BONNET, PRM_ZPOS, (char*)NULL, carElt->_drvPos_z);
61
62 if (car->fuel > car->tank) {
63 car->fuel = car->tank;
64 }
65 k = k * k;
66 car->Iinv.x = 12.0 / (car->mass * (car->dimension.y * car->dimension.y + car->dimension.z * car->dimension.z));
67 car->Iinv.y = 12.0 / (car->mass * (car->dimension.x * car->dimension.x + car->dimension.z * car->dimension.z));
68 car->Iinv.z = 12.0 / (car->mass * (car->dimension.y * car->dimension.y + k * car->dimension.x * car->dimension.x));
69
70 /* configure components */
71 w = car->mass * G;
72
73 wf0 = w * gcfr;
74 wr0 = w * (1 - gcfr);
75
76 car->wheel[FRNT_RGT].weight0 = wf0 * gcfrl;
77 car->wheel[FRNT_LFT].weight0 = wf0 * (1 - gcfrl);
78 car->wheel[REAR_RGT].weight0 = wr0 * gcrrl;
79 car->wheel[REAR_LFT].weight0 = wr0 * (1 - gcrrl);
80
81 for (i = 0; i < 2; i++) {
82 SimAxleConfig(car, i);
83 }
84
85 for (i = 0; i < 4; i++) {
86 SimWheelConfig(car, i);
87 }
88
89 /* Set the origin to GC */
90 car->wheelbase = car->wheeltrack = 0;
91 car->statGC.x = car->wheel[FRNT_RGT].staticPos.x * gcfr + car->wheel[REAR_RGT].staticPos.x * (1 - gcfr);
92
94 SimEngineConfig(car);
96 SimSteerConfig(car);
98 SimAeroConfig(car);
99 for (i = 0; i < 2; i++) {
100 SimWingConfig(car, i);
101 }
102
103 carElt->_dimension = car->dimension;
104 carElt->_statGC = car->statGC;
105 carElt->_tank = car->tank;
106 for (i = 0; i < 4; i++) {
107 carElt->priv.wheel[i].relPos = car->wheel[i].relPos;
108 }
109
110 for (i = 0; i < 4; i++) {
111 car->wheel[i].staticPos.x -= car->statGC.x;
112 car->wheel[i].staticPos.y -= car->statGC.y;
113 }
114 car->wheelbase = (car->wheel[FRNT_RGT].staticPos.x
115 + car->wheel[FRNT_LFT].staticPos.x
116 - car->wheel[REAR_RGT].staticPos.x
117 - car->wheel[REAR_LFT].staticPos.x) / 2.0;
118 car->wheeltrack = (-car->wheel[REAR_LFT].staticPos.y
119 - car->wheel[FRNT_LFT].staticPos.y
120 + car->wheel[FRNT_RGT].staticPos.y
121 + car->wheel[REAR_RGT].staticPos.y) / 2.0;
122
123 /* set corners pos */
124 car->corner[FRNT_RGT].pos.x = car->dimension.x * .5 - car->statGC.x;
125 car->corner[FRNT_RGT].pos.y = - overallwidth * .5 - car->statGC.y;
126 car->corner[FRNT_RGT].pos.z = 0;
127
128 car->corner[FRNT_LFT].pos.x = car->dimension.x * .5 - car->statGC.x;
129 car->corner[FRNT_LFT].pos.y = overallwidth * .5 - car->statGC.y;
130 car->corner[FRNT_LFT].pos.z = 0;
131
132 car->corner[REAR_RGT].pos.x = - car->dimension.x * .5 - car->statGC.x;
133 car->corner[REAR_RGT].pos.y = - overallwidth * .5 - car->statGC.y;
134 car->corner[REAR_RGT].pos.z = 0;
135
136 car->corner[REAR_LFT].pos.x = - car->dimension.x * .5 - car->statGC.x;
137 car->corner[REAR_LFT].pos.y = overallwidth * .5 - car->statGC.y;
138 car->corner[REAR_LFT].pos.z = 0;
139}
140
141
142static void
144{
145 tForces F;
146 int i;
147 tdble m, w, minv;
148 tdble v, R, Rv, Rm, Rx, Ry, Rz;
149
150 car->preDynGC = car->DynGCg;
151
152 /* total mass */
153 m = car->mass + car->fuel;
154 minv = 1.0 / m;
155 w = -m * G;
156
157 /* Weight */
158 sgMat4 dst;
159 sgMakeRotMat4(dst, RAD2DEG(car->DynGC.pos.az), RAD2DEG(car->DynGC.pos.ax), RAD2DEG(car->DynGC.pos.ay));
160 sgMat4 dstInv;
161 sgTransposeNegateMat4(dstInv, dst);
162 sgVec3 weight = {0.0f, 0.0f, w};
163 sgXformVec3(weight, dstInv);
164 F.F.x = weight[SG_X];
165 F.F.y = weight[SG_Y];
166 F.F.z = weight[SG_Z];
167
168 F.M.x = F.M.y = F.M.z = 0;
169
170 /* Wheels */
171 for (i = 0; i < 4; i++) {
172 tWheel* wheel = &(car->wheel[i]);
173
174 /* forces */
175 F.F.x += wheel->forces.x;
176 F.F.y += wheel->forces.y;
177 F.F.z += wheel->forces.z;
178
179 /* moments */
180 F.M.x += wheel->forces.z * wheel->staticPos.y +
181 wheel->forces.y * wheel->rollCenter;
182 // Eventually TODO: activate fix below and make all cars/robots fit.
183 //car->wheel[i].forces.y * (car->statGC.z + car->wheel[i].rideHeight);
184 F.M.y -= wheel->forces.z * wheel->staticPos.x +
185 wheel->forces.x * (car->statGC.z + wheel->rideHeight);
186 F.M.z += -wheel->forces.x * wheel->staticPos.y +
187 wheel->forces.y * wheel->staticPos.x;
188 }
189
190 /* Aero Drag */
191 F.F.x += car->aero.drag;
192
193 /* Wings & Aero Downforce */
194 for (i = 0; i < 2; i++) {
195 /* forces */
196 F.F.z += car->wing[i].forces.z + car->aero.lift[i];
197 F.F.x += car->wing[i].forces.x;
198 /* moments */
199 F.M.y -= car->wing[i].forces.z * car->wing[i].staticPos.x + car->wing[i].forces.x * car->wing[i].staticPos.z;
200 F.M.y -= car->aero.lift[i] * (car->axle[i].xpos - car->statGC.x);
201 }
202
203 /* Rolling Resistance */
204 v = car->speed;
205 R = 0.0f;
206 for (i = 0; i < 4; i++) {
207 R += car->wheel[i].rollRes;
208 }
209 if (v > 0.00001f) {
210 Rv = R / v;
211 if ((Rv * minv * SimDeltaTime) > v) {
212 Rv = v * m / SimDeltaTime;
213 }
214 } else {
215 Rv = 0.0f;
216 }
217 Rx = Rv * car->DynGC.vel.x;
218 Ry = Rv * car->DynGC.vel.y;
219 Rz = Rv * car->DynGC.vel.z;
220
221 if ((R * car->wheelbase / 2.0 * car->Iinv.z) > fabs(car->DynGCg.vel.az)) {
222 Rm = car->DynGCg.vel.az / car->Iinv.z;
223 } else {
224 Rm = SIGN(car->DynGCg.vel.az) * R * car->wheelbase / 2.0;
225 }
226
227 /* compute accelerations */
228 car->DynGC.acc.x = (F.F.x - Rx) * minv;
229 car->DynGC.acc.y = (F.F.y - Ry) * minv;
230 car->DynGC.acc.z = (F.F.z - Rz) * minv;
231
232 sgVec3 accel = {car->DynGC.acc.x, car->DynGC.acc.y, car->DynGC.acc.z};
233 sgXformVec3(accel, dst);
234
235 car->DynGCg.acc.x = accel[SG_X];
236 car->DynGCg.acc.y = accel[SG_Y];
237 car->DynGCg.acc.z = accel[SG_Z];
238
239 car->DynGCg.acc.ax = car->DynGC.acc.ax = F.M.x * car->Iinv.x;
240 car->DynGCg.acc.ay = car->DynGC.acc.ay = F.M.y * car->Iinv.y;
241 car->DynGCg.acc.az = car->DynGC.acc.az = (F.M.z - Rm) * car->Iinv.z;
242}
243
244static void
246{
247 car->DynGCg.vel.x += car->DynGCg.acc.x * SimDeltaTime;
248 car->DynGCg.vel.y += car->DynGCg.acc.y * SimDeltaTime;
249 car->DynGCg.vel.z += car->DynGCg.acc.z * SimDeltaTime;
250
251 car->DynGCg.vel.ax += car->DynGCg.acc.ax * SimDeltaTime;
252 car->DynGCg.vel.ay += car->DynGCg.acc.ay * SimDeltaTime;
253 car->DynGCg.vel.az += car->DynGCg.acc.az * SimDeltaTime;
254
255 /* spin limitation */
256 if (fabs(car->DynGCg.vel.az) > 9.0) {
257 car->DynGCg.vel.az = SIGN(car->DynGCg.vel.az) * 9.0;
258 }
259
260 car->DynGC.vel.ax = car->DynGCg.vel.ax;
261 car->DynGC.vel.ay = car->DynGCg.vel.ay;
262 car->DynGC.vel.az = car->DynGCg.vel.az;
263
264 sgMat4 dst;
265 sgMakeRotMat4(dst, RAD2DEG(car->DynGC.pos.az), RAD2DEG(car->DynGC.pos.ax), RAD2DEG(car->DynGC.pos.ay));
266 sgTransposeNegateMat4(dst);
267 sgVec3 vel;
268 sgXformVec3(vel, (float *) &(car->DynGCg.vel), dst);
269 car->DynGC.vel.x = vel[SG_X];
270 car->DynGC.vel.y = vel[SG_Y];
271 car->DynGC.vel.z = vel[SG_Z];
272}
273
274void
276{
277 sgMat4 dst;
278 sgMakeRotMat4(dst, RAD2DEG(car->DynGC.pos.az), RAD2DEG(car->DynGC.pos.ax), RAD2DEG(car->DynGC.pos.ay));
279
280 int i;
281
282 /* Wheels data */
283 for (i = 0; i < 4; i++) {
284 tWheel* wheel = &(car->wheel[i]);
285 sgVec3 dstVec;
286 sgXformVec3(dstVec, (float *) &(wheel->staticPos.x), dst);
287
288 wheel->worldPosX = car->worldPosX + dstVec[0];
289 wheel->worldPosY = car->worldPosY + dstVec[1];
290 wheel->worldPosZ = car->DynGCg.pos.z + dstVec[2];
291
292 wheel->bodyVel.x = car->DynGC.vel.x - car->DynGC.vel.az * car->wheel[i].staticPos.y;
293 wheel->bodyVel.y = car->DynGC.vel.y + car->DynGC.vel.az * car->wheel[i].staticPos.x;
294 }
295}
296
297static void
299{
300 tdble vx, vy;
301
302 vx = car->DynGCg.vel.x;
303 vy = car->DynGCg.vel.y;
304
305 /* Preserve sub-float movement at large world coordinates while retaining
306 * corrections applied directly to DynGCg by the collision code. */
307 car->worldPosX += (double)car->DynGCg.pos.x - car->publishedPosX;
308 car->worldPosY += (double)car->DynGCg.pos.y - car->publishedPosY;
309 car->worldPosX += (double)vx * SimDeltaTime;
310 car->worldPosY += (double)vy * SimDeltaTime;
311 car->DynGCg.pos.x = (tdble)car->worldPosX;
312 car->DynGCg.pos.y = (tdble)car->worldPosY;
313 car->publishedPosX = car->DynGCg.pos.x;
314 car->publishedPosY = car->DynGCg.pos.y;
315 car->DynGCg.pos.z += car->DynGCg.vel.z * SimDeltaTime;
316
317 car->DynGCg.pos.ax += car->DynGCg.vel.ax * SimDeltaTime;
318 car->DynGCg.pos.ay += car->DynGCg.vel.ay * SimDeltaTime;
319 car->DynGCg.pos.az += car->DynGCg.vel.az * SimDeltaTime;
320
321 NORM_PI_PI(car->DynGCg.pos.az);
322
323 if (car->DynGCg.pos.ax > aMax) car->DynGCg.pos.ax = aMax;
324 if (car->DynGCg.pos.ax < -aMax) car->DynGCg.pos.ax = -aMax;
325 if (car->DynGCg.pos.ay > aMax) car->DynGCg.pos.ay = aMax;
326 if (car->DynGCg.pos.ay < -aMax) car->DynGCg.pos.ay = -aMax;
327
328 car->DynGC.pos.x = car->DynGCg.pos.x;
329 car->DynGC.pos.y = car->DynGCg.pos.y;
330 car->DynGC.pos.z = car->DynGCg.pos.z;
331
332 car->DynGC.pos.ax = car->DynGCg.pos.ax;
333 car->DynGC.pos.ay = car->DynGCg.pos.ay;
334 car->DynGC.pos.az = car->DynGCg.pos.az;
335
337}
338
339static void
341{
342 sgMat4 dst;
343 sgMakeRotMat4(dst, RAD2DEG(car->DynGC.pos.az), RAD2DEG(car->DynGC.pos.ax), RAD2DEG(car->DynGC.pos.ay));
344
345 tdble Cosz = car->Cosz;
346 tdble Sinz = car->Sinz;
347 int i;
348
349 for (i = 0; i < 4; i++) {
350 tPosd* corner = &(car->corner[i].pos);
351 sgVec3 localPos;
352
353 localPos[0] = corner->x + car->statGC.x;
354 localPos[1] = corner->y + car->statGC.y;
355 localPos[2] = corner->z - car->statGC.z;
356
357 sgVec3 dstVec;
358 sgXformVec3(dstVec, localPos, dst);
359
360 car->corner[i].pos.ax = car->DynGCg.pos.x + dstVec[0];
361 car->corner[i].pos.ay = car->DynGCg.pos.y + dstVec[1];
362 car->corner[i].pos.az = car->DynGCg.pos.z + dstVec[2];
363
364 /* add the body rotation to the corner */
365 /* the speed is vel.az * r */
366 /* where r = sqrt(x*x + y*y) */
367 /* the tangent vector is -y / r and x / r */
368 // compute corner velocity at local frame
369 car->corner[i].vel.ax = - car->DynGC.vel.az * localPos[1];
370 car->corner[i].vel.ay = car->DynGC.vel.az * localPos[0];
371 car->corner[i].vel.az = car->DynGC.vel.ax * localPos[1] - car->DynGC.vel.ay * localPos[0];
372
373 // rotate to global and add global center of mass velocity
374 // note: global to local.
375 car->corner[i].vel.x = car->DynGCg.vel.x
376 + car->corner[i].vel.ax * Cosz - car->corner[i].vel.ay * Sinz;
377 car->corner[i].vel.y = car->DynGCg.vel.y
378 + car->corner[i].vel.ax * Sinz + car->corner[i].vel.ay * Cosz;
379 car->corner[i].vel.z = car->DynGCg.vel.z + car->corner[i].vel.az;
380
381 // add local center of mass velocity
382 car->corner[i].vel.ax += car->DynGC.vel.x;
383 car->corner[i].vel.ay += car->DynGC.vel.y;
384 car->corner[i].vel.az += car->DynGC.vel.z;
385 }
386}
387
388void
390{
391 int i;
392 tdble Fzf, Fzr;
393
394 printf("-----------------------------\nCar: %d %s ---\n", car->carElt->index, car->carElt->_name);
395 printf("Seg: %d (%s) Ts:%f Tr:%f\n",
396 car->trkPos.seg->id, car->trkPos.seg->name, car->trkPos.toStart, car->trkPos.toRight);
397 printf("---\nMx: %f My: %f Mz: %f (N/m)\n", car->DynGC.acc.ax, car->DynGC.acc.ay, car->DynGC.acc.az);
398 printf("Wx: %f Wy: %f Wz: %f (rad/s)\n", car->DynGC.vel.ax, car->DynGC.vel.ay, car->DynGC.vel.az);
399 printf("Ax: %f Ay: %f Az: %f (rad)\n", car->DynGCg.pos.ax, car->DynGCg.pos.ay, car->DynGCg.pos.az);
400 printf("---\nAx: %f Ay: %f Az: %f (Gs)\n", car->DynGC.acc.x/9.81, car->DynGC.acc.y/9.81, car->DynGC.acc.z/9.81);
401 printf("Vx: %f Vy: %f Vz: %f (m/s)\n", car->DynGC.vel.x, car->DynGC.vel.y, car->DynGC.vel.z);
402 printf("Px: %f Py: %f Pz: %f (m)\n---\n", car->DynGCg.pos.x, car->DynGCg.pos.y, car->DynGCg.pos.z);
403 printf("As: %f\n---\n", sqrt(car->airSpeed2));
404 for (i = 0; i < 4; i++) {
405 printf("wheel %d - RH:%f susp:%f zr:%.2f ", i, car->wheel[i].rideHeight, car->wheel[i].susp.x, car->wheel[i].zRoad);
406 printf("sx:%f sa:%f w:%f ", car->wheel[i].sx, car->wheel[i].sa, car->wheel[i].spinVel);
407 printf("fx:%f fy:%f fz:%f\n", car->wheel[i].forces.x, car->wheel[i].forces.y, car->wheel[i].forces.z);
408 }
409 Fzf = (car->aero.lift[0] + car->wing[0].forces.z) / 9.81;
410 Fzr = (car->aero.lift[1] + car->wing[1].forces.z) / 9.81;
411 printf("Aero Fx:%f Fz:%f Fzf=%f Fzr=%f ratio=%f\n", car->aero.drag / 9.81, Fzf + Fzr,
412 Fzf, Fzr, (Fzf + Fzr) / (car->aero.drag + 0.1) * 9.81);
413
414}
415
416void
418{
420 CHECK(car);
422 CHECK(car);
424 CHECK(car);
425 SimCarUpdatePos(car);
426 CHECK(car);
427 SimCarCollideZ(car);
428 CHECK(car);
430 CHECK(car);
431 car->speed = sqrt(car->DynGC.vel.x*car->DynGC.vel.x + car->DynGC.vel.y*car->DynGC.vel.y + car->DynGC.vel.z*car->DynGC.vel.z);
432}
433
434void
436{
437 if (SimTelemetry == car->carElt->index) SimTelemetryOut(car);
438}
439
void SimWingConfig(tCar *car, int index)
Definition aero.cpp:110
void SimAeroConfig(tCar *car)
Definition aero.cpp:23
void SimAtmosphereConfig(tCar *car)
void SimAxleConfig(tCar *car, int index)
Definition axle.cpp:23
void SimBrakeSystemConfig(tCar *car)
Definition brake.cpp:48
static void SimCarUpdateSpeed(tCar *car)
Definition car.cpp:245
static void SimCarUpdateCornerPos(tCar *car)
Definition car.cpp:340
void SimCarUpdateWheelPos(tCar *car)
Definition car.cpp:275
static void SimCarUpdatePos(tCar *car)
Definition car.cpp:298
static void SimCarUpdateForces(tCar *car)
Definition car.cpp:143
void SimCarConfig(tCar *car)
Definition car.cpp:29
void SimTelemetryOut(tCar *car)
Definition car.cpp:389
const tdble aMax
Definition car.cpp:26
void SimCarUpdate2(tCar *car, tSituation *)
Definition car.cpp:435
void SimCarUpdate(tCar *car, tSituation *)
Definition car.cpp:417
#define PRM_HEIGHT
Definition car.h:520
#define PRM_TANK
Definition car.h:526
#define PRM_YPOS
Definition car.h:569
#define PRM_OVERALLWIDTH
Definition car.h:519
#define SECT_BONNET
Definition car.h:509
#define PRM_CENTR
Definition car.h:528
#define FRNT_RGT
front right
Definition car.h:38
#define PRM_WIDTH
Definition car.h:517
#define SECT_DRIVER
Definition car.h:508
#define REAR_RGT
rear right
Definition car.h:40
#define REAR_LFT
rear left
Definition car.h:41
#define PRM_FRLWEIGHTREP
Definition car.h:523
#define SECT_CAR
Definition car.h:477
#define PRM_RRLWEIGHTREP
Definition car.h:524
#define PRM_ZPOS
Definition car.h:570
struct CarElt tCarElt
Car structure (tCarElt).
#define FRNT_LFT
front left
Definition car.h:39
#define PRM_MASS
Definition car.h:521
#define PRM_FUEL
Definition car.h:527
#define PRM_LEN
Definition car.h:516
#define PRM_GCHEIGHT
Definition car.h:525
#define PRM_XPOS
Definition car.h:568
#define PRM_FRWEIGHTREP
Definition car.h:522
#define CHECK(_car_)
Definition carstruct.h:149
void SimCarCollideXYScene(tCar *car)
Definition collide.cpp:101
void SimCarCollideZ(tCar *car)
Definition collide.cpp:25
void SimEngineConfig(tCar *car)
Definition engine.cpp:23
float tdble
Floating point type used in TORCS.
Definition tgf.h:47
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
Definition params.cpp:2534
void RtTrackGlobal2LocalD(tTrackSeg *segment, double X, double Y, tTrkLocPos *p, int type)
Convert global coordinates to a local track position using double intermediates.
Definition rttrack.cpp:276
struct Situation tSituation
cars situation used to inform the GUI and the drivers
void SimWheelConfig(tCar *car, int index)
Definition wheel.cpp:26
int SimTelemetry
Definition simu.cpp:36
void SimSteerConfig(tCar *car)
Definition steer.cpp:21
tdble SimDeltaTime
Definition simu.cpp:35
void SimTransmissionConfig(tCar *car)
tPrivCar priv
private
Definition car.h:463
int index
car index
Definition car.h:459
tdble x
Definition susp.h:52
tdble y
y coordinate
Definition tgf.h:116
tdble z
z coordinate
Definition tgf.h:117
tdble x
x coordinate
Definition tgf.h:115
tdble lift[2]
Definition aero.h:27
tdble drag
Definition aero.h:26
tdble xpos
Definition axle.h:29
tdble fuel
Definition carstruct.h:63
tAxle axle[2]
Definition carstruct.h:45
tWheel wheel[4]
Definition carstruct.h:46
tWing wing[2]
Definition carstruct.h:50
t3Dd dimension
Definition carstruct.h:55
tDynPt DynGCg
Definition carstruct.h:65
tAero aero
Definition carstruct.h:49
tdble publishedPosX
Definition carstruct.h:68
t3Dd Iinv
Definition carstruct.h:60
tdble wheeltrack
Definition carstruct.h:83
t3Dd statGC
Definition carstruct.h:59
void * params
Definition carstruct.h:39
tCarElt * carElt
Definition carstruct.h:40
tdble Sinz
Definition carstruct.h:77
double worldPosX
Definition carstruct.h:66
tdble airSpeed2
Definition carstruct.h:73
tdble speed
Definition carstruct.h:92
tDynPt DynGC
Definition carstruct.h:64
tdble publishedPosY
Definition carstruct.h:69
tdble wheelbase
Definition carstruct.h:82
tTrkLocPos trkPos
Definition carstruct.h:72
tDynPt corner[4]
Definition carstruct.h:78
tdble tank
Definition carstruct.h:58
double worldPosY
Definition carstruct.h:67
tdble Cosz
Definition carstruct.h:76
tdble Minv
Definition carstruct.h:57
tDynPt preDynGC
Definition carstruct.h:71
tdble mass
Definition carstruct.h:56
tPosd acc
acceleration
Definition tgf.h:145
tPosd vel
velocity
Definition tgf.h:144
tPosd pos
position
Definition tgf.h:143
Forces and moments.
Definition tgf.h:150
t3Dd F
Forces.
Definition tgf.h:151
t3Dd M
Moments.
Definition tgf.h:152
6 DOF position.
Definition tgf.h:129
tdble y
y coordinate
Definition tgf.h:131
tdble x
x coordinate
Definition tgf.h:130
tdble z
z coordinate
Definition tgf.h:132
tdble ay
angle along y axis
Definition tgf.h:134
tdble ax
angle along x axis
Definition tgf.h:133
tdble az
angle along z axis
Definition tgf.h:135
tWheelState wheel[4]
Definition car.h:292
tdble toRight
Distance (+ to left, - to right) relative to the right side of segment.
Definition track.h:447
tTrackSeg * seg
Track segment.
Definition track.h:435
tdble toStart
Distance to start of segment (or arc if turn)
Definition track.h:446
Definition wheel.h:26
tdble rollRes
Definition wheel.h:34
double worldPosX
Definition wheel.h:37
tdble sa
Definition wheel.h:54
double worldPosY
Definition wheel.h:38
t3Dd forces
Definition wheel.h:33
tPosd staticPos
Definition wheel.h:59
tSuspension susp
Definition wheel.h:29
tdble sx
Definition wheel.h:55
tdble rideHeight
Definition wheel.h:35
tdble worldPosZ
Definition wheel.h:39
tdble spinVel
Definition wheel.h:45
tPosd relPos
Definition wheel.h:53
tdble weight0
Definition wheel.h:63
tdble rollCenter
Definition wheel.h:61
t3Dd bodyVel
Definition wheel.h:40
tdble zRoad
Definition wheel.h:36
tPosd relPos
position relative to GC
Definition car.h:252
t3Dd forces
Definition aero.h:39
t3Dd staticPos
Definition aero.h:45
int id
Segment number.
Definition track.h:295
const char * name
Segment name.
Definition track.h:294
const tdble G
m/s/s
Definition tgf.h:69
#define NORM_PI_PI(x)
Angle normalization between -PI and PI.
Definition tgf.h:87
#define SIGN(x)
Sign of the expression.
Definition tgf.h:77
#define RAD2DEG(x)
Radian to degree conversion.
Definition tgf.h:74
#define TR_LPOS_MAIN
Relative to the main segment, mostly used for racing on the main track.
Definition track.h:442