Pulling out vehicle acceleration in a mod

Discussion in 'Content Creation' started by tcmJOE, Oct 30, 2017.

Tags:
  1. tcmJOE

    tcmJOE
    Expand Collapse

    Joined:
    Oct 30, 2017
    Messages:
    2
    Hi everyone,

    I'm interested in trying to build a mod that tracks the acceleration of a vehicle (center-of-mass?) and outputs it to a CSV file. I'm not particularly familiar with modding BeamNG (and my Lua is pretty mediocre), but it looks like I can track the CM position of a vehicle by building an app and pulling out the sensor.position.x (or y, or z) streams. Or maybe there's a better way (see third question)?

    Some questions I have:
    - How quickly are the stream values refreshed?
    - What is the stream to get the "time" value? escData.stepTime?
    - https://wiki.beamng.com/Streams doesn't have information for a lot of the streams, but if I had to hazard a guess sensor.gx, gy, and gz might be acceleration in G's (x, y, and z coordinate). Is this correct? If so, are these in a global frame or local frame for the vehicle?

    Thanks!
     
  2. thomatoes50

    thomatoes50
    Expand Collapse
    BeamNG Team

    Joined:
    Jan 31, 2013
    Messages:
    722
    You won't be able to write files with CEF (apps)

    • You receive an event once it refreshed it can be every 0.1sec to 0.5 (depending of the data, but the same data should be refresh at almost the same frequency)
    • not sure this time data is ok to use like you want
    • yes and it's local frame
     
  3. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    Is there any particular reason you want to use an app for this?
    Makes much more sense to directly do it in lua with potentially 2000hz update rates.
    You can also easily write data to the disk from lua (still sandboxed but that just restricts the location)
     
    • Agree Agree x 2
    • Like Like x 1
  4. tcmJOE

    tcmJOE
    Expand Collapse

    Joined:
    Oct 30, 2017
    Messages:
    2
    Thanks Diamondback and thomatoes50!

    Okay, sounds like the app route isn't the way to go - it seemed like the easiest approach to do this but if I don't get frequent updates then there's no reason to bother. So, if I wanted to pull things out in the Lua code, where would I begin?
     
  5. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    Can you explain a bit more what you are trying to do and why?
    Logging accelerations at 2khz and writing to a CSV file is technically very easy, but what are the surrounding circumstances?
    Do you want this for any car? Or just a specific one?
    Do you need control over this, ie a toggle to turn on/off? In case you need a toggle, does it need to be user friendly?
     
  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