Skip to content

Go library for handling the F1 2017 UDP telemetry

License

Notifications You must be signed in to change notification settings

smt923/f1telemetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

f1telemetry

Go library for using the F1 2017 UDP telemetry, based on their post here

Usage

For the most simple and probably unoptimal usage, you can call ListenForTelemetryPackets with an ip:port and a channel of TelemetryPacket to receive telemetry data as it's delivered:

packets := make(chan t.TelemetryPacket)
t.ListenForTelemetryPackets("127.0.0.1:20777", packets)

for {
	packet := <-packets
	fmt.Printf("[Speed: %.02fmph | Engine RPM: %.02f, Engine temp: %.02fc]\n",
		packet.GetSpeedMPH(),
		packet.EngineRate,
		packet.EngineTemperature,
	)
}

For more advanced or generalized use, you can use ParseBytesToPacket on each packet (as a []byte) that you receive from your own UDP handling to receive a TelemetryPacket struct from your original packet

There are some helper methods and consts to make dealings with some of the data a little easier (TyresTemperature[FrontLeft] instead of remembering that front left is 2, and methods such as GetTrackName())

Notes

I kept as close to the Codemasters naming while sticking to Go conventions, this means "m_speed" becomes "Speed", however I kept the UK spelling of things such as "Tyre" to conform to what Codemasters own documentation says (link at the top of this readme)

About

Go library for handling the F1 2017 UDP telemetry

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages