• Welcome to PiBoSo Official Forum. Please login or sign up.
 
March 28, 2024, 10:35:04 AM

News:

World Racing Series beta14 available! :)


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: November 16, 2023, 01:59:36 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 two parameter strings to start receiving data.
First parameter: "0" or "1". If set to "1", the track centerline and the track position of the bikes are sent, too.
Second Parameter: "0", "1" or "2". If set to "1", contacts between bikes are sent. If set to "2", then contacts with walls 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
Race Number
State
- DNS
- RET
- DSQ
Reason ( empty if state is not DSQ )
- JUMPSTART
- TOOMANYOFFENCES
- DRIVETHROUGHNOTCLEARED
- DIRECTOR
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
Classification Type ( 0 -> none; 1 -> practice; 2 -> race )
if "Classification Type" is 1 or 2
Start Entry
Number of Entries
for each entry:
Race Number
if "Classification Type" is 1 ( practice, qualify, warmup )
Best Lap ( milliseconds )
Lap Number
Total Laps
Gap ( milliseconds, -- if zero )
Speed Trap ( meters/s )
else
Race Time ( milliseconds ) or Status
- DNS
- DSQ
Lap Number
Gap ( milliseconds or L if lapped )
endelse
Bike Status
- TRK: on track
- PIT: in the pits
endfor
endif
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

CONTACT
Time ( milliseconds )
Race Number 1 ( -1 for a wall )
Race Number 2 ( -1 for a wall )
Relative Impact Velocity ( meters/s )
Empty string

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".

PiBoSo

First post updated:
- added a new parameter to the START command to receive the contact messages
- added the CONTACT message data format
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

PiBoSo

First post updated:
- changed the DRIVERSTATUS and CLASSIFICATION messages data format
"La perfezione non è il nostro obiettivo, è la nostra tendenza".