Documentation ¶
Overview ¶
Package laptimer provides tools for manipulating Harry's LapTimer hlptr files including from converting from TrackAddict.
Index ¶
- type Acceleration
- type AltitudeCoordinate
- type Coordinate
- type DB
- type Decoder
- type DifferentialStatus
- type DriveWheels
- type Duration
- type Encoder
- type EncoderOpt
- type EngineType
- type Fix
- type FixDate
- type FixType
- type Float
- type Float0dp
- type Float1dp
- type Float2dp
- type Gear
- type Gears
- type IntakeType
- type Intermediate
- type Intermediates
- type Lap
- type LapDate
- type LapRecordingType
- type OBD
- type PositionFixing
- type Positioning
- type Recording
- type RelativeToStart
- type SyncPoint
- type TPMS
- type TPMSTyre
- type Tags
- type Threshold
- type Tyre
- type TyrePosition
- type Vehicle
- type Vehicles
- type Video
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acceleration ¶
type Acceleration struct { // Source is the source of the acceleration measurement. Source int `xml:"source"` // TODO(steve): Use an enum. // Lateral is the lateral acceleration in G as a result of turning. Lateral Float2dp `xml:"lateral"` // Lineal is the lineal acceleration in G as a result of accelerating or braking. Lineal Float2dp `xml:"lineal"` // Coordinate GPS position for the red/yellow/green display of // lateral acceleration. Coordinate Coordinate `xml:"coordinate"` }
Acceleration represents the acceleration G values relative to driving direction. See the following for details: http://www.gps-laptimer.com/LapTimerDocumentation%20-%20Acceleration%20Chapter.pdf
type AltitudeCoordinate ¶
type AltitudeCoordinate struct { Coordinate `xml:"coordinate"` // Altitude is the distance above sea level in meters. Altitude float64 `xml:"altitude"` }
AltitudeCoordinate represents a GPS coordinate including altitude.
func (AltitudeCoordinate) MarshalXML ¶
func (c AltitudeCoordinate) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements xml.Marshaler.
func (*AltitudeCoordinate) UnmarshalXML ¶
func (c *AltitudeCoordinate) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements xml.Unmarshaler.
type Coordinate ¶
Coordinate represents a GPS coordinate without altitude.
func (Coordinate) MarshalXML ¶
func (c Coordinate) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements xml.Marshaler.
func (*Coordinate) UnmarshalXML ¶
func (c *Coordinate) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements xml.Unmarshaler.
type DB ¶
type DB struct { Name string `xml:"name"` Laps []Lap `xml:"lap"` // Vehicles being a slice with one vehicle per looks like a bug in LapTimer // but is currently how the data is exported by v24.6. Vehicles []Vehicles `xml:"vehicles,omitempty"` XMLName struct{} `xml:"LapTimerDB"` }
DB represents a Harry's LapTimer export including laps and vehicles.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder reads Harry's LapTimer xml data files.
func NewDecoder ¶
NewDecoder returns a fully initialised encoder which reads data from r.
type DifferentialStatus ¶
type DifferentialStatus int
DifferentialStatus indicates the status of differential GPS used for a Fix.
const ( // DifferentialStatusUnknown indicates the status is unknown. DifferentialStatusUnknown DifferentialStatus = iota // DifferentialStatus2D3D indicates either 2D or 3D is used typically // depending on the number of satellites 2D with three or fewer and 3D // with four or more. DifferentialStatus2D3D // DifferentialStatusDGPS indicates differential GPS is used. DifferentialStatusDGPS // DifferentialStatusInvalid indicates that status is invalid. DifferentialStatusInvalid )
type DriveWheels ¶
type DriveWheels string
DriveWheels represents the wheels which drive the vehicle.
const ( // FrontWheelDrive is used for vehicles which use front wheel drive only. FrontWheelDrive DriveWheels = "front" // RearWheelDrive is used for vehicles which use rear wheel drive only. RearWheelDrive DriveWheels = "rear" // AllWheelDrive is used for vehicles which drive all wheels. AllWheelDrive DriveWheels = "all" )
type Duration ¶
Duration represents a time duration.
func (Duration) MarshalXML ¶
MarshalXML implements xml.Marshaler.
func (*Duration) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder writes Harry's LapTimer xml data files.
func NewEncoder ¶
func NewEncoder(w io.Writer, options ...EncoderOpt) (*Encoder, error)
NewEncoder returns a fully initialised encoder which writes its output to w.
type EncoderOpt ¶
EncoderOpt represents an Encoder option.
type EngineType ¶
type EngineType string
EngineType represents the type of the engine powering the vehicle.
const ( // UnspecifiedEngine represents a unspecified engine type. UnspecifiedEngine EngineType = "" // Otto represents and engine with uses an Otto cycle, also // know as gasoline or petrol engine. Otto EngineType = "Otto" // Diesel represents an engine which runs on diesel. Diesel EngineType = "Diesel" // Electric represents an electric motor. Electric EngineType = "Electric" )
type Fix ¶
type Fix struct { // ID of the fix, this value isn't imported. ID int `xml:"index,attr"` // Date is the date time of the Fix. Date FixDate `xml:"date"` // Coordinate is the coordinate including altitude. Coordinate AltitudeCoordinate `xml:"coordinate"` // Speed is the vehicle speed based on GPS. Speed Float1dp `xml:"speed"` // Position indicates the state and method of the // GSP coordinates. Positioning Positioning `xml:"positioning"` // Satellites indicates how many satellites were visible. Satellites int `xml:"satellites"` // Direction indicates the direction of travel in degrees. Direction Float1dp `xml:"direction"` // Hdop is the GPS Horizontal Dilution of Precision. // 1: Ideal // 1-2: Excellent // 2-5: Good // 5-10: Moderate // 10-20: Fair // >20: Poor // Default to 1 as advised by Harry here: // http://forum.gps-laptimer.de/viewtopic.php?f=9&t=6134 Hdop Float2dp `xml:"hdop"` // Accuracy is the GPS accuracy in meters. // Typically either Hdop or Accuracy is specified but not both. Accuracy Float1dp `xml:"accuracy"` // RelativeToStart provides values relative to the start of the Lap. RelativeToStart RelativeToStart `xml:"relativeToStart"` // Acceleration provides acceleration relative to the // direction of travel. Acceleration *Acceleration `xml:"acceleration,omitempty"` // OBD provides OBD data if available and is // interpolated to GPS storage rate. OBD *OBD `xml:"obd,omitempty"` // TPMS provides tyre pressure monitoring data. TPMS *TPMS `xml:"tpms,omitempty"` }
Fix represents a single data entry for a Lap.
type FixDate ¶
FixDate represents the data and time of a Fix.
func (FixDate) MarshalXML ¶
MarshalXML implements xml.Marshaler.
func (*FixDate) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type Float ¶
type Float float64
Float represents a float that is output with 6 decimal places of precision.
func (Float) MarshalXML ¶
MarshalXML implements xml.Marshaler.
type Float0dp ¶
type Float0dp float64
Float0dp represents a float that is output with 0 decimal places of precision.
func (Float0dp) MarshalXML ¶
MarshalXML implements xml.Marshaler.
type Float1dp ¶
type Float1dp float64
Float1dp represents a float that is output with 1 decimal places of precision.
func (Float1dp) MarshalXML ¶
MarshalXML implements xml.Marshaler.
type Float2dp ¶
type Float2dp float64
Float2dp represents a float that is output with 2 decimal places of precision.
func (Float2dp) MarshalXML ¶
MarshalXML implements xml.Marshaler.
type Gear ¶
type Gear struct { // Number is the number of the gear. Number int `xml:"number"` // Ratio is the relationship between the engine's and the // gear box's RPM. Ratio float64 `xml:"ratio"` }
Gear represents an individual gear of a vehicle.
func (Gear) MarshalXML ¶
MarshalXML implements xml.Marshaler.
func (*Gear) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type Gears ¶
type Gears struct {
Gears []Gear `xml:"gear"`
}
Gears represents the set of gears for a vehicle.
type IntakeType ¶
type IntakeType string
IntakeType represents engine intake type.
const ( // UnspecifiedIntake represents a unspecified intake type. UnspecifiedIntake IntakeType = "" // NaturallyAspirated represents a naturally aspirated engine. NaturallyAspirated IntakeType = "Naturally Aspirated" // Turbocharged represents a turbocharged engine. Turbocharged IntakeType = "Turbocharged" // Supercharged represents a supercharged engine. Supercharged IntakeType = "Supercharged" )
type Intermediate ¶
type Intermediate struct { // Time is the time taken for the intermediate. Time Duration // Distance is the distance in meters for the intermediate. Distance float64 }
Intermediate represents a measured sub section of a Lap.
type Intermediates ¶
type Intermediates []Intermediate
Intermediates is a slice of Intermediate readings.
func (Intermediates) MarshalXML ¶
func (i Intermediates) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements xml.Marshaler.
func (*Intermediates) UnmarshalXML ¶
func (i *Intermediates) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements xml.Unmarshaler.
type Lap ¶
type Lap struct { ID int `xml:"index,attr"` Date LapDate `xml:"date"` LapTime Duration `xml:"lapTime"` Vehicle string `xml:"vehicle,omitempty"` Track string `xml:"track"` Intermediates Intermediates `xml:"intermediates,omitempty"` LapRecordingType LapRecordingType `xml:"lapRecordingType"` // OverallDistance should be same as distance in the last // Recording -> Fix -> RelativeToStart and is 2D only. OverallDistance Float1dp `xml:"overallDistance"` WeatherCondition int `xml:"weatherCondition,omitempty"` // TODO(steve): Use enum. AmbientTemp Float1dp `xml:"ambientTemp,omitempty"` AmbientPressure Float0dp `xml:"ambientPressure,omitempty"` // TODO(steve): Is this in hPa? RelativeHumidity Float2dp `xml:"relativeHumidity,omitempty"` // TODO(steve): Percentage? Videos []Video `xml:"video,omitempty"` Note string `xml:"note,omitempty"` Tags Tags `xml:"tags,omitempty"` Recording Recording `xml:"recording"` }
Lap represents a LapTimer lap.
type LapDate ¶
LapDate represents the data and time of a Fix.
func (LapDate) MarshalXML ¶
MarshalXML implements xml.Marshaler.
func (*LapDate) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type LapRecordingType ¶
type LapRecordingType int
LapRecordingType indicates the type of recording.
const ( // LapRecordingUnknown is used for old recordings with unknown // state or as null value. LapRecordingUnknown LapRecordingType = iota // LapRecordingManual indicates user triggered manual recording. LapRecordingManual // LapRecordingTriggered indicates fully triggered recording with // no information on status of track set used. LapRecordingTriggered // LapRecordingIncomplete is used for recordings with one end // triggered and the other manual (both situations happen). LapRecordingIncomplete )
type OBD ¶
type OBD struct { // EngineRPM is the RPM of the engine. EngineRPM *int `xml:"rpm,omitempty"` // MassAirFlow is mass air flow in grams per second. // If not defined map is required. MassAirFlow *Float2dp `xml:"maf,omitempty"` // VehicleSpeed in Kmh. // VSS: Vehicle Speed Sensor, WheelSpeed. VehicleSpeed *Float1dp `xml:"speed"` // Throttle is the throttle position in percentage as reported // by the Throttle Position Sensor (TPS). Throttle *Float2dp `xml:"throttle"` // FuelLevel in percentage. FuelLevel *Float2dp `xml:"fuelLevel,omitempty"` // CoolantTemp is the engine coolant temperature in Celsius as // reported by Engine Coolant Temperature (ECT). CoolantTemp *Float1dp `xml:"coolant,omitempty"` // OilTemp is the engine oil temperature in Celsius as // reported by Engine Oil Temperature (EOT). OilTemp *Float1dp `xml:"oil,omitempty"` // ManifoldAbsolutePressure is a pressure of the manifold as // reported by Manifold Absolute Pressure (MAP). // For turbo / super charged engines. ManifoldAbsolutePressure *Float2dp `xml:"map,omitempty"` // IntakeAirTemperature is the temperature in Celsius of // the air at the intake as reported by IAT. IntakeAirTemperature *Float0dp `xml:"iat,omitempty"` // Gear is the selected gear which may be calculated. Gear *int `xml:"gear,omitempty"` // OilPressure is the oil pressure in Bar not Kpa. OilPressure *float64 `xml:"oilp,omitempty"` // BrakePressure is the applied break pressure in Bar not Kpa. BrakePressure *float64 `xml:"brake,omitempty"` // WheelSpeedRearLeft is the speed in RPM of the rear left wheel. WheelSpeedRearLeft *float64 `xml:"speedrl,omitempty"` // WheelSpeedReadRight is the speed in RPM of the rear right wheel. WheelSpeedRearRight *float64 `xml:"speedrr,omitempty"` // WheelSpeedFrontLeft is the speed in RPM of the front left wheel. WheelSpeedFrontLeft *float64 `xml:"speedfl,omitempty"` // WheelSpeedFrontLeft is the speed in RPM of the front right wheel. WheelSpeedFrontRight *float64 `xml:"speedfr,omitempty"` // YawRate is the angular velocity of rotation. YawRate *float64 `xml:"yaw,omitempty"` // Odometer measures the distance moved in meters. Odometer *float64 `xml:"odometer,omitempty"` // SteerAngle is the angle of steering wheel in degrees. SteerAngle *float64 `xml:"steerangle,omitempty"` // SteerRate is the rate of steering wheel angle change. SteerRate *float64 `xml:"steerrate,omitempty"` // FixType TODO(steve): describe properly and check type. FixType *FixType `xml:"fixtype,omitempty"` // SupportLevel TODO(steve): describe properly and check type. SupportLevel *int `xml:"supportlevel,omitempty"` // DriverPower TODO(steve): describe properly. DriverPower *float64 `xml:"driverpower,omitempty"` // BatteryTemp is the temperature in Celsius of the battery. BatteryTemp *float64 `xml:"batterytemp,omitempty"` // BatteryVoltage is the voltage of battery. BatteryVoltage *float64 `xml:"voltage,omitempty"` // ConsumedPower TODO(steve): describe properly. ConsumedPower *float64 `xml:"consumedpower,omitempty"` }
OBD represents On-Board Diagnostics from a vehicle. Not all values are provided by all cars / sensors. Info from: http://forum.gps-laptimer.de/viewtopic.php?f=9&t=6134 All temperatures are in Celsius.
type PositionFixing ¶
type PositionFixing int
PositionFixing indicates the type of position fixing used for a Fix.
const ( // PositionFixingNoFix indicates an invalid fix. PositionFixingNoFix PositionFixing = iota // PositionFixing2D either a fix measured with a too small number of // satellites, or a triangulated fix. PositionFixing2D // PositionFixing3D indicates a standard measured fix. PositionFixing3D // PositionFixingVirtual2D3D unknown quality of a fix, mostly used // to signal a virtual (generated) fix. PositionFixingVirtual2D3D // PositionFixing2DIndoor position delivered by some (non-GPS) // indoor positioning system. PositionFixing2DIndoor )
type Positioning ¶
type Positioning struct { // DifferentialStatus identifies the differential GPS status of this Fix. DifferentialStatus DifferentialStatus `xml:"differentialstatus"` // PositionFixing identifies how the Fix was obtained. PositionFixing PositionFixing `xml:"positionfixing"` // Interpolated is true for any Fix calculated by LapTimer using // interpolation to approximate a trigger line has passed, false // if read directly from the GPS. Interpolated bool `xml:"interpolated"` }
Positioning represents the state of positioning information.
func (Positioning) MarshalXML ¶
func (p Positioning) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements xml.Marshaler.
func (*Positioning) UnmarshalXML ¶
func (p *Positioning) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements xml.Unmarshaler.
type Recording ¶
type Recording struct {
Fixes []Fix `xml:"fix"`
}
Recording represents the data recorded for a Lap.
type RelativeToStart ¶
type RelativeToStart struct { // Distance in meters in 2D only. Distance float64 `xml:"distance"` // Offset is the time since the start of the Lap. Offset Duration `xml:"offset"` }
RelativeToStart represents the time a distance relative to the start of the Lap.
func (RelativeToStart) MarshalXML ¶
func (r RelativeToStart) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements xml.Marshaler.
func (*RelativeToStart) UnmarshalXML ¶
func (r *RelativeToStart) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements xml.Unmarshaler.
type SyncPoint ¶
SyncPoint represents the time from the start of a video to sync.
func (SyncPoint) MarshalXML ¶
MarshalXML implements xml.Marshaler.
func (*SyncPoint) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type TPMS ¶
type TPMS struct {
Tyres []TPMSTyre `xml:"tire"`
}
TPMS represents Tyre Pressure Monitoring System data.
type TPMSTyre ¶
type TPMSTyre struct { Position TyrePosition `xml:"tirePosition"` Temperature Float1dp `xml:"temperatures"` }
TPMSTyre represents Tyre Pressure Monitoring System tyre.
type Tags ¶
type Tags []string
Tags represents the tags applied to a Lap.
func (Tags) MarshalXML ¶
MarshalXML implements xml.Marshaler.
func (*Tags) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type Threshold ¶
type Threshold int
Threshold represents shift gear threshold.
func (Threshold) MarshalXML ¶
MarshalXML implements xml.Marshaler.
func (*Threshold) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type Tyre ¶
type Tyre struct { // Width is the width of the tyre. Width int `xml:"width"` // Profile is the height of the sidewall as a percentage // of is width. Profile int `xml:"profile"` // Size is the diameter of the tyre in inches. Size int `xml:"size"` // SpeedRating is the speed rating for the tyre. SpeedRating string `xml:"speedrating"` }
Tyre represents a tyre specification.
func (Tyre) MarshalXML ¶
MarshalXML implements xml.Marshaler.
func (*Tyre) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type TyrePosition ¶
type TyrePosition int
TyrePosition represents a tyre position in TPMS monitoring.
const ( FrontLeft TyrePosition = 2 + iota FrontRight RearLeft RearRight )
TyrePosistions for TPMS.
type Vehicle ¶
type Vehicle struct { // Index is the index of the vehicle. Index int `xml:"index,attr"` // Name is the name of the Vehicle. Name string `xml:"name"` // PowerLoss is the total power loss in percentage. PowerLoss Float `xml:"powerloss,omitempty"` // DragCoefficient is the vehicles aerodynamic resistance. DragCoefficient Float `xml:"cW,omitempty"` // UnladenWeight is the curb weight in Kilograms including // fluids and fuel but not loaded with passengers or cargo. UnladenWeight Float `xml:"unladenWeight,omitempty"` // Payload is the carrying weight on top of curb weight made // up of passengers and cargo. Payload Float `xml:"payload,omitempty"` // GrossVehicleMass (GVM) is the maximum operating weight as // specified by the manufacturer. GrossVehicleMass Float `xml:"grossVehicleMass,omitempty"` // MaxTorqueRPM is the engine RPM at which maximum torque is // developed. MaxTorqueRPM int `xml:"maxTorqueRPM,omitempty"` // MaxTorque is maximum torque developed by the engine. MaxTorque int `xml:"maxTorque,omitempty"` // MaxPowerRPM is the engine RPM at which maximum power is // developed. MaxPowerRPM int `xml:"maxPowerRPM,omitempty"` // MaxPower is maximum power developed by the engine. MaxPower int `xml:"maxPower,omitempty"` // Vin is the Vehicle Identification Number. Vin string `xml:"vin,omitempty"` // Gears specifies the gears of the vehicle. Gears *Gears `xml:"gears,omitempty"` // DriveRatio is the relationship between the gear box's and // the axle's RPM. DriveRatio Float `xml:"driveRatio,omitempty"` // FrontWheel specifies the type of tyres used on the front wheels. FrontWheels *Tyre `xml:"frontWheels,omitempty"` // RearWheels specifies the type of tyres used on the rear wheels. RearWheels *Tyre `xml:"rearWheels,omitempty"` // DriveWheels specifies the wheels which drive the vehicle DriveWheels DriveWheels `xml:"driveWheels,omitempty"` // IntakeType specifies engine intake type. IntakeType IntakeType `xml:"intakeType,omitempty"` // EngineType specifies the type of the engine powering the vehicle. EngineType EngineType `xml:"engineType,omitempty"` // MaxRPM is the maximum RPM of the engine. MaxRPM int `xml:"maxRPM,omitempty"` // ShiftGearThreshold is the percentage of the engine max RPM at which // the Shift Gear Flash gets activated. ShiftGearThreshold Threshold `xml:"shiftGearThreshold,omitempty"` // VolumetricEfficiency is the efficiency in percentage with which // the engine can move charge into and out of its cylinders. VolumetricEfficiency int `xml:"volumetricEfficiency,omitempty"` // Displacement is the engine displacement in cubic centimetres. Displacement int `xml:"displacement,omitempty"` // TankVolume is the fuel take capacity including reserve. TankVolume Float `xml:"tankVolume,omitempty"` // Axles is the number of axles of the vehicle. Axles int `xml:"axles,omitempty"` // BodyWidth is the width of the vehicle excluding mirrors. BodyWidth int `xml:"bodyWidth,omitempty"` // BodyLength is the full length of the vehicle. BodyLength int `xml:"bodyLength,omitempty"` // BodyHeight is the height of the vehicle with the doors closed. BodyHeight int `xml:"bodyHeight,omitempty"` // Wheelbase is the distance between the cents of the front and // rear wheels. Wheelbase int `xml:"wheelbase,omitempty"` // Style is the specific model style of the vehicle. // e.g. 'GT3 RS' for a Porsche 991 GT3 RS or a 'V6 Coupe' for // a Ford Mustang V6 Coupe. Style string `xml:"style,omitempty"` // Make is the name of manufacture. Make string `xml:"make,omitempty"` // Model is the model of the vehicle, e.g. '911' for a Porsche 991 // or 'Mustang' for a Ford Mustang. Model string `xml:"model,omitempty"` // Year is the full year the vehicle was manufactured. Year int `xml:"year,omitempty"` // CountryCode is the two digit country code for the vehicle. CountryCode string `xml:"countryCode,omitempty"` // TurningCircle is the minimum turning circle in meters. TurningCircle Float1dp `xml:"turningCircle,omitempty"` // OverhangFront is the length in meters which extends beyond the // wheelbase at the front. OverhangFront int `xml:"overhangFront,omitempty"` // VehicleID is the ID of a vehicle submitted to LapTimer. VehicleID int `xml:"vehicleID,omitempty"` // OriginalContributor is true if this user submitted the vehicle, // false otherwise. OriginalContributor bool `xml:"originalContributor,omitempty"` }
Vehicle represents a configured vehicle.
type Vehicles ¶
type Vehicles struct {
Vehicles []Vehicle `xml:"vehicledef"`
}
Vehicles represents the vehicles configured in Harry's LapTimer.
type Video ¶
type Video struct { // Overlaid is true if this video has been overlaid. Overlaid bool `xml:"overlaid"` // URL is the internal URL of the video. URL string `xml:"url"` // SyncPoint represents the offset in seconds from // the start of the video which the Lap starts. SyncPoint SyncPoint `xml:"syncPoint"` }
Video represents a video for a Lap.