acctelemetry

package module
v0.0.0-...-b99bf47 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2025 License: MIT Imports: 8 Imported by: 0

README

acctelemetry-go

Simple Go library to read Assetto Corsa Competizione telemetry

Runs only on Windows!

How to use

ACC must be running. Otherwise, telemetry.Connect() will fail with an error.

Methods StaticPointer(), PhysicsPointer() and GraphicsPointer() returns pointer to shared memory, so data will change over time. It's up to client code to create snapshot of the data if they wish so.

RealtimeCarUpdate() is read from UDP broadcast and it returns instance of latest RealtimeCarUpdate state.

Example:

see examples/main.go

Configs:

see telemetry_config.go

Documentation

Index

Constants

View Source
const (
	REGISTER_COMMAND_APPLICATION   byte = 1
	UNREGISTER_COMMAND_APPLICATION byte = 9

	// we don't care about below types for reading the telemetry
	REQUEST_ENTRY_LIST           byte = 10
	REQUEST_TRACK_DATA           byte = 11
	CHANGE_HUD_PAGE              byte = 49
	CHANGE_FOCUS                 byte = 50
	INSTANT_REPLAY_REQUEST       byte = 51
	PLAY_MANUAL_REPLAY_HIGHLIGHT byte = 52
	SAVE_MANUAL_REPLAY_HIGHLIGHT byte = 60
)
View Source
const (
	REGISTRATION_RESULT byte = 1
	REALTIME_UPDATE     byte = 2
	REALTIME_CAR_UPDATE byte = 3

	// we don't care about below types for reading the telemetry
	ENTRY_LIST         byte = 4
	ENTRY_LIST_CAR     byte = 6
	TRACK_DATA         byte = 5
	BROADCASTING_EVENT byte = 7
)
View Source
const BROADCASTING_PROTOCOL_VERSION byte = 4
View Source
const GRAPHIS_FILE_MMAP = "Local\\acpmf_graphics"
View Source
const PHYSICS_FILE_MMAP = "Local\\acpmf_physics"
View Source
const STATIC_FILE_MMAP = "Local\\acpmf_static"

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() *accTelemetryConfig

func DefaultUdpConfig

func DefaultUdpConfig() *accTelemetryConfig

func UdpConfig

func UdpConfig(ipPort string, password string) *accTelemetryConfig

Types

type AccGraphic

type AccGraphic struct {
	PacketID                 int32
	ACStatus                 int32
	ACSessionType            int32
	CurrentTime              [15]uint16
	LastTime                 [15]uint16
	BestTime                 [15]uint16
	Split                    [15]uint16
	CompletedLaps            int32
	Position                 int32
	ICurrentTime             int32
	ILastTime                int32
	IBestTime                int32
	SessionTimeLeft          float32
	DistanceTraveled         float32
	IsInPit                  int32
	CurrentSectorIndex       int32
	LastSectorTime           int32
	NumberOfLaps             int32
	TyreCompound             [33]uint16
	ReplayTimeMultiplier     float32
	NormalizedCarPosition    float32
	ActiveCars               int32
	CarCoordinates           [60][3]float32
	CarID                    [60]int32
	PlayerCarID              int32
	PenaltyTime              float32
	Flag                     int32
	Penalty                  int32
	IdealLineOn              int32
	IsInPitLane              int32
	SurfaceGrip              float32
	MandatoryPitDone         int32
	WindSpeed                float32
	WindDirection            float32
	IsSetupMenuVisible       int32
	MainDisplayIndex         int32
	SecondaryDisplayIndex    int32
	TC                       int32
	TCCut                    int32
	EngineMap                int32
	ABS                      int32
	FuelXLap                 float32
	RainLights               int32
	FlashingLights           int32
	LightsStage              int32
	ExhaustTemperature       float32
	WiperLV                  int32
	DriverStintTotalTimeLeft int32
	DriverStintTimeLeft      int32
	RainTyres                int32
	SessionIndex             int32
	UsedFuel                 float32
	DeltaLapTime             [15]uint16
	IDeltaLapTime            int32
	EstimatedLapTime         [15]uint16
	IEstimatedLapTime        int32
	IsDeltaPositive          int32
	ISplit                   int32
	IsValidLap               int32
	FuelEstimatedLaps        float32
	TrackStatus              [33]uint16
	MissingMandatoryPits     int32
	Clock                    float32
	DirectionLightsLeft      int32
	DirectionLightsRight     int32
	GlobalYellow             int32
	GlobalYellow1            int32
	GlobalYellow2            int32
	GlobalYellow3            int32
	GlobalWhite              int32
	GlobalGreen              int32
	GlobalChequered          int32
	GlobalRed                int32
	MfdTyreSet               int32
	MfdFuelToAdd             float32
	MfdTyrePressureLF        float32
	MfdTyrePressureRF        float32
	MfdTyrePressureLR        float32
	MfdTyrePressureRR        float32
	TrackGripStatus          int32
	RainIntensity            int32
	RainIntensityIn10min     int32
	RainIntensityIn30min     int32
	CurrentTyreSet           int32
	StrategyTyreSet          int32
	GapAhead                 int32
	GapBehind                int32
}

type AccPhysics

type AccPhysics struct {
	PacketID            int32
	Gas                 float32
	Brake               float32
	Fuel                float32
	Gear                int32
	RPMs                int32
	SteerAngle          float32
	SpeedKmh            float32
	Velocity            [3]float32
	AccG                [3]float32
	WheelSlip           [4]float32
	WheelLoad           [4]float32
	WheelsPressure      [4]float32
	WheelAngularSpeed   [4]float32
	TyreWear            [4]float32
	TyreDirtyLevel      [4]float32
	TyreCoreTemperature [4]float32
	CamberRAD           [4]float32
	SuspensionTravel    [4]float32
	DRS                 float32
	TC                  float32
	Heading             float32
	Pitch               float32
	Roll                float32
	CGHeight            float32
	CarDamage           [5]float32
	NumberOfTyresOut    int32
	PitLimiterOn        int32
	ABS                 float32
	KersCharge          float32
	KersInput           float32
	AutoShifterOn       int32
	RideHeight          [2]float32
	TurboBoost          float32
	Ballast             float32
	AirDensity          float32
	AirTemp             float32
	RoadTemp            float32
	LocalAngularVel     [3]float32
	FinalFF             float32
	PerformanceMeter    float32
	EngineBrake         int32
	ERSRecoveryLevel    int32
	ERSPowerLevel       int32
	ERSHeatCharging     int32
	ERSIsCharging       int32
	KersCurrentKJ       float32
	DRSAvailable        int32
	DRSEnabled          int32
	BrakeTemp           [4]float32
	Clutch              float32
	TyreTempI           [4]float32
	TyreTempM           [4]float32
	TyreTempO           [4]float32
	IsAIControlled      int32
	TyreContactPoint    [4][3]float32
	TyreContactNormal   [4][3]float32
	TyreContactHeading  [4][3]float32
	BrakeBias           float32
	LocalVelocity       [3]float32
	P2PActivations      int32
	P2PStatus           int32
	CurrentMaxRPM       int32
	MZ                  [4]float32
	FX                  [4]float32
	FY                  [4]float32
	SlipRatio           [4]float32
	SlipAngle           [4]float32
	TCInAction          int32
	ABSInAction         int32
	SuspensionDamage    [4]float32
	TyreTemp            [4]float32
	WaterTemp           float32
	BrakePressure       [4]float32
	FrontBrakeCompound  int32
	RearBrakeCompound   int32
	PadLife             [4]float32
	DiscLife            [4]float32
	Ignition            int32
	StartEngineOn       int32
	IsEngineRunning     int32
	KerbVibration       float32
	SlipVibrations      float32
	GVibrations         float32
	AbsVibrations       float32
}

type AccStatic

type AccStatic struct {
	SmVersion              [15]uint16
	AcVersion              [15]uint16
	NumberOfSessions       int32
	NumCars                int32
	CarModel               [33]uint16
	Track                  [33]uint16
	PlayerName             [33]uint16
	PlayerSurname          [33]uint16
	PlayerNick             [33]uint16
	SectorCount            int32
	MaxTorque              float32
	MaxPower               float32
	MaxRpm                 int32
	MaxFuel                float32
	SuspensionMaxTravel    [4]float32
	TyreRadius             [4]float32
	MaxTurboBoost          [4]float32
	Deprecated1            float32
	Deprecated2            float32
	PenaltiesEnabled       int32
	AidFuelRate            float32
	AidTireRate            float32
	AidMechanicalDamage    float32
	AidAllowTyreBlankets   int32
	AidStability           float32
	AidAutoClutch          int32
	AidAutoBlip            int32
	HasDRS                 int32
	HasERS                 int32
	HasKERS                int32
	KersMaxJ               float32
	EngineBrakeSettingsCnt int32
	ErsPowerControllerCnt  int32
	TrackSplineLength      float32
	TrackConfiguration     [33]uint16
	ErsMaxJ                float32
	IsTimedRace            int32
	HasExtraLap            int32
	CarSkin                [33]uint16
	ReversedGridPositions  int32
	PitWindowStart         int32
	PitWindowEnd           int32
	IsOnline               int32
	DryTyresName           [33]uint16
	WetTyresName           [33]uint16
}

type AccTelemetry

type AccTelemetry struct {
	// contains filtered or unexported fields
}

func New

func New(config *accTelemetryConfig) *AccTelemetry

func (*AccTelemetry) Close

func (t *AccTelemetry) Close() error

func (*AccTelemetry) Connect

func (t *AccTelemetry) Connect() error

func (*AccTelemetry) GraphicsPointer

func (t *AccTelemetry) GraphicsPointer() *AccGraphic

this returns direct pointer to the memory so underlying struct will change over time

func (*AccTelemetry) PhysicsPointer

func (t *AccTelemetry) PhysicsPointer() *AccPhysics

this returns direct pointer to the memory so underlying struct will change over time

func (*AccTelemetry) RealtimeCarUpdate

func (t *AccTelemetry) RealtimeCarUpdate() *RealtimeCarUpdate

returns what is current RealtimeCarUpdate

func (*AccTelemetry) StaticPointer

func (t *AccTelemetry) StaticPointer() *AccStatic

this returns direct pointer to the memory so underlying struct will change over time

type LapInfo

type LapInfo struct {
	LaptimeMs      int32
	CarIndex       uint16
	DriverIndex    uint16
	SplitCount     byte
	Splits         [8]int32 // let's assume no track will have more than 8 splits (all should have 3...)
	IsInvalid      byte
	InValidForBest byte
	IsOutlap       byte
	IsInlaop       byte
}

type RealtimeCarUpdate

type RealtimeCarUpdate struct {
	CarIndex              uint16
	DriverIndex           uint16
	DriverCount           byte
	Gear                  byte
	WorldPosX             float32
	WorldPosY             float32
	Yaw                   float32
	CarLocation           byte // 0=NONE, 1=TRACK, 2=PITLANE, 3=PITENTRY, 4=PITEXIT
	Kmh                   uint16
	Position              uint16
	CupPosition           uint16
	TrackPosition         uint16
	TrackRelativePosition float32
	Laps                  uint16
	Delta                 int32
	BestSessionLap        *LapInfo
	LastLap               *LapInfo
	CurrentLap            *LapInfo
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL