-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacsys.py
48 lines (32 loc) · 2.15 KB
/
acsys.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import math
# glBegin parameters
class GL:Lines,LineStrip,Triangles,Quads=range(4)
# getCarSate parameters
class CS:SpeedMS,SpeedMPH,SpeedKMH,Gas,Brake,Clutch,Gear,Aero,BestLap,CamberRad,AccG,CGHeight,DriftBestLap,DriftLastLap,DriftPoints,DriveTrainSpeed,DY,RPM,Load,InstantDrift,IsDriftInvalid,IsEngineLimiterOn,LapCount,LapInvalidated,LapTime,LastFF,LastLap,LocalAngularVelocity,LocalVelocity,Mz,NdSlip,NormalizedSplinePosition,PerformanceMeter,SlipAngle,SlipAngleContactPatch,SlipRatio,SpeedTotal,Steer,SuspensionTravel,TurboBoost,TyreDirtyLevel,TyreContactNormal,TyreContactPoint,TyreHeadingVector,TyreLoadedRadius,TyreRadius,TyreRightVector,TyreSlip,TyreSurfaceDef,TyreVelocity,Velocity,WheelAngularSpeed,WorldPosition,Caster,CurrentTyresCoreTemp,LastTyresTemp,DynamicPressure,RideHeight,ToeInDeg,CamberDeg,KersCharge,KersInput,DrsAvailable,DrsEnabled,EngineBrake,ERSRecovery,ERSDelivery,ERSHeatCharging,ERSCurrentKJ,ERSMaxJ,RaceFinished, P2PStatus, P2PActivations = range(73)
# Using ac.getCarState with the following paramters :
# TyreContactPoint, TyreContactNormal, TyreHeadingVector, TyreRightVector
# It is necessary to specify the tyre identifier as third parameter:
class WHEELS:FL,FR,RL,RR=range(4)
# The call will have the following syntax:
# ac.getCarState(<CAR_ID>,TyreContactPoint,<WHEEL_IDENTIFIER>)
# if no wheel identifier is specified WHEELS.FL is assumed
# Using ac.getCarState with Aero parameter it is necessary to specify
# as third parameter, if no AERO parameter is provided, CD is assumed
class AERO:CD,CL_Front,CL_Rear=range(3)
#For setCameraMode and gerCameraMode
class CM:Cockpit,Car,Drivable,Track,Helicopter,OnBoardFree,Free,Random,ImageGeneratorCamera,Start = range(10)
############# MATH ############
class Vec2f:
def __init__(self,x=0,y=0):
self.x=float(x)
self.y=float(y)
def __add__(self,other):
return Vec2f(self.x+other.x , self.y + other.y)
def __sub__(self,other):
return Vec2f(self.x-other.x , self.y - other.y)
def normalize(self):
l=math.sqrt(self.x*self.x + self.y*self.y)
self.x/=l
self.y/=l
def __mul__(self,val):
return Vec2f(self.x * val , self.y*val)