Split motionsim data from player vehicle and other vehicles

Discussion in 'Programming' started by vladimir_west, Sep 17, 2019.

  1. vladimir_west

    vladimir_west
    Expand Collapse

    Joined:
    Sep 12, 2019
    Messages:
    4
    Hi everyone!

    I have 2dof chair which is connected to beamNG.drive via Simtools (as I believe, it uses output info from motionSim).
    But I observed that If you spawn some AI traffic, then it starts to freak out. I believe the reason is motionSim sends output of ALL spawned cars to Simtools.

    Is there any way to split motionSim output?
    like:
    Code:
    if(playerVehicle) then udpSocket:sendto(packet, ip, port1)
    else
    udpSocket:sendto(packet, ip, port2)
    Thanks!
     
  2. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    That's precisely what the code is doing already but I can't test this myself due to lack of hardware...
    In any case, you are the second person reporting this issue, so something seems to be wrong...
     
  3. vladimir_west

    vladimir_west
    Expand Collapse

    Joined:
    Sep 12, 2019
    Messages:
    4
    Okay, I have figured out the problem:
    Simtools creates simtools.lua file in vehicle\extensions folder, which is run by vehicle\main.lua in the vehicle loading process.
    It works similiar to motionSim.lua (also port is 4123), but sends less output than it.
    Code:
    typedef struct simtools_t  {
        float          pitch;            // rad
        float          roll;             // rad
        float          yaw;              // rad
        float          surge;            // m/s²
        float          sway;             // m/s²
        float          heave;            // m/s²
        float          TL;               // m/s
    } simtools_t;
    But I didn't know how to get playerVehicle ID, do you have any ideas? (that should be easy, i believe)
     
  4. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    Can you send me this simtools.lua file please?
     
  5. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    Actually you know what, I looked at the wrong file Oo
    Our own motion support indeed does not have this check, so I'll add that now.
    However, since your software ships its own interface, this fix won't help you at all. I'll fix up their version as well and post that here.
     
  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