Jump to content
Want to report an issue? Have a bug to report? Please look here first!!!! Read more... ×

Archived

This topic is now archived and is closed to further replies.

D-Box and UDP Telemetry Information

Recommended Posts

JuanCarMR said:
@cjorgens79 the problem is that if you download for iPhone, you must paid to use in an iPad as well.  :( 
No you shouldn't have to if you are logged into the app store with the same account. Click on the cog in the bottom left and then click the "Restore Purchases" button and it should unlock anything you have previously purchased.
Ok, Thank you, it works!!!

Share this post


Link to post
Share on other sites
@Lozzy UDP settings are not persistent across game launches - any chance we could get persistence including remembering the last IP entered?

in addition, any chance of including UDP Telemtry in Pause menu?

PS4 | v1.7.0

Share this post


Link to post
Share on other sites
@Hoo @Lozzy

could we have VSC delta and lap/sector delta added to output stream please?

Also; the telemetry settings reset at game restart; can this be persistent ?

Share this post


Link to post
Share on other sites
dwin20 said:
@cjorgens79 - First - this is a terrific post! Helpful detail that can really help the Codemaster team to make the third party telemetry efforts significantly better - and as a result make F1 2016 better. 

BTW - in your app is there a way in the telemetry section to see the track map as well as the graphs?

Thanks 
Thanks. The track map is not currently available, but i am in the process of creating all the track maps so it wont be too far away to being added to the app. Keep in mind that the f1 2016 udp telemetry only has the current players positions so the track map will only be useful to see yourself one the track and upcoming corners, you wont be able to use it to see the position of other competitors until (hopefully) they add this information to the api.
Would it be possible to stream the mirror images as well? Would be great to use my phone as rear view mirror. Two phones/mirrors, even better 

Share this post


Link to post
Share on other sites
dwin20 said:
@cjorgens79 - First - this is a terrific post! Helpful detail that can really help the Codemaster team to make the third party telemetry efforts significantly better - and as a result make F1 2016 better. 

BTW - in your app is there a way in the telemetry section to see the track map as well as the graphs?

Thanks 
Thanks. The track map is not currently available, but i am in the process of creating all the track maps so it wont be too far away to being added to the app. Keep in mind that the f1 2016 udp telemetry only has the current players positions so the track map will only be useful to see yourself one the track and upcoming corners, you wont be able to use it to see the position of other competitors until (hopefully) they add this information to the api.
Would it be possible to stream the mirror images as well? Would be great to use my phone as rear view mirror. Two phones/mirrors, even better 
That could be awesome 

Share this post


Link to post
Share on other sites
@Hoo @Lozzy

could we have VSC delta and lap/sector delta added to output stream please?

Also; the telemetry settings reset at game restart; can this be persistent ?
@Lozzy @Hoo anything ? Even just patch the persistence? It's really annoying having to set this up every time.

Share this post


Link to post
Share on other sites
@Hoo @Lozzy

could we have VSC delta and lap/sector delta added to output stream please?

Also; the telemetry settings reset at game restart; can this be persistent ?
@Lozzy @Hoo anything ? Even just patch the persistence? It's really annoying having to set this up every time.
I wish this would get patched asap. Pain in the butt to re enter each time.

Share this post


Link to post
Share on other sites
Does anyone have any advice on how I could read this data using Python? So far I have this which apart from m_time isn't making a whole lot of sense to me.


import socket

UDP_IP = "0.0.0.0"
UDP_PORT = 20777

sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))

while True:
import struct
x = 0
y = 4
i = 0

params = (
"m_time", "m_lapTime", "m_lapDistance", "m_totalDistance", "m_x", "m_y", "m_z", "m_speed", "m_xv", "m_yv", "m_zv",
"m_xr", "m_yr", "m_zr", "m_xd", "m_yd", "m_zd", "m_susp_pos_bl", "m_susp_pos_br", "m_susp_pos_fl",
"m_susp_pos_fr", "m_susp_vel_bl", "m_susp_vel_br", "m_susp_vel_fl", "m_susp_vel_fr", "m_wheel_speed_bl",
"m_wheel_speed_br", "m_wheel_speed_fl", "m_wheel_speed_fr", "m_throttle", "m_steer", "m_brake",
"m_clutch", "m_gear", "m_gforce_lat", "m_gforce_lon", "m_lap", "m_engineRate", "m_sli_pro_native_support",
"m_car_position", "m_kers_level", "m_kers_max_level", "m_drs", "m_traction_control", "m_anti_lock_brakes",
"m_fuel_in_tank", "m_fuel_capacity", "m_in_pits", "m_sector", "m_sector1_time", "m_sector2_time",
"m_brakes_temp[4]", "m_wheels_pressure[4]", "m_tea", "m_info", "m_total_laps", "m_track_size",
"m_last_lap_time", "m_max_rpm", "m_idle_rpm", "m_max_gears", "m_sessionType", "m_drsAllowed", "m_track_number",
"m_vehicleFIAFlags")

while (i <= 55):
data, addr = sock.recvfrom(1024)
output = struct.unpack('f', data[x:y]) # 4 bytes at a time
print (i, params[i], output[0])
i = i + 1
if (i >= 55):
x = 0
y = 4
i = 0
else:
x = y + 1
y = x + 4

Share this post


Link to post
Share on other sites
I get;

(0, 'm_time', 333.64877319335938)
(1, 'm_lapTime', 1.6516445830286722e-19)
(2, 'm_lapDistance', 205804640.0)
(3, 'm_totalDistance', 4.5450436758462367e-26)
(4, 'm_x', 4.4473748207092285)
(5, 'm_y', -12683265.0)
(6, 'm_z', -9.2415821695892811e+32)
(7, 'm_speed', -3.9641573429107666)
(8, 'm_xv', 32.9912109375)
(9, 'm_yv', -8.4999424220053715e-14)
(10, 'm_zv', -9.2785177855941442e-29)
(11, 'm_xr', -21342580736.0)
(12, 'm_yr', 0.002564004622399807)
(13, 'm_zr', -765.69464111328125)
(14, 'm_xd', -6296419958784.0)
(15, 'm_yd', -29825302528.0)
(16, 'm_zd', 3.1190316677093506)
(17, 'm_susp_pos_bl', 6.5547745952899069e-19)
(18, 'm_susp_pos_br', 0.28955948352813721)
(19, 'm_susp_pos_fl', 3.9389992707583588e-06)
(20, 'm_susp_pos_fr', 35.217830657958984)
(21, 'm_susp_vel_bl', 3.6655337799123751e+24)
(22, 'm_susp_vel_br', 2116.1279296875)
(23, 'm_susp_vel_fl', 9.2485698645437927e-44)
(24, 'm_susp_vel_fr', 1.0)
(25, 'm_wheel_speed_bl', 0.0)
(26, 'm_wheel_speed_br', 0.0)
(27, 'm_wheel_speed_fl', 1.3770289162412519e-14)
(28, 'm_wheel_speed_fr', -0.3972027599811554)
(29, 'm_throttle', 3.8673117017554883e-26)
(30, 'm_steer', 2.5036999662091507e-41)
(31, 'm_brake', -1.0842021724855044e-19)
(32, 'm_clutch', 400000.0)
(33, 'm_gear', 6.6822206465916081e-39)
(34, 'm_gforce_lat', 0.0)
(35, 'm_gforce_lon', 0.0)
(36, 'm_lap', 22.780544281005859)
(37, 'm_engineRate', 6.1328892278008506e-39)
(38, 'm_sli_pro_native_support', 0.0)
(39, 'm_car_position', 15.306700706481934)
(40, 'm_kers_level', 0.0)
(41, 'm_kers_max_level', -1.4410973585814305e-37)
(42, 'm_drs', 1.9862720367083779e-32)
(43, 'm_traction_control', 2.6567976131272077e-15)
(44, 'm_anti_lock_brakes', 18.0)
(45, 'm_fuel_in_tank', 6.0209647168582988e-39)
(46, 'm_fuel_capacity', 2.351939342522773e-41)
(47, 'm_in_pits', -9.108440018111311e-44)
(48, 'm_sector', 14.0)
(49, 'm_sector1_time', 1.026398310071094e+36)
(50, 'm_sector2_time', -2.4107938780244153e-41)
(51, 'm_brakes_temp[4]', -4.212991842361863e-35)
(52, 'm_wheels_pressure[4]', 9.0)
(53, 'm_tea', 5.9004306281509353e-39)
(54, 'm_info', 0.0)

and then the previous 55 lines repeat - over and over - which is fine - but Im not sure how to make sense of the data.

I have 0 development experience so i'm surprised i've got this far.

Share this post


Link to post
Share on other sites
I can already see some issues with my code above (there are 65 vehicle parameters, not 55) - but that's by the by somewhat as I still have no idea how to make sense of the output I am getting.

Share this post


Link to post
Share on other sites
I get;

(0, 'm_time', 333.64877319335938)
(1, 'm_lapTime', 1.6516445830286722e-19)
(2, 'm_lapDistance', 205804640.0)
(3, 'm_totalDistance', 4.5450436758462367e-26)
(4, 'm_x', 4.4473748207092285)
(5, 'm_y', -12683265.0)
(6, 'm_z', -9.2415821695892811e+32)
(7, 'm_speed', -3.9641573429107666)
(8, 'm_xv', 32.9912109375)
(9, 'm_yv', -8.4999424220053715e-14)
(10, 'm_zv', -9.2785177855941442e-29)
(11, 'm_xr', -21342580736.0)
(12, 'm_yr', 0.002564004622399807)
(13, 'm_zr', -765.69464111328125)
(14, 'm_xd', -6296419958784.0)
(15, 'm_yd', -29825302528.0)
(16, 'm_zd', 3.1190316677093506)
(17, 'm_susp_pos_bl', 6.5547745952899069e-19)
(18, 'm_susp_pos_br', 0.28955948352813721)
(19, 'm_susp_pos_fl', 3.9389992707583588e-06)
(20, 'm_susp_pos_fr', 35.217830657958984)
(21, 'm_susp_vel_bl', 3.6655337799123751e+24)
(22, 'm_susp_vel_br', 2116.1279296875)
(23, 'm_susp_vel_fl', 9.2485698645437927e-44)
(24, 'm_susp_vel_fr', 1.0)
(25, 'm_wheel_speed_bl', 0.0)
(26, 'm_wheel_speed_br', 0.0)
(27, 'm_wheel_speed_fl', 1.3770289162412519e-14)
(28, 'm_wheel_speed_fr', -0.3972027599811554)
(29, 'm_throttle', 3.8673117017554883e-26)
(30, 'm_steer', 2.5036999662091507e-41)
(31, 'm_brake', -1.0842021724855044e-19)
(32, 'm_clutch', 400000.0)
(33, 'm_gear', 6.6822206465916081e-39)
(34, 'm_gforce_lat', 0.0)
(35, 'm_gforce_lon', 0.0)
(36, 'm_lap', 22.780544281005859)
(37, 'm_engineRate', 6.1328892278008506e-39)
(38, 'm_sli_pro_native_support', 0.0)
(39, 'm_car_position', 15.306700706481934)
(40, 'm_kers_level', 0.0)
(41, 'm_kers_max_level', -1.4410973585814305e-37)
(42, 'm_drs', 1.9862720367083779e-32)
(43, 'm_traction_control', 2.6567976131272077e-15)
(44, 'm_anti_lock_brakes', 18.0)
(45, 'm_fuel_in_tank', 6.0209647168582988e-39)
(46, 'm_fuel_capacity', 2.351939342522773e-41)
(47, 'm_in_pits', -9.108440018111311e-44)
(48, 'm_sector', 14.0)
(49, 'm_sector1_time', 1.026398310071094e+36)
(50, 'm_sector2_time', -2.4107938780244153e-41)
(51, 'm_brakes_temp[4]', -4.212991842361863e-35)
(52, 'm_wheels_pressure[4]', 9.0)
(53, 'm_tea', 5.9004306281509353e-39)
(54, 'm_info', 0.0)

and then the previous 55 lines repeat - over and over - which is fine - but Im not sure how to make sense of the data.

I have 0 development experience so i'm surprised i've got this far.
Try little endian for values. getting 55 or 65 values doesn't effect anything. Doc says values comes as byte stream of floats. Floats are 4 byte so you should get 4 bytes as little endianed. There are probably python function for this. I'm sure you get correct result after that

Share this post


Link to post
Share on other sites
Hi all,

I'm the creator of the iOS app Race Dash for PCARS and am just in the process of creating a similar dash app for F1 2016.

I'm using the game on the PS4 and have come across a couple of issues which I wondered if anyone else has seen:

Firstly, UDP broadcast mode doesn't seem to broadcast anything. I have to turn off broadcast and enter my phones IP to see the data stream.

Also, tyre pressures seem to be stuck at 18PSI and never change...

Are these issues just me, just PS4 or wider problems?

Any thoughts and help gratefully received.

Thanks
David

Share this post


Link to post
Share on other sites
...Firstly, UDP broadcast mode doesn't seem to broadcast anything. I have to turn off broadcast and enter my phones IP to see the data stream.
Are these issues just me, just PS4 or wider problems?
This is a known issue about PS4.
I've no sure infos about PC or XBOX

Share this post


Link to post
Share on other sites
Hi all,

I'm the creator of the iOS app Race Dash for PCARS and am just in the process of creating a similar dash app for F1 2016.

I'm using the game on the PS4 and have come across a couple of issues which I wondered if anyone else has seen:

Firstly, UDP broadcast mode doesn't seem to broadcast anything. I have to turn off broadcast and enter my phones IP to see the data stream.

Also, tyre pressures seem to be stuck at 18PSI and never change...

Are these issues just me, just PS4 or wider problems?

Any thoughts and help gratefully received.

Thanks
David
Hey Davey,

UDP Broadcast helps when using multiple devices (e.g. I use iPhone as speedometer and iPad for lap times,etc) I need to plug IP address for my iPhone and make sure broadcast is on otherwise the iPad is not recognized.

There is no tire pressure/temperatures data in the UDP stream unfortunately. 

Share this post


Link to post
Share on other sites
transfix said:

Hey Davey,

UDP Broadcast helps when using multiple devices (e.g. I use iPhone as speedometer and iPad for lap times,etc) I need to plug IP address for my iPhone and make sure broadcast is on otherwise the iPad is not recognized.

There is no tire pressure/temperatures data in the UDP stream unfortunately. 

Agreed, broadcast is needed as I also use an iPhone and an iPad while racing. It seems to be just a bug, I've run Wireshark and literally no data is sent with broadcast on - hopefully it'll get fixed soon.

Looking at the spec, I assumed m_wheels_pressure relates to tyre pressures and the value is 'about right'  for PSI, it just doesn't change for me on PS4. I've assumed it works on other platforms and have left it in my app for now...

David

Share this post


Link to post
Share on other sites
I'm helping a friend with his Python dev, but don't have F1 2016 at present, so can't generate a test UDP stream.
Is there any chance someone could post an example 'packed' string for me experiment with.
Thanks

Share this post


Link to post
Share on other sites
I'm helping a friend with his Python dev, but don't have F1 2016 at present, so can't generate a test UDP stream.
Is there any chance someone could post an example 'packed' string for me experiment with.
Thanks
Here is a zip of a recording of the raw telemetry stream from a 3 lap test that you can use.
https://www.mediafire.com/?c9csq6ux4venqhy

Thanks, how was the data recorded?

Share this post


Link to post
Share on other sites
Is the game sending UDP data in spectator view?
If it does... which kind of data? Generic (about the circuit) or Viewed Driver specific (position, laptimes)?

Share this post


Link to post
Share on other sites
Thanks, how was the data recorded?
UDP socket just writing everything it receives to disk, i use it to simulate the output during development, saves me the hassle of loading the game up and trying to play it at the same time as testing my app. Its recorded at approx 70Htz, but you can play it back at whatever speed you want. 

Share this post


Link to post
Share on other sites
I've made some progress and seem to be getting data out now.  Although I have spotted that m_speed value is approximately half what it should be, i.e. my data says 5mph when it should be 10mph.  Of course I can just double the float but I'm wondering if I have a mistake I'm not spotting.

I've also noticed the gears are offset, i guess due to reverse, but thats also not a problem.  I just wanted to check.

Share this post


Link to post
Share on other sites
I've made some progress and seem to be getting data out now.  Although I have spotted that m_speed value is approximately half what it should be, i.e. my data says 5mph when it should be 10mph.  Of course I can just double the float but I'm wondering if I have a mistake I'm not spotting.

I've also noticed the gears are offset, i guess due to reverse, but thats also not a problem.  I just wanted to check.

Sorted, was printing the wrong sort of number for the mph, :blush:

Share this post


Link to post
Share on other sites


!/usr/bin/env python # ---------------------------------------------------------------------------------------------------------------------- # Test tool to receive packed values. # Assumes packed data is of fixed size. # ---------------------------------------------------------------------------------------------------------------------- import sys import struct import socket # Configure listener IP & Port for UDP transmission of packed values udp_ip = "0.0.0.0" udp_port = 20777 def net_rx(UDP_IP, UDP_PORT): # Receive packet from wire sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP sock.bind((UDP_IP, UDP_PORT)) data, addr = sock.recvfrom(1024) # receiving from socket return data def displaygear(gear): # | car gear | data gear | Required to adjust for gear float mapping as shown # | R | 0 | # | N | 1 | # | 1 | 2 | # | 2 | 3 | # | 3 | 4 | # | 4 | 5 | # | 5 | 6 | # | 6 | 7 | # | 7 | 8 | # ------------------------ if (gear > 1): # Forward gear requires minus adjustment gear -=1 print "Current Gear :%d" % gear # print forward gear elif (gear == 1): print "Current Gear :N" # print neutral elif (gear == 0): print "Current Gear :R" # print reverse return def displaymph(mph): print "Current MPH :%f" % mph return def receiver(): fmt = '<' + '70' + 'f' # define structure of packed data s = struct.Struct(fmt) # declare structure packetCounter = 0 recordedData = [] # Infinite receiving loops while True: rx_data = net_rx(udp_ip, udp_port) unpacked_data = s.unpack(rx_data) # unpack data into tuple, requires correct 'fmt' displaygear(unpacked_data[33]) print "Current RPM :%d" % unpacked_data[37] displaymph(unpacked_data[7]) return def main(): receiver() return if __name__ == '__main__': main()

Share this post


Link to post
Share on other sites
Hello !
I'm currently in the process of developping a generic codemaster UDP plugin for XSim, Focused on PS4. The good news is that F12016 supports UDP. I made a capture and what is strange is that the UDP payload is 280 bytes. Anyone has a clue on the extra bytes from the spec above ?
I made a UDP record playback tool in python, with some samples from different gmes, including F1 2016. here: https://github.com/vthinsel/Python_UDP_Receiver (it also includes a proxy to replicate UDP streams)
Edit: I'm trying to consolidate UDP specs for various games here: https://docs.google.com/spreadsheets/d/1UTgeE7vbnGIzDz-URRk2eBIPc_LR1vWcZklp7xD9N0Y/edit?usp=sharing 

Share this post


Link to post
Share on other sites

×