f1gopherlib

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

README

F1Gopher Lib

A library for understanding and using the session data from Formula1.com writtein in Go.

There is an example GUI and command line client for the library:

Features

  • Supports data for all live sessions (pre-season testing, practice, qualifying, sprint and race)
  • Supports replays of all session from 2018 and onward
  • Live session can be paused and skipped forward to the live time
  • Replay sessions can be paused and skipped through
  • Provides data for:
    • Timing
    • Location on track
    • Car telemetry
    • Race control messages
    • Team radio messages (audio)
    • Weather

Data

Timing
  • Current driver position and starting position
  • Team color, name, abbreviated name, team for drivers
  • Segment times
  • Sector times (is personal or overall fastest)
  • Last lap time (is personal or overall fastest)
  • Current tire and laps on the tire
  • Location (on track, outlap, pitlane, stopped...)
  • Safety car status
  • Track status (red flag, green flag...)
  • Current lap and total number of laps
  • Session time remaining
  • Is DRS enabled
  • Gap to the fastest time and gap to car infront
  • Pitstop times
  • Speed trap
Location on Track
  • X, Y, Z co-ordinate locations for all cars
  • Includes safety car when active
Car Telemetry
  • Six channels of telemetry for every car:
    • Throttle %
    • Brake %
    • RPM
    • Gear
    • Speed
    • DRS
Race Control Messages
  • Full text and timestamp for all race control messages
Team Radio
  • The mp3 audio for each message and the driver talking
Weather
  • Whether it is raining
  • Air temperature
  • Track temperature
  • Wind speed
  • Wind direction
  • Air pressure
  • Humidity

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HappeningSessions added in v1.0.0

func HappeningSessions() (liveSession RaceEvent, nextSession RaceEvent, hasLiveSession bool, hasNextSession bool)

func SetLogOutput

func SetLogOutput(w io.Writer)

Types

type F1GopherLib

type F1GopherLib interface {
	Name() string
	Session() Messages.SessionType
	CircuitTimezone() *time.Location
	SessionStart() time.Time
	Track() string
	TrackYear() int
	TimeLostInPitlane() time.Duration

	Weather() <-chan Messages.Weather
	RaceControlMessages() <-chan Messages.RaceControlMessage
	Timing() <-chan Messages.Timing
	Event() <-chan Messages.Event
	Telemetry() <-chan Messages.Telemetry
	Location() <-chan Messages.Location
	Time() <-chan Messages.EventTime
	Radio() <-chan Messages.Radio
	Drivers() <-chan Messages.Drivers

	SelectTelemetrySources(drivers []int)

	IncrementLap()
	IncrementTime(duration time.Duration)
	SkipToSessionStart()
	TogglePause()
	IsPaused() bool

	Close()
}

func CreateDebugReplay added in v1.0.0

func CreateDebugReplay(
	requestedData parser.DataSource,
	replayFile string,
	dataFlow flowControl.FlowType) (F1GopherLib, error)

func CreateLive

func CreateLive(requestedData parser.DataSource, archive string, cache string) (F1GopherLib, error)

func CreateReplay

func CreateReplay(
	requestedData parser.DataSource,
	event RaceEvent,
	cache string,
	dataFlow flowControl.FlowType) (F1GopherLib, error)

type RaceEvent

type RaceEvent struct {
	Country   string
	RaceTime  time.Time
	EventTime time.Time
	Type      Messages.SessionType
	Name      string

	TrackName         string
	TrackYearCreated  int
	TimeLostInPitlane time.Duration
	// contains filtered or unexported fields
}

func CreateRaceEvent

func CreateRaceEvent(
	country string,
	raceTime time.Time,
	eventTime time.Time,
	sessionType Messages.SessionType,
	name string,
	track string,
	trackYearCreated int,
	pitlaneTime time.Duration,
	urlName string,
	timezone string) *RaceEvent

func RaceHistory

func RaceHistory() []RaceEvent

func (*RaceEvent) Timezone

func (r *RaceEvent) Timezone() *time.Location

func (*RaceEvent) Url

func (r *RaceEvent) Url() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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