OutGauge Support specifications

Discussion in 'Programming' started by Zorro_X, Oct 21, 2021.

  1. Zorro_X

    Zorro_X
    Expand Collapse

    Joined:
    Oct 18, 2021
    Messages:
    15
    Hi,
    Is there a way to get detailed information on how OutGauge protocol works ?
    It seems the easiest way to get telemetry data is to enable OutGauge support and to connect it into an OutGauge compatible device... so if I can create my own OutGauge compatible device(s) that may do the trick...
     
    • Like Like x 1
  2. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    OutGauge simply sends out UDP data packets to UDP sockets. Here is a list of data that is sent from BeamNG and can be received:

    BeamNG.drive\lua\vehicle\extensions\outgauge.lua
    data.png

    I was able to create a simple client socket program in Python that receives and parses this data if you are interested.

    Python Code:
    https://drive.google.com/file/d/15liU_MXeqHm84O3XSlxS5h-V-wSGqqZR/view?usp=sharing

    In the Python code, the outsim_pack variable is a tuple/list that contains all the telemetry data listed above. And to get one of the variables in the list, find the index of the data variable you want and index the list, like how the RPM is printed since I index the 7th element (6) in the list in the code.

    Let me know if you need me to clarify anything. :)
     
  3. Zorro_X

    Zorro_X
    Expand Collapse

    Joined:
    Oct 18, 2021
    Messages:
    15
    Thankyou !
    I though there will be more data than that, but it is at least something useful. I still miss for example the lights, or engine indicators. It seems the internal plug-ins/mods have much more data available than the ones of OutGauge protocol : is there a way to develop my own plug-in/protocol (I'm not affraid by coding) allowing me to send the data I want/need ?

    Now I've another question : is there some kind of similar protocol but as input to be able to use my own, or maybe if I can make my own export plug-in I can use it also as import one, but I've seen in the tutorial the data is "read only", so is there some data that can be written through a plug-in/mod ?
     
  4. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    Yes you can develop your own protocol to send over the data you need from BeamNG and also receive data from an external source for example to modulate the gas pedal. All you have to do is modify the Lua code to do so. But I want to know how you are going to use the telemetry data (sending data to an Arduino connected to your computer's USB port?) so I can suggest how to go about coding it.
     
  5. Zorro_X

    Zorro_X
    Expand Collapse

    Joined:
    Oct 18, 2021
    Messages:
    15
    Thankyou, i've already made full aircraft simulators, I know how to do it. I was lookig (was because now it seems i've found) for a car simulator able to perform what I need. ;)
    So to make it quick, the objective is to send telemetry data through network (usualy UDP packets, but may be TCP, still need to think about it) to some sort of a "hub" able to distribute that data to any device needing it. After that, you can add any device you want or need and choose which data the device uses or sends to the simulation.
    The firs step will be to animate the dashboard (could have been another thing, but it is the one I'm willing to begin with), so there will be : Simulation Software (BeamNG) <- LAN -> RaspberryPi <- serial -> Arduino <-> indicators & gauges
    This architecture already exists for other car/racing simulators and works as well as expected. For BeamNG there is no (yet) any implementation of any hub protocol, but I can code my own, I've no problem with that neither... ;)

    So I've two last questions :
    1) is there a linux version of BeamNG.drive ?
    2) the plug-ins coding language seems interpreted (pyton or js), is there a way to use C/C++ ?
     
  6. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    Wow that sounds pretty interesting and a bit complex! I think you should use UDP protocol since you are going to be constantly sending telemetry data at a fast rate to the gauges so lost/corrupt data isn't really a big deal. l actually was able to modify the existing outgauge.lua code to enable two way UDP communication of any sort of information (just need to know where to find the data you want in the Lua files). And so its actually a mod that overrides the original outgauge.lua code because if you didn't to not override existing game code and make a new Lua file that gets executed by every vehicle, you would need to create Lua files for every single vehicle which is really annoying.

    Here's the link to it: https://drive.google.com/drive/folders/16hrFJGGLMqAfHWfkOA8ZuJN1RUZLUX8P?usp=sharing
    Anyways so just download the folder and drop it in the BeamNG mod folder (create a folder called unpacked inside of it and place it in there): BeamNG.drive\0.23\mods\unpacked

    Currently, it just sends out a JSON encoded object and it allows for receiving UDP packets. Anyways it should give you a good starting point. :)
     
  7. Zorro_X

    Zorro_X
    Expand Collapse

    Joined:
    Oct 18, 2021
    Messages:
    15
    Thankyou, I understand what you say (and why you say it). But UDP packets cannot be loss into a LAN connection, it is nearly the same as TCP (except of course one is connection oriented and not the other). It is useful when connecting distant networks where there may be packet loss. ;)
    In another hand, UDP easy allows broadcasting in a LAN and that can be very useful in a simulator context.
    My problem with Python is that i'll need to learn it, it is not a problem, but if I can make a C/C++ plug-in/mod it will be easer (and faster) to me.
    And if there is a linux version of BeamNG.drive that will also be an advantage for coding (from my point of view)...
     
    #7 Zorro_X, Oct 22, 2021
    Last edited: Oct 22, 2021
  8. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    Yeah I guess the chance of having packet loss over LAN is like nil lol.

    You can run the game in Linux using Steam's Proton application (I don't have any experience with Linux) but the game mods still have to be coded in Lua. Although your client application running on the Raspberry PI can be coded in whatever language you wish.

    And just to clarify, only place the custom_telemetry_angelo234 folder in the mods/unpacked folder. The Python script is the client socket.
     
  9. Zorro_X

    Zorro_X
    Expand Collapse

    Joined:
    Oct 18, 2021
    Messages:
    15
    Thankyou, I've open another topic about something more global here : https://www.beamng.com/threads/extract-simulation-data.82469/
    (Maybe a moderator can merge it with this one ?)
    I've read in the official documentation there are C++ "bindings" available, but for the moment I don't know how to "bind" with them... :/
     
  10. MadalinBaby

    MadalinBaby
    Expand Collapse

    Joined:
    Feb 21, 2023
    Messages:
    1
    is it posible send FFB data? would be cool using it with DSX for playstation DualSense adaptive triggers.
     
    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice