I would like to send speed, rpm, gear data through UDP. But i don't well in programming. Can anybody send me a basic plugin example how to send data on UDP or help me? It would be great
Hmm. I tried this approach and been really diappointed by winsockets2. Data went slow and sometimes been lost so my display flickered. If you plan to use it on the same machine, use mapped files instead, they should work better imo (i didn't try it yet though, gonna do in next week or two).
Sending data via UDP works just fine for me, and if you're looking for an example you can check out: https://bitbucket.org/marrs/rfactor...542bc469607b9bd9/cpp/DataPlugin_v2/?at=master This is a plugin that sends all kinds of telemetry data and can easily be customized. For my application (endurance racing software) I am receiving that data in Java (example: https://bitbucket.org/marrs/rfactor...scoring/v2/impl/PluginListener.java?at=master) and using it mainly to do my own scoring in a practice session, but I have used the same code to display telemetry data as well so it's a good starting point.
Sorry But I felt so bad when I could not know how to down load the two folders DataPlugin & DataPlugin_v2. Do I need to edit them and copy the contents? I can not find the download link from that site
You should have not given up that easily Go to Downloads tab, then Branches. I used Marrs code and works wonderfully.
Thank you B1K3R, I could get it, I compiled the both projects and copied .dll file to the plugin directory and started listing to 127.0.0.1 port 6789 but i did not get any data I am using rFactor 1 and C# while my firewall is tuned off, is there anything special thing I need to do to start receiving the data? even there was not a popup screen showing any data, any suggestion?
Ye, like noel said, it depends what code your doing to receive data. I will post some c# code but won't be home any time soon. Sent from my GT-I9300 using Tapatalk Edit: Here's some code based on Marrs example. These are code extracts so that you get an idea.
Thank you guys, I could test that in rFactor2 and I could detect the data, but in rFactor1 I could not. I am using simple C# code that I already used for listening to UDP ports. is DataPlugin_v2 project is for rFactor2 and DataPlugin project is for rFactor1? I only want it to work in rFactor1 since rFactor 2 is a demo version at me.
Thank you B1K3R for the code, I want to use this data to build a hardware simulator and send them to com port later. I could see that data such as the orientation matrix, pitch, roll..etc are not available in the telemetry, so I will try to do some modification to get them on both projects.
I have created a Wind Simulator that works on other SimRacing games. I want to make it compatible with RF2. I am trying to fetch telemetry variables such as speed, rpm, gear, etc. using a Python script. I downloaded the DataPlugin_V2.dll and added it to the game Bin folders. When I open the in-game options, I do not see this plugin available (all other plugins appear) Here is a piece of my Python code: Code: import struct import socket # Configure listener IP & Port for UDP transmission of packed values udp_ip = "127.0.0.1" udp_port = 6789 unpacked_data = None data = None def checkStatus(): global data, udp_ip, udp_port sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP #sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((udp_ip, udp_port)) sock.settimeout(1/30) try: data, addr = sock.recvfrom(1024) # receiving from socket sock.close() return data except: return False def receiveData(): global unpacked_data, data fmt = '<' + '70' + 'f' # define structure of packed data s = struct.Struct(fmt) # declare structure #rx_data = net_rx(udp_ip, udp_port) #unpacked_data = s.unpack(data) # unpack data into tuple, requires correct 'fmt' unpacked_data = struct.unpack('64f', data[0:256]) return True def getChannel(channel): global unpacked_data if channel == 'rpm': return str(int(unpacked_data[37])) elif channel == 'max_rpm': return str(int(unpacked_data[63])) elif channel == 'gear': return str(int(unpacked_data[33])-1) elif channel == 'speed': return str(int(unpacked_data[7]*0.6214)) elif channel == 'track_loc': return '-1' elif channel == 'car_name': return '-1' else: return 0 For more information about the Wind Simulator, you can visit our website at: https://www.simracingstudio.com/ Thanks, Phil.