Documentation ¶
Index ¶
- Constants
- func CloseAllStubs(groups []StubGroup) error
- func DiscardSetupItems[k comparable](setupItems map[CarSetupKey]k, filters ...SetupFilter) map[CarSetupKey]k
- func FilterSetupItems[k comparable](setupItems map[CarSetupKey]k, filters ...SetupFilter) map[CarSetupKey]k
- func GetTickValue[T TickValueType](tick Tick, key string) (T, error)
- func Process(ctx context.Context, stubs StubGroup, processors ...Processor) error
- type CarSetup
- type CarSetupComparison
- type CarSetupComparisonItem
- type CarSetupDetails
- type CarSetupItem
- type CarSetupItemParsedValue
- type CarSetupKey
- type CarSetupKeys
- type Parser
- type Processor
- type SetupFilter
- type Stub
- type StubGroup
- type StubGroupGrouping
- type Tick
- type TickValueType
Constants ¶
const ( // Number of times the setup has been modified UPDATE_COUNT_FIELD_NAME string = "UpdateCount" )
Variables ¶
This section is empty.
Functions ¶
func CloseAllStubs ¶
func DiscardSetupItems ¶
func DiscardSetupItems[k comparable](setupItems map[CarSetupKey]k, filters ...SetupFilter) map[CarSetupKey]k
DiscardSetupItems removes the given categories, subcategories, and/or items.
func FilterSetupItems ¶
func FilterSetupItems[k comparable](setupItems map[CarSetupKey]k, filters ...SetupFilter) map[CarSetupKey]k
FilterSetupItems for only the given categories, subcategories, and items.
func GetTickValue ¶
func GetTickValue[T TickValueType](tick Tick, key string) (T, error)
GetTickValue will retrieve and type assert the given variable.
Types ¶
type CarSetup ¶
type CarSetup struct { Name string Update int Values CarSetupDetails }
CarSetup is the overarching structure to represent the setup of a car.
func ParseCarSetup ¶
ParseCarSetup from the given session info
type CarSetupComparison ¶
type CarSetupComparison map[CarSetupKey]*CarSetupComparisonItem
CarSetupComparison is the overarching structure for storing the difference between two CarSetups.
func CompareSetups ¶
func CompareSetups(s1, s2 *CarSetup) CarSetupComparison
CompareSetups will compare the differences between the two given setups
func (CarSetupComparison) Differences ¶
func (c CarSetupComparison) Differences() map[CarSetupKey]*CarSetupComparisonItem
Differences between the two CarSetups that were compared
type CarSetupComparisonItem ¶
type CarSetupComparisonItem struct { I1 *CarSetupItem I2 *CarSetupItem NumericalDifferences []float64 RawDifference string // contains filtered or unexported fields }
CarSetupComparisonItem is the comparison of a single item from the two compared setups
func CompareSetupItemParsedValue ¶
func CompareSetupItemParsedValue(i1, i2 *CarSetupItem) CarSetupComparisonItem
CompareSetupItemParsedValue compares the parsed values of each setup item.
If a parsed item is not found in one or either of the items, the raw value comparison will be the only populated field
type CarSetupDetails ¶
type CarSetupDetails map[CarSetupKey]*CarSetupItem
CarSetupDetails is the structure for storing the individual items that make up a car setup.
Example: The front right tyre pressure for the given setup will be 128 PSI.
func (CarSetupDetails) Add ¶
func (s CarSetupDetails) Add(category, subcategory, itemName string, value *CarSetupItem)
Add a new setup item for the specified category and subcategory
type CarSetupItem ¶
type CarSetupItem struct { RawValue string Parsed []CarSetupItemParsedValue }
CarSetupItem is the raw and parsed values of a single car setup item.
func (*CarSetupItem) IsParsed ¶
func (c *CarSetupItem) IsParsed() bool
IsParsed determines if the given CarSetupItem has any parsed numerical values
type CarSetupItemParsedValue ¶
type CarSetupItemParsedValue struct { NumericalValue float64 NumericalSign int MeasurementUnit string }
CarSetupItemParsedValue is a detailed numerical value of a single car setup item.
Parsed items will refer only to numerical values. Additionally, the sign of the numeric value will be preserved for cases where + / - is applicable. For example, some cars might have +3 clicks of wing, rather than just 3 clicks.
func ParseSetupItem ¶
func ParseSetupItem(input string) []CarSetupItemParsedValue
ParseSetupItem attempts to parse a numerical value from the given setup item.
This function returns a slice due to some setup items consisting of multiple values.
For example: Tire pressures will contain 3 independent values for inner, outer, and carcass temperatures.
type CarSetupKey ¶
type CarSetupKey string
CarSetupKey refers to the map key used when storing CarSetupItems.
A CarSetupKey should ideally be created using the NewCarSetupKey function. This eliminates any risk with deconstructing it to find specific values, such as category, subcategory, and item name.
This key consists of the category, subcategory and item name.
For example:
Category | SubCategory | Item Name
DriveBrake|BrakeSystemConfig|BaseBrakeBias
func NewCarSetupKey ¶
func NewCarSetupKey(category, subcategory, itemName string) CarSetupKey
NewCarSetupKey initialises a new CarSetupKey value
func (CarSetupKey) Category ¶
func (csk CarSetupKey) Category() string
Category part of the given CarSetupKey
func (CarSetupKey) ItemName ¶
func (csk CarSetupKey) ItemName() string
ItemName part of the given CarSetupKey
func (CarSetupKey) SubCategory ¶
func (csk CarSetupKey) SubCategory() string
SubCategory part of the given CarSetupKey
type CarSetupKeys ¶
type CarSetupKeys []CarSetupKey
CarSetupKeys are multiple CarSetupKey values
This structure primarily exists for sorting purposes
func (CarSetupKeys) Len ¶
func (a CarSetupKeys) Len() int
func (CarSetupKeys) Less ¶
func (a CarSetupKeys) Less(i, j int) bool
func (CarSetupKeys) Swap ¶
func (a CarSetupKeys) Swap(i, j int)
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is used to iterate and process telemetry variables for a given ibt file and it's headers.
func NewParser ¶
NewParser creates a new parser from a given ibt file, it's headers, and a variable whitelist.
reader - Opened ibt file.
header - Parsed headers of ibt file.
whitelist - Variables to process. For example, "gear", "speed", "rpm" etc. If no values or a single value of "*" is received, all variables will be processed.
func (*Parser) Next ¶
Next parses and returns the next tick of telemetry variables and whether it can be called again.
A return of false will indicate that the buffer has reached the end. If the buffer has reached the end and Next() is called again, a nil and false will be returned. Additionally, a check can be done to check if the returned Tick is nil to determine if the EOF was reached.
Should expected variable values be missing, please ensure that they are added to the Parser whitelist.
func (*Parser) ParseAt ¶
ParseAt the given buffer offset and return a processed tick.
ParseAt is useful if a specific offset is known. An example would be the telemetry variable buffers that are provided during live telemetry parsing.
When nil is returned, the buffer has reached EOF.
func (*Parser) UpdateWhitelist ¶
UpdateWhitelist replaces the current whitelist with the given fields
type SetupFilter ¶
SetupFilter is used to filter a CarSetup or CarSetupComparison for specific categories, subcategories and/or items.
Prefixes can be used instead of specifying full categories, subcategories, and/or item names.
Fields that are not populated will be ignored during equality checks.
func (SetupFilter) Compare ¶
func (s SetupFilter) Compare(key CarSetupKey) bool
Compare determines if SetupFilter contains all of the populated filter fields
type Stub ¶
type Stub struct {
// contains filtered or unexported fields
}
Stub represents the headers and filename parsed from an ibt file.
Stubs are used for initial parsing of ibt files and their metadata. This can be useful to make decisions regarding which files should have their telemetry parsed.
func (*Stub) DriverIdx ¶
DriverIdx is the index of the current driver.
This value is useful when parsing telemetry or session info where the index of the driver is required.
type StubGroup ¶
type StubGroup []Stub
StubGroup is a grouping of stubs.
This group is not necessarily part of the same session, but can be grouped with Group().
func ParseStubs ¶
ParseStubs will create a stub for each of the given files by parsing their headers.
type StubGroupGrouping ¶
type StubGroupGrouping []StubGroup
StubGroupGrouping is just a group of StubGroups.
func (StubGroupGrouping) Len ¶
func (a StubGroupGrouping) Len() int
func (StubGroupGrouping) Less ¶
func (a StubGroupGrouping) Less(i, j int) bool
func (StubGroupGrouping) Swap ¶
func (a StubGroupGrouping) Swap(i, j int)
Directories ¶
Path | Synopsis |
---|---|
Package headers provides the utilities for parsing and interacting with the ibt header objects.
|
Package headers provides the utilities for parsing and interacting with the ibt header objects. |
fifo
Package fifo provides FIFO (First In, First Out) fixed-size storage structures.
|
Package fifo provides FIFO (First In, First Out) fixed-size storage structures. |