From 6debe1ecd9aa054ac0a3b805e34775149907222c Mon Sep 17 00:00:00 2001 From: wdbee Date: Sun, 8 Feb 2009 19:31:34 +0000 Subject: [PATCH] Bugfixes git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@727 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: c17cacb31203dca272c14a2ad027ec84051d1e25 Former-commit-id: 0b684725a7c997bef2bc6af955641b6e364cfb3b --- .../simplix/simplix_36GP/tracks/aalborg.xml | 11 +++++++ .../simplix/simplix_36GP/tracks/g-track-3.xml | 7 +++-- src/drivers/simplix/src/unitclothoid.cpp | 9 +++--- src/drivers/simplix/src/unitclothoid.h | 6 ++-- src/drivers/simplix/src/unitdriver.cpp | 29 +++++++++++-------- src/drivers/simplix/src/unitdriver.h | 1 + src/drivers/simplix/src/unitglobal.h | 6 +++- src/drivers/simplix/src/unittrack.cpp | 10 ++----- 8 files changed, 50 insertions(+), 29 deletions(-) diff --git a/src/drivers/simplix/simplix_36GP/tracks/aalborg.xml b/src/drivers/simplix/simplix_36GP/tracks/aalborg.xml index ae66fecb1..e6b6f5ec1 100644 --- a/src/drivers/simplix/simplix_36GP/tracks/aalborg.xml +++ b/src/drivers/simplix/simplix_36GP/tracks/aalborg.xml @@ -12,6 +12,17 @@
+ + + + + + + + + + + diff --git a/src/drivers/simplix/simplix_36GP/tracks/g-track-3.xml b/src/drivers/simplix/simplix_36GP/tracks/g-track-3.xml index 0eb6c3ff8..3f67cdfd8 100644 --- a/src/drivers/simplix/simplix_36GP/tracks/g-track-3.xml +++ b/src/drivers/simplix/simplix_36GP/tracks/g-track-3.xml @@ -2,8 +2,8 @@ @@ -12,6 +12,9 @@
+ + + diff --git a/src/drivers/simplix/src/unitclothoid.cpp b/src/drivers/simplix/src/unitclothoid.cpp index 3085286fa..f27357a27 100644 --- a/src/drivers/simplix/src/unitclothoid.cpp +++ b/src/drivers/simplix/src/unitclothoid.cpp @@ -9,8 +9,8 @@ // // File : unitclothoid.cpp // Created : 2007.11.25 -// Last changed : 2008.12.21 -// Copyright : © 2007-2008 Wolf-Dieter Beelitz +// Last changed : 2009.02.08 +// Copyright : © 2007-2009 Wolf-Dieter Beelitz // eMail : wdb@wdbee.de // Version : 2.00.000 //--------------------------------------------------------------------------* @@ -115,10 +115,11 @@ void TClothoidLane::MakeSmoothPath( //GfOut("Step: %d\n",Step); for (int I = 0; I < L; I++) { - OptimisePath(Step, Delta, 0 /*, Opts.Smooth*/); + OptimisePath(Step, Delta, 0); } Step >>= 1; } + if (Opts.BumpMod) { //GfOut("AnalyseBumps:\n"); @@ -132,7 +133,7 @@ void TClothoidLane::MakeSmoothPath( //GfOut("Step: %d\n",Step); for (int I = 0; I < L; I++) { - OptimisePath(Step, Delta, Opts.BumpMod /*, Opts.Smooth*/); + OptimisePath(Step, Delta, Opts.BumpMod); CalcCurvaturesZ(); CalcFwdAbsCrv(FwdRange); CalcMaxSpeeds(Step); diff --git a/src/drivers/simplix/src/unitclothoid.h b/src/drivers/simplix/src/unitclothoid.h index 7de955c6b..138f7b5bc 100644 --- a/src/drivers/simplix/src/unitclothoid.h +++ b/src/drivers/simplix/src/unitclothoid.h @@ -7,8 +7,8 @@ // // Datei : unitclothoid.h // Erstellt : 2007.11.17 -// Stand : 2008.12.19 -// Copyright: © 2007-2008 Wolf-Dieter Beelitz +// Last changed : 2009.02.08 +// Copyright: © 2007-2009 Wolf-Dieter Beelitz // eMail : wdb@wdbee.de // Version : 2.00.000 //--------------------------------------------------------------------------* @@ -106,7 +106,7 @@ class TClothoidLane : public TLane /* const TParam& Param, */ const TOptions& Opts); - bool SaveToFile(const char* Filename); // Save to file + bool SaveToFile(const char* Filename); // Save to file void SavePointsToFile(const char* TrackLoad); bool LoadPointsFromFile(const char* TrackLoad); diff --git a/src/drivers/simplix/src/unitdriver.cpp b/src/drivers/simplix/src/unitdriver.cpp index 8a1b42c18..ec328cb52 100644 --- a/src/drivers/simplix/src/unitdriver.cpp +++ b/src/drivers/simplix/src/unitdriver.cpp @@ -298,7 +298,8 @@ TDriver::TDriver(int Index): oSpeedScale(0.0), oTreatTeamMateAsLapper(false), oTeamEnabled(true), - oCarsPerPit(1) + oCarsPerPit(1), + oBumpMode(1) { // GfOut("#TDriver::TDriver() >>>\n"); int I; @@ -534,6 +535,8 @@ void TDriver::InitTrack snprintf(Buf,sizeof(Buf),"%s/tracks/%s.xml", BaseParamPath,oTrackName); Handle = TUtils::MergeParamFile(Handle,Buf); + double ScaleBrake = GfParmGetNum(Handle,TDriver::SECT_PRIV,PRV_SCALE__BRAKE,NULL,1.0f); + double ScaleMu = GfParmGetNum(Handle,TDriver::SECT_PRIV,PRV_SCALE__MU,NULL,1.0f); // Override params for car type with params of track snprintf(Buf,sizeof(Buf),"%s/%s/%s.xml", @@ -652,10 +655,12 @@ void TDriver::InitTrack // ... Adjust pitting // Adjust driving ... - Param.oCarParam.oScaleBrake = + Param.oCarParam.oScaleBrake = ScaleBrake * GfParmGetNum(Handle,TDriver::SECT_PRIV,PRV_SCALE_BRAKE,NULL,0.85f); GfOut("#Scale Brake: %g\n",Param.oCarParam.oScaleBrake); + oBumpMode = + GfParmGetNum(Handle,TDriver::SECT_PRIV,PRV_BUMP_MODE,NULL,oBumpMode); Param.oCarParam.oScaleBump = GfParmGetNum(Handle,TDriver::SECT_PRIV,PRV_SCALE_BUMP,NULL,Param.oCarParam.oScaleBump); Param.oCarParam.oScaleBumpLeft = @@ -668,7 +673,7 @@ void TDriver::InitTrack GfParmGetNum(Handle,TDriver::SECT_PRIV,PRV_SCALE_BUMPOUTER,NULL,(float) Param.oCarParam.oScaleBump); GfOut("#Scale Bump Outer: %g\n",Param.oCarParam.oScaleBumpOuter); - Param.oCarParam.oScaleMu = + Param.oCarParam.oScaleMu = ScaleMu * GfParmGetNum(Handle,TDriver::SECT_PRIV,PRV_SCALE_MU,NULL,Param.oCarParam.oScaleMu); GfOut("#Scale Mu: %g\n",Param.oCarParam.oScaleMu); @@ -1112,31 +1117,31 @@ void TDriver::FindRacinglines() GfOut("# ... make smooth path ...\n"); oRacingLine[oRL_FREE].MakeSmoothPath // Calculate a smooth path (&oTrackDesc, Param, // as main racingline - TClothoidLane::TOptions(1)); + TClothoidLane::TOptions(oBumpMode)); } else if (oSituation->_raceType == RM_TYPE_QUALIF) { if (!oRacingLine[oRL_FREE].LoadSmoothPath // Load a smooth path (oTrackLoadQualify, &oTrackDesc, Param, // as main racingline - TClothoidLane::TOptions(1))) + TClothoidLane::TOptions(oBumpMode))) { GfOut("# ... make smooth path ...\n"); oRacingLine[oRL_FREE].MakeSmoothPath // Calculate a smooth path (&oTrackDesc, Param, // as main racingline - TClothoidLane::TOptions(1)); + TClothoidLane::TOptions(oBumpMode)); oRacingLine[oRL_FREE].SavePointsToFile(oTrackLoadQualify); } } else if (!oRacingLine[oRL_FREE].LoadSmoothPath // Load a smooth path (oTrackLoad, &oTrackDesc, Param, // as main racingline - TClothoidLane::TOptions(1))) + TClothoidLane::TOptions(oBumpMode))) { GfOut("# ... make smooth path ...\n"); oRacingLine[oRL_FREE].MakeSmoothPath // Calculate a smooth path (&oTrackDesc, Param, // as main racingline - TClothoidLane::TOptions(1)); + TClothoidLane::TOptions(oBumpMode)); //oRacingLine[oRL_FREE].SaveToFile("RL_FREE.tk3"); oRacingLine[oRL_FREE].SavePointsToFile(oTrackLoad); } @@ -1158,13 +1163,13 @@ void TDriver::FindRacinglines() if (!oRacingLine[oRL_LEFT].LoadSmoothPath // Load a smooth path (oTrackLoadLeft, &oTrackDesc, Param, // as avoid to left racingline - TClothoidLane::TOptions(1, FLT_MAX, -oAvoidWidth, true))) + TClothoidLane::TOptions(oBumpMode, FLT_MAX, -oAvoidWidth, true))) { GfOut("# ... make avoid path left ...\n"); oRacingLine[oRL_LEFT].MakeSmoothPath // Avoid to left racingline (&oTrackDesc, Param, - TClothoidLane::TOptions(1, FLT_MAX, -oAvoidWidth, true)); + TClothoidLane::TOptions(oBumpMode, FLT_MAX, -oAvoidWidth, true)); //oRacingLine[oRL_LEFT].SaveToFile("RL_LEFT.tk3"); oRacingLine[oRL_LEFT].SavePointsToFile(oTrackLoadLeft); } @@ -1177,13 +1182,13 @@ void TDriver::FindRacinglines() if (!oRacingLine[oRL_RIGHT].LoadSmoothPath // Load a smooth path (oTrackLoadRight, &oTrackDesc, Param, // as avoid to left racingline - TClothoidLane::TOptions(1, -oAvoidWidth, FLT_MAX, true))) + TClothoidLane::TOptions(oBumpMode, -oAvoidWidth, FLT_MAX, true))) { GfOut("# ... make avoid path right ...\n"); oRacingLine[oRL_RIGHT].MakeSmoothPath // Avoid to right racingline (&oTrackDesc, Param, - TClothoidLane::TOptions(1, -oAvoidWidth, FLT_MAX, true)); + TClothoidLane::TOptions(oBumpMode, -oAvoidWidth, FLT_MAX, true)); //oRacingLine[oRL_RIGHT].SaveToFile("RL_RIGHT.tk3"); oRacingLine[oRL_RIGHT].SavePointsToFile(oTrackLoadRight); } diff --git a/src/drivers/simplix/src/unitdriver.h b/src/drivers/simplix/src/unitdriver.h index 1a9a23deb..da094e2e4 100644 --- a/src/drivers/simplix/src/unitdriver.h +++ b/src/drivers/simplix/src/unitdriver.h @@ -347,6 +347,7 @@ private: bool oTreatTeamMateAsLapper; bool oTeamEnabled; int oCarsPerPit; // Pit sharing + float oBumpMode; // static int NBBOTS; // Nbr of cars static double CurrSimTime; // Current simulation time diff --git a/src/drivers/simplix/src/unitglobal.h b/src/drivers/simplix/src/unitglobal.h index 8b8e63169..37dd5ae62 100644 --- a/src/drivers/simplix/src/unitglobal.h +++ b/src/drivers/simplix/src/unitglobal.h @@ -375,10 +375,14 @@ enum #define PRV_PIT_BRAKE_DIST "pit brake dist" #define PRV_PIT_TEST_STOP "pit test stop" +#define PRV_BUMP_MODE "bump mode" // bump detection model + +#define PRV_SCALE__BRAKE "scale_brake" // Scale brake force #define PRV_SCALE_BRAKE "scale brake" // Scale brake force #define PRV_SCALE_BUMP "scale bump" // Scale bump detection inside #define PRV_SCALE_BUMPOUTER "scale bump outer" // Scale bump detection outside -#define PRV_SCALE_MU "scale mu" // Scale friction calculation +#define PRV_SCALE_MU "scale_mu" // Scale friction calculation +#define PRV_SCALE__MU "scale mu" // Scale friction calculation #define PRV_SCALE_FRICTION "scale friction" // Scale friction calculation #define PRV_SCALE_BRAKING "scale braking" // Scale brake calculation diff --git a/src/drivers/simplix/src/unittrack.cpp b/src/drivers/simplix/src/unittrack.cpp index 296612261..ce8355fa0 100644 --- a/src/drivers/simplix/src/unittrack.cpp +++ b/src/drivers/simplix/src/unittrack.cpp @@ -10,7 +10,7 @@ // // File : unittrack.cpp // Created : 2007.11.17 -// Last changed : 2009.01.17 +// Last changed : 2009.02.08 // Copyright : © 2007-2009 Wolf-Dieter Beelitz // eMail : wdb@wdbee.de // Version : 2.00.000 @@ -411,11 +411,11 @@ void TTrackDescription::InitTrack else // increase counter N++; // on straights - if (N > 10) // After 10 sections + if (N > 10) // After 10 sections LastSegType = LastSeg->type; // reset Seg = oSections[I].Seg; // Get torcs segment - //if (strncmp(Seg->name,"180",3) == 0) + //if (strncmp(Seg->name,"60",2) == 0) // GfOut("%s\n",Seg->name); double DistFromStart = // Distance from start @@ -498,10 +498,6 @@ void TTrackDescription::InitTrack WCurb = MIN(WCurb,1.5); // Keep two wheels on track Done = true; } - else - { - W = 0; - } } else if (PSide->style == TR_PLAN) // On plan {