Solved Outsim not active

Discussion in 'Mod Support' started by fufsgfen, May 19, 2019.

  1. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    I wanted to refresh my memories of C# and for sure needed as I have forgotten even most basic of things, so found out a library that allows quite easy way for reading outgauge/outsim data BeamNG sends when option is enabled from menu.

    However while everything else from outgauge works fine (well, oilpressure does not, some bits are not implemented obviously), I'm not getting time, it is like if game would not be sending time to outsim, but when I check outsim.lua it should send time.

    From outsim.lua (note that I did change ip and port in outsim.lua):
    -- teh documentation can be found at LFS/docs/InSim.txt
    ffi.cdef[[
    typedef struct outsim_t { // note: X and Y axes are on the ground, Z is up.
    unsigned time; // time in milliseconds (to check order)

    Code:
    double time;
    private void outsim_PacketReceived(object sender, OutSimEventArgs e)
            {
    time = e.Time.Ticks; // same result with time = e.Time.Milliseconds;
    labelTime.Text = Convert.ToString(time);
    }
    
    Using https://github.com/alexmcbride/insimdotnet/


    I guess that outsim is not enabled with game option 'enable outgauge' so that enables only outgauge.lua, but where do I enable outsim.lua in 0.16?
     
  2. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    I think this is not finished yet?
     
  3. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Ah, I am ahead of my time once again, thx! :D
     
  4. tdev

    tdev
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 3, 2012
    Messages:
    3,031
    Feel free to finish it, we can use help at all corners :)
     
    • Like Like x 3
  5. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    From simple roll UI app I can see streams manager is used to get stream data.

    I guess I would create new streams manager and then use that to get sensors for it so I can access them or then there is direct way to access sensors, but I could not figure out how.

    In simple roll UI app Streams manager is created like this on line 1 and then actual sensors are populated and made accessible with lines 2 and 3, not really sure if that is needed on Lua side and if it is, how to create that streams manager.
    .directive('simpleRoll', ['StreamsManager', function (StreamsManager) {
    var streamsList = ['sensors'];
    StreamsManager.add(streamsList);

    There is wiki page about sensors, but it is bit empty on Lua side of things:
    https://wiki.beamng.com/Streams


    I did attempt this, but obviously it is not working.
    local StreamsManager.new("StreamsManager")
    local streamsList = ['sensors']
    StreamsManager.add(streamsList)


    I can't say I would really understand what I'm doing, but, copy paste from outgauge with small edits and hardcoded ip as well as port made outsim to send time in milliseconds, I have no idea how to get outsim ip and port to settings like is done with outgauge though and accessing sensors is bit of mystery, but it kind of works.

    So there is rpm, time in milliseconds (it goes to 1000 and starts from zero, something might be off), roll (does not work) and speed, also indicators for outsim and outgauge data receiving.
    upload_2019-5-20_3-2-8.png

    There was thread from 2015 which had exact same problem with getting roll read with Lua, but surprisingly information there was not quite usable anymore, game has evolved quite a bit during few years :p
    --- Post updated ---
    Okay, turns out I was thinking way too complicated, it is not streams.sensors. it is just sensors. :D
    Roll is missing from that though, simple roll app is using streams.sensors.roll but I'm getting nil from ingame console, so need to find out where that is being created at for simple roll app.
     
    #5 fufsgfen, May 20, 2019
    Last edited: May 20, 2019
    • Informative Informative x 1
  6. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    I think outsim.lua works now, even there is bit more to do, testing, verifying etc.
    upload_2019-5-20_15-9-48.png
     
    • 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