- Update Shadow's driver
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6035 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: d6d0ffdeefc3499140518cad9bf707aebce8d801 Former-commit-id: deae99bb9f0fd8731cdb1506cffe275536c7209d
This commit is contained in:
parent
110efd1239
commit
f18b329e51
3 changed files with 46 additions and 1 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "CarModel.h"
|
||||
#include "Quadratic.h"
|
||||
#include "Utils.h"
|
||||
#include "Driver.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
|
@ -283,6 +284,14 @@ double CarModel::CalcBreaking(double k0, double kz0, double k1, double kz1, doub
|
|||
double Ftanroad = -sqrt(Froad * Froad - Flatroad * Flatroad) + Ftan;
|
||||
|
||||
double acc = Ftanroad / M;
|
||||
|
||||
if (TDriver::UseBrakeLimit)
|
||||
{
|
||||
double Radius = 1.0 / fabs(Kz);
|
||||
double factor = MIN(1.0,MAX(0.39, (Radius - 190.0) / 100.0));
|
||||
acc = MAX(acc, TDriver::BrakeLimit * factor);
|
||||
}
|
||||
|
||||
double inner = MX(0, v * v - 2 * acc * dist );
|
||||
double oldU = u;
|
||||
u = sqrt(inner);
|
||||
|
|
|
@ -189,12 +189,13 @@ TDriver::TDriver(int Index, const int robot_type):
|
|||
{
|
||||
case SHADOW_TRB1:
|
||||
robot_name = "shadow_trb1";
|
||||
TDriver::UseBrakeLimit = false;
|
||||
Frc = 0.95;
|
||||
break;
|
||||
|
||||
case SHADOW_SC:
|
||||
robot_name = "shadow_sc";
|
||||
Frc = 0.90;
|
||||
Frc = 0.85;
|
||||
break;
|
||||
|
||||
case SHADOW_SRW:
|
||||
|
@ -530,6 +531,8 @@ void TDriver::InitTrack( tTrack* pTrack, void* pCarHandle, void** ppCarParmHandl
|
|||
LogSHADOW.debug("FLY_HEIGHT %g\n", FLY_HEIGHT );
|
||||
LogSHADOW.debug( "BUMP_MOD %d\n", BUMP_MOD );
|
||||
|
||||
AdjustBrakes(hCarParm);
|
||||
|
||||
const char *enabling;
|
||||
|
||||
HasTYC = false;
|
||||
|
@ -2358,6 +2361,32 @@ void TDriver::initBrake()
|
|||
LogSHADOW.debug("\n#<<< Shadow2 Init Brake\n\n");
|
||||
}
|
||||
|
||||
//==========================================================================*
|
||||
|
||||
//==========================================================================*
|
||||
// Adjust brakes
|
||||
//--------------------------------------------------------------------------*
|
||||
void TDriver::AdjustBrakes(void *pCarHandle)
|
||||
{
|
||||
if ((TDriver::UseBrakeLimit) || (TDriver::UseGPBrakeLimit))
|
||||
{
|
||||
TDriver::BrakeLimit = GfParmGetNum(pCarHandle, SECT_PRIV, PRV_BRAKE_LIMIT, 0, (float) TDriver::BrakeLimit);
|
||||
LogSHADOW.debug("#BrakeLimit %g\n", TDriver::BrakeLimit);
|
||||
|
||||
TDriver::BrakeLimitBase = GfParmGetNum(pCarHandle, SECT_PRIV,PRV_BRAKE_LIMIT_BASE,0, (float) TDriver::BrakeLimitBase);
|
||||
LogSHADOW.debug("#BrakeLimitBase %g\n", TDriver::BrakeLimitBase);
|
||||
|
||||
TDriver::BrakeLimitScale = GfParmGetNum(pCarHandle, SECT_PRIV, PRV_BRAKE_LIMIT_SCALE, 0, (float) TDriver::BrakeLimitScale);
|
||||
LogSHADOW.debug("#BrakeLimitScale %g\n", TDriver::BrakeLimitScale);
|
||||
|
||||
TDriver::SpeedLimitBase = GfParmGetNum(pCarHandle, SECT_PRIV, PRV_SPEED_LIMIT_BASE, 0, (float) TDriver::SpeedLimitBase);
|
||||
LogSHADOW.debug("#SpeedLimitBase %g\n", TDriver::SpeedLimitBase);
|
||||
|
||||
TDriver::SpeedLimitScale = GfParmGetNum(pCarHandle, SECT_PRIV, PRV_SPEED_LIMIT_SCALE, 0, (float) TDriver::SpeedLimitScale);
|
||||
LogSHADOW.debug("#SpeedLimitScale %g\n", TDriver::SpeedLimitScale);
|
||||
}
|
||||
};
|
||||
|
||||
void TDriver::initCa()
|
||||
{
|
||||
LogSHADOW.debug("\n#Shadow Init InitCA >>>\n\n");
|
||||
|
|
|
@ -79,6 +79,11 @@
|
|||
#define PRV_NEED_SIN "use sin long"
|
||||
#define PRV_USED_ACC "acc exit"
|
||||
#define PRV_SKILL_OFFSET "offset skill"
|
||||
#define PRV_BRAKE_LIMIT "brake limit"
|
||||
#define PRV_BRAKE_LIMIT_BASE "brake limit base"
|
||||
#define PRV_BRAKE_LIMIT_SCALE "brake limit scale"
|
||||
#define PRV_SPEED_LIMIT_BASE "speed limit base"
|
||||
#define PRV_SPEED_LIMIT_SCALE "speed limit scale"
|
||||
|
||||
#define NBR_BRAKECOEFF 50 // Number of brake coeffs
|
||||
|
||||
|
@ -235,6 +240,8 @@ public:
|
|||
void CalcSkilling_shadow_LP1();
|
||||
|
||||
void AdjustSkilling(void* pCarHandle);
|
||||
void AdjustBrakes(void *pCarHandle);
|
||||
|
||||
void GetSkillingParameters(const char* BaseParamPath, const char* PathFilename);
|
||||
|
||||
double CalcFriction_shadow_Identity(double Crv);
|
||||
|
|
Loading…
Reference in a new issue