3.5 Advanced BrakingIntroductionThis section is about braking with aerodynamic forces. Because we have aerodynamic downforce and drag we will be able to brake later. That was also the reason of the brake "flickering" on high speeds. Because more energy is absorbed than we expect, we reach the goal speed too early, so we stop braking. A moment later we are again too fast, and need to brake again, and so on... Don't run away because of the scary formulas, they are not too hard to understand. Braking Distance
|
![]() |
Computing Drag Coefficient CWYou can see that we need to compute an additional coefficient. It's quite similar to the computation of the wingca in initCa(...), so here it is, put it in driver.cpp: /* Compute aerodynamic drag coefficient CW */ void Driver::initCw() { float cx = GfParmGetNum(car->_carHandle, SECT_AERODYNAMICS, PRM_CX, (char*) NULL, 0.0); float frontarea = GfParmGetNum(car->_carHandle, SECT_AERODYNAMICS, PRM_FRNTAREA, (char*) NULL, 0.0); CW = 0.645*cx*frontarea; } You need to define initCw() and CW also in driver.h: void initCw(); float CW; /* aerodynamic drag coefficient */ Add the call of initCw() at the end of newRace(...) in driver.cpp: initCw(); Implementing the new FormulaReplace the following line in getBrake(), driver.cpp float brakedist = (currentspeedsqr - allowedspeedsqr) / (2.0*mu*G); with float brakedist = mass*(currentspeedsqr - allowedspeedsqr) / (2.0*(mu*G*mass + allowedspeedsqr*(CA*mu + CW))); Take a Ride
|
Good NewsI finally found an analytic solution. Look it up here. DownloadsIn case you got lost, you can download my robot for TORCS 1.2.0 or later. Summary
|
Back |
Traction control, anti wheel locking, ... |