• Welcome to PiBoSo Official Forum. Please login or sign up.
 
November 27, 2021, 12:09:18 AM

Live Timing

Started by PiBoSo, November 11, 2017, 04:19:59 PM

Previous topic - Next topic

PiBoSo

November 11, 2017, 04:19:59 PM Last Edit: February 09, 2021, 10:26:48 PM by PiBoSo
It is possible to connect to a dedicated server to receive live race data.
The feature is off by default and must be enabled:
https://forum.piboso.com/index.php?topic=26.0
Only 1 client can connect to the server.

Communication is made with UDP sockets and strings terminated with "\n".

Send "CONNECT" followed by the connection password ( empty string if no password ).
Reply:
OK -> connected
FULL -> another client is already connected
WRONGPASSWORD -> wrong password

Send "START", followed by a parameter string containing either "0" or "1", to start receiving data.
If the parameter is "1", the track centerline and the track position of the bikes are sent, too.

Data format is "MSG" followed by the message ID and then a stream of strings.
Send "ACK" followed by the message ID after each MSG.

Send "KEEPALIVE" every 15 seconds to keep the connection active.
The server sends "ALIVE" to report that the connection is active.

Send "DISCONNECT" to correctly close the connection.

Example source code can be downloaded at this link: http://www.kartracing-pro.com/downloads/livetiming.c

Messages data format

EVENT
Type
- TESTINGDAY
- RACE
Name
Track
Track Length ( meters )
Allowed Categories and Bikes
Empty string

ENTRY
Race Number
Name
Bike Name
Bike Short Name
Categories
GUID
Extra Data
Empty string

ENTRYREMOVE
Race Number
Empty string

Testing Day:
SESSION
Session
- WAITING
- TESTINGDAY
State
Length
Empty string

Race:
SESSION
Session
- WAITING
- PRACTICE
- QUALIFY
- WARMUP
- RACE
State
if session = practice ( PRACTICE, QUALIFY, WARMUP )
- INPROGRESS
- COMPLETE
else if session = race ( RACE )
- SIGHTINGLAP
- WARMUPLAP
- PRESTART
- STARTSEQUENCE
- INPROGRESS
- RACEOVER
- COMPLETE
endif
Length ( minutes if practice, laps if race )
Empty string

WEATHER
Conditions
- CLEAR
- CLOUDY
- RAINY
Air Temperature
Ground Temperature
Empty string

DRIVERSTATUS
State
- DNS
- RET
- DSQ
if state = DSQ
Reason
- JUMPSTART
- TOOMANYOFFENCES
- DRIVETHROUGHNOTCLEARED
- DIRECTOR
endif
Empty string

BESTLAP
Race Number
Session Time ( milliseconds )
Lap Time ( milliseconds )
Lap Number
Split 1 ( milliseconds )
Split 2 ( milliseconds )
Split 3 ( milliseconds )
Speed Trap ( meters/s )
Empty string

LASTLAP
Race Number
Session Time ( milliseconds )
Lap Time ( milliseconds )
Lap Number
Split 1 ( milliseconds )
Split 2 ( milliseconds )
Split 3 ( milliseconds )
Speed Trap ( meters/s )
Empty string

PENALTY
Race Number
Penalty Number
Type
- TIME
- DRIVETHROUGH
if type = TIME
Penalty Time ( seconds )
endif
Offence
- JUMPSTART
- PITLANESPEEDING
- CUTTING
Empty string

PENALTYCLEAR
Race Number
Penalty Number
Empty string

PENALTYCHANGE
Race Number
Penalty Number
Penalty Time
Empty string

LAP
Race Number
Lap Invalid
Session Time ( milliseconds )
Lap Time ( milliseconds )
Split 1 ( milliseconds )
Split 2 ( milliseconds )
Split 3 ( milliseconds )
Speed Trap ( meters/s )
Empty string

SPLIT
Race Number
Split Number
Split Time ( milliseconds )
Empty string

SPEED
Race Number
Speed Trap ( meters/s )
Empty string

CLASSIFICATION
Session
Status
Session Timer ( milliseconds )
Session Length ( minutes )
Session Lap
Number of Laps
for each entry:
Race Number
if the session is practice ( practice, qualify, warmup )
Best Lap ( milliseconds )
if best lap not zero
Lap Number
Total Laps
Gap ( milliseconds, -- if zero )
Speed Trap ( meters/s )
endif
else
Race Time ( milliseconds ) or Status
- DNS
- DSQ
if Race Time not zero
Lap Number
Gap ( milliseconds or L if lapped )
endif
endelse
Bike Status
- TRK: on track
- PIT: in the pits
endfor
Empty string after the last entry

TRACKDATA
Start / Finish Longitudinal Position
Split 1 Longitudinal Position
Split 2 Longitudinal Position
Split 3 Longitudinal Position
Speed Trap Longitudinal Position
Number of Segments
Empty string

Always sent after TRACKDATA:
TRACKSEGMENT
Segment Number
Type ( 0 = straight, 1 = curve )
Length ( meters )
Radius ( meters )
Angle ( degrees )
Start Position X ( meters )
Start Position z ( meters )
Height ( meters )
Empty string

TRACKPOSITION
for each entry on track:
Race Number
Position X ( meters )
Position Y ( meters )
Position Z ( meters )
endfor
Empty string after the last entry

END
Empty string
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

Italian Mod Team

Thanks, but where I write "connect.....ecc ecc"?? On Chrome, Iexplorer, Safari??
Please, type an example

Thank you, IMT

PiBoSo

First post updated to add:
- a parameter to the "START" message, that allows to receive the track centerline and bikes' track position, too
- a link to example source code
- the messages data format
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

PiBoSo

First post updated to add the length to the "SESSION" message.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".