1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Experimental DCS Plugin ready for testing

Discussion in 'Digital Combat Simulators (DCS)' started by Dirty, Jun 28, 2019.

  1. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    Happy New Year and enjoy! :cheers

    Yes that’s what I used in the code above, it allows the other data to come through as per the screenshot but nothing on Extra2 which was for the RPM.
  2. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    Hi @Dirty hope your headache after the party wasn't too bad! ;)

    I just wanted to check if DCS_Exp will operate the Virtual Axis in Game Engine Tools?

    (Using my same axis profile they work fine with MSFS but in DCS there is no movement of the Virtual Axis. I do see the values in the Tuning Centre Game Data Input though..)

    This is a screenshot where you can see the values in the tuning centre but nothing in virtual axis:
    upload_2022-1-1_11-52-4.png
  3. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    21,157
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    148,628Coins
    Ratings:
    +10,909 / 54 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Looks like you have zero for all Tuning Center values, try capturing the Max/Min values then tweak from there, see the motion profile tuning tips in the FAQs: https://www.xsimulator.net/community/faq/steps-to-create-a-motion-profile.228/
    • Like Like x 1
  4. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    Many thanks @noorbeast ! That worked. I just set some arbitrary values in the game limits (will still do an actual capture) but that was enough to get the virtual axis reacting:
    upload_2022-1-1_12-15-26.png
    • Like Like x 1
  5. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,910Coins
    Ratings:
    +878 / 3 / -0
    Just regained consciousness and basic body functions :-D

    That's great to hear you got it working. Post here what you do with those slots. Chances are others will benefit from it in the future.

    Cheers,...
    • Funny Funny x 2
  6. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    Haha!
    Thanks, I am still looking for the answer to get the RPM data for the Spitfire to show but if or when I find out will be certain to share!
  7. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,910Coins
    Ratings:
    +878 / 3 / -0
    Chances are people over on the EagleDynamics forums know how to export RPM. I did it once for the P51....
    https://forums.eagle.ru/
    • Like Like x 1
  8. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    YeeHAAA!! Done!!! hug::cheers:grin

    I managed to find the required code and arguments to make this work.
    In addition to the MainPanel = Export.GetDevice(0) it needed this:
    "if MainPanel ~= 0 then
    MainPanel:update_arguments()
    end"
    So to extract any data using known aircraft arguments you want the following code (this example for the Spitfire RPM, (multiplied by 10000 to get the correct figure)):
    Code:
    --RPM Data
        MainPanel = Export.GetDevice(0)
            if MainPanel ~= 0 then
                MainPanel:update_arguments()
              end
            local RPM = MainPanel:get_argument_value(37) * 10000   
    Here is my complete code (it will be easy to add anotherfor Extra3 but I have what I need here):
    Code:
    ---------------------------------------------------------------------------------------------------
    -- Data export script for SimTools V2.4
    -- Version 0.10
    -- created by @Dirty, find me here: https://www.xsimulator.net/community/members/dirty.27556/
    -- Discussions here: https://www.xsimulator.net/community/threads/experimental-dcs-plugin-ready-for-testing.13560/
    --
    -- Changes:
    -- Better user guidance during patching
    ---------------------------------------------------------------------------------------------------
    version = "v0.10"
    
    --Don't change theses values!!!
    r2d = 57.295779513082323        --converts Rad into Degrees
    m2k = 1.94384                    --converts m/s into Knots
    
    --Change those accordigng to your preference
    YouPreferDegreesOverRadians = true
    YouPreferKnotsOverMetersPerSecond = true
    YouPreferEulerAnglesOn_Yaw = false
    YouPreferEulerAnglesOn_Pitch = false
    YouPreferEulerAnglesOn_Roll = false
    
    --The callbacks to be registered with DCS
    local SimTools_Callbacks = {}
    
    function SimTools_Callbacks.onSimulationStart()
    
        log.write('SimTools', log.INFO, "Starting motion data export. Export script " .. version)
        
        package.path = package.path..";.\\LuaSocket\\?.lua"
        package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
        socket = require("socket")
    
        IP = "127.0.0.1"
        Port = 41230
        MySocket = socket.udp ( )
        MySocket:settimeout ( 0 )
        MySocket:setpeername ( IP, Port )
    end
    
    function SimTools_Callbacks.onSimulationFrame()
    
        --Accelerations:
        accel = Export.LoGetAccelerationUnits()
            accel_longitudinal    = accel.x
            accel_vertical        = accel.y
            accel_lateral        = accel.z
            
        --Euler Angles:
        pitch, bank, yaw = Export.LoGetADIPitchBankYaw()
    
        --Angular rates:
        omega = Export.LoGetAngularVelocity()
            omega_longitudinal    = omega.x
            omega_vertical        = omega.y
            omega_lateral        = omega.z
    
    
    
        --Weight On Wheels?
        LeftGear = Export.LoGetAircraftDrawArgumentValue(6)
        NoseGear = Export.LoGetAircraftDrawArgumentValue(1)
        RightGear = Export.LoGetAircraftDrawArgumentValue(4)
        
        --OnGround status is determined by the compression of ANY gear strut
        if (LeftGear > 0 or NoseGear > 0 or RightGear > 0)
            then
                OnGround = 1
            else
                OnGround = 0
        end
    
        --Groundspeed:
        vv = Export.LoGetVectorVelocity()
        GS = math.sqrt( math.pow(vv.x,2) + math.pow(vv.z,2))
        
        --Air Data
        AOA = Export.LoGetAngleOfAttack()
        IAS = Export.LoGetIndicatedAirSpeed()
        --RPM Data
        MainPanel = Export.GetDevice(0)
            if MainPanel ~= 0 then
                MainPanel:update_arguments()
              end
            local RPM = MainPanel:get_argument_value(37) * 10000       
    
    
        if (YouPreferKnotsOverMetersPerSecond) then
            IAS = IAS * m2k
        end
    
        
        --Euler angles? Anyone?
        if (YouPreferEulerAnglesOn_Yaw == true) then
            Yaw_Output = yaw
        else
            Yaw_Output = omega_vertical
        end
            
            
        if (YouPreferEulerAnglesOn_Pitch == true) then
            Pitch_Output = pitch
        else
            Pitch_Output = omega_lateral
        end   
        
        
        if (YouPreferEulerAnglesOn_Roll == true) then
            Roll_Output = bank
        else
            Roll_Output = omega_longitudinal
        end   
        
        
        --Any unit conversions necessary?
        if (YouPreferDegreesOverRadians) then
            Roll_Output            = Roll_Output            * r2d
            Yaw_Output            = Yaw_Output            * r2d
            Pitch_Output        = Pitch_Output            * r2d
        end
        
        --Change exported values when on ground (optional)
        if (OnGround == 1) then
            accel_longitudinal    = accel_longitudinal    * 1.00
            accel_vertical        = accel_vertical        * 1.00
            accel_lateral        = accel_lateral            * 1.00
            Roll_Output            = Roll_Output            * 1.00
            Yaw_Output            = Yaw_Output            * 1.00
            Pitch_Output        = Pitch_Output            * 1.00
        end   
    
    
        --Put data to be exported into these slots. You can put any data you like in there :-)
        --GameEngine:
        local slot_GE_01 = Roll_Output
        local slot_GE_02 = Yaw_Output
        local slot_GE_03 = Pitch_Output
        local slot_GE_04 = accel_longitudinal
        local slot_GE_05 = accel_vertical
        local slot_GE_06 = accel_lateral
        local slot_GE_07 = IAS    --Added
        local slot_GE_08 = RPM    --Added
        local slot_GE_09 = 0
        --GameVibe:
        local slot_GV_01 = 0
        local slot_GV_02 = 0
        local slot_GV_03 = 0
        local slot_GV_04 = 0
        local slot_GV_05 = 0
        local slot_GV_06 = 0
        local slot_GV_07 = 0
        local slot_GV_08 = 0
        --GameDash:
        local slot_GD_01 = 0
        local slot_GD_02 = 0
        local slot_GD_03 = 0
        local slot_GD_04 = 0
        local slot_GD_05 = 0
        local slot_GD_06 = 0
        local slot_GD_07 = 0
        local slot_GD_08 = 0
        local slot_GD_09 = 0
        local slot_GD_10 = 0
        local slot_GD_11 = 0
        local slot_GD_12 = 0
        local slot_GD_13 = 0
        local slot_GD_14 = 0
        local slot_GD_15 = 0
        local slot_GD_16 = 0
        local slot_GD_17 = 0
        local slot_GD_18 = 0
        local slot_GD_19 = 0
        local slot_GD_20 = 0
        
        --Send data via UDP
        if MySocket then
        --                                Slots:      GE01  GE02  GE03  GE04  GE05  GE06  GE07  GE08  GE09  GV01  GV02  GV03  GV04  GV05  GV06  GV07  GV08  GD01  GD02  GD03  GD04  GD05  GD06  GD07  GD08  GD09  GD10  GD11  GD12  GD13  GD14  GD15  GD16  GD17  GD18  GD19  GD20
            socket.try(MySocket:send(string.format("%.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; \n",
                                                    slot_GE_01,
                                                    slot_GE_02,
                                                    slot_GE_03,
                                                    slot_GE_04,
                                                    slot_GE_05,
                                                    slot_GE_06,
                                                    slot_GE_07,
                                                    slot_GE_08,
                                                    slot_GE_09,
                                                    slot_GV_01,
                                                    slot_GV_02,
                                                    slot_GV_03,
                                                    slot_GV_04,
                                                    slot_GV_05,
                                                    slot_GV_06,
                                                    slot_GV_07,
                                                    slot_GV_08,
                                                    slot_GD_01,
                                                    slot_GD_02,
                                                    slot_GD_03,
                                                    slot_GD_04,
                                                    slot_GD_05,
                                                    slot_GD_06,
                                                    slot_GD_07,
                                                    slot_GD_08,
                                                    slot_GD_09,
                                                    slot_GD_10,
                                                    slot_GD_11,
                                                    slot_GD_12,
                                                    slot_GD_13,
                                                    slot_GD_14,
                                                    slot_GD_15,
                                                    slot_GD_16,
                                                    slot_GD_17,
                                                    slot_GD_18,
                                                    slot_GD_19,
                                                    slot_GD_20
                                                    )))
        end
    end
    
    function SimTools_Callbacks.onSimulationStop()
        
        log.write('SimTools', log.INFO, "Motion data export stopped")
    
        if MySocket then
            MySocket:close()
        end
    end
    
    --register these callbacks with DCS to be called at the appropriate moment.
    DCS.setUserCallbacks(SimTools_Callbacks)
    
    
    
    
    ------------------------------------------------------------------------------------
    -----------------------------   HELPER FUNCTIONS   ---------------------------------
    ------------------------------------------------------------------------------------
    
    
    function WheelSpin()
        if (OnGround == 1)
            then
                return GS
            else
                return 0
        end   
        
    end
    
    function Windiness()
        return IAS        --I'm sure someone will be able to come up with an even more sophisticated formula :-)
    end
    I will still do a "Windiness" based on RPM and airspeed.
    Here is a screenshot of the values coming through:
    upload_2022-1-1_22-34-44.png
    • Useful Useful x 1
  9. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,910Coins
    Ratings:
    +878 / 3 / -0
    Oh,.. thats great!

    I will add some of that code to the script so that new users can find it right in the script :thumbs

    Thanks a lot!
    • Like Like x 1
  10. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    Thank you @Dirty!! :thumbs
  11. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    More progress!
    I have put together a Wind formula and managed to display the Wind in Game Dash and RPM in Game Vibe, they are all working nicely. From here it's just a question of populating all the required fields, then seeing what the best way of running everything is with the Arduinos. Probably a combination of SMC3 for the g-force seat and airspeed force feedback (I currently have the latter running off DCSbios), some wind code for the fans to run off Game Dash and to see if I can replace Simshaker with Game Vibe to run the ButtKicker, thus have everything running off SimTools. (Only the 72 odd controls in the HFS Spitfire run off BU's)
    To calculate the Wind I worked on the premise that most of the wind generated will be off the prop and only a little added relatively by the airspeed (200 plus 50 to give 250 max wind). So if the engine stops and you are gliding, you will still get an airspeed wind but much reduced as a result. Just my excperience from my open cockpit flying and stands to reason, the prop has to much out much more wind to generate the thrust required to achieve the airspeed :)
    Here's the latest test showing feed to GameVibe (RPM) and GameDash (Wind) and the supporting code:
    upload_2022-1-2_12-32-27.png

    Code:
    ---------------------------------------------------------------------------------------------------
    -- Data export script for SimTools V2.4
    -- Version 0.10
    -- created by @Dirty, find me here: https://www.xsimulator.net/community/members/dirty.27556/
    -- Discussions here: https://www.xsimulator.net/community/threads/experimental-dcs-plugin-ready-for-testing.13560/
    --
    -- Changes:
    -- Better user guidance during patching
    ---------------------------------------------------------------------------------------------------
    version = "v0.10"
    
    --Don't change theses values!!!
    r2d = 57.295779513082323        --converts Rad into Degrees
    m2k = 1.94384                    --converts m/s into Knots
    
    --Change those accordigng to your preference
    YouPreferDegreesOverRadians = true
    YouPreferKnotsOverMetersPerSecond = true
    YouPreferEulerAnglesOn_Yaw = false
    YouPreferEulerAnglesOn_Pitch = false
    YouPreferEulerAnglesOn_Roll = false
    
    --The callbacks to be registered with DCS
    local SimTools_Callbacks = {}
    
    function SimTools_Callbacks.onSimulationStart()
    
        log.write('SimTools', log.INFO, "Starting motion data export. Export script " .. version)
        
        package.path = package.path..";.\\LuaSocket\\?.lua"
        package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
        socket = require("socket")
    
        IP = "127.0.0.1"
        Port = 41230
        MySocket = socket.udp ( )
        MySocket:settimeout ( 0 )
        MySocket:setpeername ( IP, Port )
    end
    
    function SimTools_Callbacks.onSimulationFrame()
    
        --Accelerations:
        accel = Export.LoGetAccelerationUnits()
            accel_longitudinal    = accel.x
            accel_vertical        = accel.y
            accel_lateral        = accel.z
            
        --Euler Angles:
        pitch, bank, yaw = Export.LoGetADIPitchBankYaw()
    
        --Angular rates:
        omega = Export.LoGetAngularVelocity()
            omega_longitudinal    = omega.x
            omega_vertical        = omega.y
            omega_lateral        = omega.z
    
    
    
        --Weight On Wheels?
        LeftGear = Export.LoGetAircraftDrawArgumentValue(6)
        NoseGear = Export.LoGetAircraftDrawArgumentValue(1)
        RightGear = Export.LoGetAircraftDrawArgumentValue(4)
        
        --OnGround status is determined by the compression of ANY gear strut
        if (LeftGear > 0 or NoseGear > 0 or RightGear > 0)
            then
                OnGround = 1
            else
                OnGround = 0
        end
    
        --Groundspeed:
        vv = Export.LoGetVectorVelocity()
        GS = math.sqrt( math.pow(vv.x,2) + math.pow(vv.z,2))
        
        --Air Data
        AOA = Export.LoGetAngleOfAttack()
        IAS = Export.LoGetIndicatedAirSpeed()
        
            if (YouPreferKnotsOverMetersPerSecond) then
            IAS = IAS * m2k
        end
          
           --RPM Data
        MainPanel = Export.GetDevice(0)
            if MainPanel ~= 0 then
                MainPanel:update_arguments()
              end
            local RPM = MainPanel:get_argument_value(37) * 10000     
    
            --Wind
            --This works on the following approach: 
            -- RPM drives the main wind, 0 to 3000rpm
            -- IAS drives the secondary wind, 0 to say 250kts (after that you just get full blast anyway and your canopy is likely closed.)
            -- IAS has a lesser effect than RPM, let’s say we make AdjRPM full value 200 and AdjIAS another 50 to total 250
            -- So always use RPM as basis
            -- So Wind =AdjRPM+AdjIAS
            AdjRPM = RPM * (200 / 3000)
            AdjIAS = IAS * (50 / 250)
              if AdjIAS > 50 then
                 AdjIAS = 50
              end
            Wind = AdjRPM + AdjIAS
    
        
    
        
        --Euler angles? Anyone?
        if (YouPreferEulerAnglesOn_Yaw == true) then
            Yaw_Output = yaw
        else
            Yaw_Output = omega_vertical
        end
            
            
        if (YouPreferEulerAnglesOn_Pitch == true) then
            Pitch_Output = pitch
        else
            Pitch_Output = omega_lateral
        end   
        
        
        if (YouPreferEulerAnglesOn_Roll == true) then
            Roll_Output = bank
        else
            Roll_Output = omega_longitudinal
        end   
        
        
        --Any unit conversions necessary?
        if (YouPreferDegreesOverRadians) then
            Roll_Output            = Roll_Output            * r2d
            Yaw_Output            = Yaw_Output            * r2d
            Pitch_Output        = Pitch_Output            * r2d
        end
        
        --Change exported values when on ground (optional)
        if (OnGround == 1) then
            accel_longitudinal    = accel_longitudinal    * 1.00
            accel_vertical        = accel_vertical        * 1.00
            accel_lateral        = accel_lateral            * 1.00
            Roll_Output            = Roll_Output            * 1.00
            Yaw_Output            = Yaw_Output            * 1.00
            Pitch_Output        = Pitch_Output            * 1.00
        end   
    
    
        --Put data to be exported into these slots. You can put any data you like in there :-)
        --GameEngine:
        local slot_GE_01 = Roll_Output
        local slot_GE_02 = Yaw_Output
        local slot_GE_03 = Pitch_Output
        local slot_GE_04 = accel_longitudinal
        local slot_GE_05 = accel_vertical
        local slot_GE_06 = accel_lateral
        local slot_GE_07 = IAS
        local slot_GE_08 = Wind
        local slot_GE_09 = 0
        --GameVibe:
        local slot_GV_01 = RPM
        local slot_GV_02 = 0
        local slot_GV_03 = 0
        local slot_GV_04 = 0
        local slot_GV_05 = 0
        local slot_GV_06 = 0
        local slot_GV_07 = 0
        local slot_GV_08 = 0
        --GameDash:
        local slot_GD_01 = Wind
        local slot_GD_02 = 0
        local slot_GD_03 = 0
        local slot_GD_04 = 0
        local slot_GD_05 = 0
        local slot_GD_06 = 0
        local slot_GD_07 = 0
        local slot_GD_08 = 0
        local slot_GD_09 = 0
        local slot_GD_10 = 0
        local slot_GD_11 = 0
        local slot_GD_12 = 0
        local slot_GD_13 = 0
        local slot_GD_14 = 0
        local slot_GD_15 = 0
        local slot_GD_16 = 0
        local slot_GD_17 = 0
        local slot_GD_18 = 0
        local slot_GD_19 = 0
        local slot_GD_20 = 0
        
        --Send data via UDP
        if MySocket then
        --                                Slots:      GE01  GE02  GE03  GE04  GE05  GE06  GE07  GE08  GE09  GV01  GV02  GV03  GV04  GV05  GV06  GV07  GV08  GD01  GD02  GD03  GD04  GD05  GD06  GD07  GD08  GD09  GD10  GD11  GD12  GD13  GD14  GD15  GD16  GD17  GD18  GD19  GD20
            socket.try(MySocket:send(string.format("%.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; \n",
                                                    slot_GE_01,
                                                    slot_GE_02,
                                                    slot_GE_03,
                                                    slot_GE_04,
                                                    slot_GE_05,
                                                    slot_GE_06,
                                                    slot_GE_07,
                                                    slot_GE_08,
                                                    slot_GE_09,
                                                    slot_GV_01,
                                                    slot_GV_02,
                                                    slot_GV_03,
                                                    slot_GV_04,
                                                    slot_GV_05,
                                                    slot_GV_06,
                                                    slot_GV_07,
                                                    slot_GV_08,
                                                    slot_GD_01,
                                                    slot_GD_02,
                                                    slot_GD_03,
                                                    slot_GD_04,
                                                    slot_GD_05,
                                                    slot_GD_06,
                                                    slot_GD_07,
                                                    slot_GD_08,
                                                    slot_GD_09,
                                                    slot_GD_10,
                                                    slot_GD_11,
                                                    slot_GD_12,
                                                    slot_GD_13,
                                                    slot_GD_14,
                                                    slot_GD_15,
                                                    slot_GD_16,
                                                    slot_GD_17,
                                                    slot_GD_18,
                                                    slot_GD_19,
                                                    slot_GD_20
                                                    )))
        end
    end
    
    function SimTools_Callbacks.onSimulationStop()
        
        log.write('SimTools', log.INFO, "Motion data export stopped")
    
        if MySocket then
            MySocket:close()
        end
    end
    
    --register these callbacks with DCS to be called at the appropriate moment.
    DCS.setUserCallbacks(SimTools_Callbacks)
    
    
    
    
    ------------------------------------------------------------------------------------
    -----------------------------   HELPER FUNCTIONS   ---------------------------------
    ------------------------------------------------------------------------------------
    
    
    function WheelSpin()
        if (OnGround == 1)
            then
                return GS
            else
                return 0
        end   
        
    end
    
    • Like Like x 2
  12. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    Just a word of caution, GetDevice(0) will not pick up all values happily.
    I have been playing with the other values like Canopy (138) and then nothing works, while adding something like Boost (39) works fine.
    Its important for the wind to know the canopy state to switch off the outside fan, so would still like to understand how to extract ALL available values, but for now I guess I can always insert a physical switch in the circuit. Not that you would notice sitting inside the cockpit anyway..
  13. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,910Coins
    Ratings:
    +878 / 3 / -0
    I noticed that you are making the call to...
    Code:
    MainPanel = Export.GetDevice(0)
    ...inside the...
    Code:
    function SimTools_Callbacks.onSimulationFrame()
    That means it is called every frame. It may be less expensive to make that call only once in the...
    Code:
    function SimTools_Callbacks.onSimulationStart()
    ...and then have "MainPanel" as a reference to use every frame. I haven't tested it, but should work.
    Also, afaik DCS' lua interpreter is extremely lightweight and I can barely imagine it would make a huge difference.

    I know that for some aircraft types the argument values (some? all?) are listed in a file called "mainpanel_init.lua" and I think they are specific to each type. So, if you know the argument value for the Spitfire, doesn't mean that the same value will work on the L-39. That means if you are using different A/C types, you will have to add code to the script that checks which type is in use and then use the appropriate argument values.

    Another point to watch out for if you use values from "MainPanel" could be that the value you're getting is truely only the cockpit indiction, as opposed to the actual measured physical value. For example, if your RPM indicator (the instrument) is malfunctioning, you may get erroneous behavior on your rig!

    Just be aware :)
    • Like Like x 1
  14. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,910Coins
    Ratings:
    +878 / 3 / -0
    Here's how it COULD work (untested!)

    Code:
    local MySelf = LoGetSelfData()
    
    if MySelf.Name == "P-51D"  then
        --do stuff here
    
    elseif MySelf.Name == "SpitfireLFMkIX" or MySelf.Name == "SpitfireLFMkIXCW" then
        --do other stuff here
    end
  15. RJ Stausebach

    RJ Stausebach Member Gold Contributor

    Joined:
    Jul 9, 2017
    Messages:
    49
    Location:
    Ireland
    Balance:
    287Coins
    Ratings:
    +12 / 0 / -0
    My Motion Simulator:
    Arduino
    Thanks, I guess in my case I only use the Spitfire so not applicable? The codes I selected that did not work were also related to the Spitfire, but I think they may be different types of values or something..
  16. Mikko Leino

    Mikko Leino New Member

    Joined:
    May 13, 2019
    Messages:
    6
    Occupation:
    Aircraft Maintenance Engineer
    Location:
    Finland
    Balance:
    189Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    4DOF
    Hello

    I suggest chopper pilots check this out.

    I always felt that simulating G-forces and aircraft behaviour in general worked better through AOA output. Sadly, preferring AOA over pitch (or pitch rate) in choppers resulted in weird jerking and shaking when hovering or flying at minimal airspeeds.
    Let me explain AOA behaviour in and around hover. When a helicopter moves forward and level - say- at 1 kts the angle of attack is zero. The moment the pilot adds collective, AOA dives below zero. Still keeping the craft level, descending makes the AOA jump anywhere between 0 and 89.999999.

    The added lines in this export.lua gets rid of AOA output at 0 kts. All other (angular rates, heave, surge, etc.) output normal values. AOA comes into effect gradually above 10 kts and at 60 kts the effect is full. Change these values to fit your needs.

    I hope this helps someone out of what I struggled with for a while. Thanks @value1 and @Dirty for an awesome plugin!

    Mikko

    -- AOA AND PITCH FIX (For smooth chopper hover and natural pitch behaviour)
    --Pitch/AoA speed sensitivity
    local maxFXspd = 60.00
    local midFXspd = 30.00
    local minFXspd = 10.00
    local AOAspeedCoeff = math.min ( IAS - minFXspd , midFXspd ) / midFXspd
    if AOAspeedCoeff < 0
    then AOA = 0
    else
    AOA = AOA * AOAspeedCoeff
    end
    local PitchCoeff = math.min ( IAS , maxFXspd ) / maxFXspd

    if IAS > minFXspd
    then Pitch = Pitch * PitchCoeff
    end

    --Reverse flight & extreme AOA angle cancellation
    local AOApeak = 45
    local AOAfade = 80

    if AOA < -AOAfade then AOA = 0
    elseif AOA < -AOApeak then AOA=AOA+(2*AOApeak)
    elseif AOA < 0 then AOA = -AOA
    elseif AOA < AOApeak then AOA = AOA
    elseif AOA < AOAfade then AOA = 80 - AOA
    else AOA = 0
    end
  17. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,910Coins
    Ratings:
    +878 / 3 / -0
    You're right. If you're using the exported value "AOA" you get the AOA of the hull with the oncoming airstream. That is fine for an airplane, but doesn't make much sense for a helo. At low horizontal speeds this value could become huge.

    I'm not sure if "rotor blade AOA" is available for export in DCS, or if it would even make sense to use. After all, rotor blade AOA changes (cycles) while the blade goes round the axis of rotation. That's why it's called "cyclic control" :)

    If your approach of fading out this value below ~10Kts works for you, then that's OK. It would mean, however, that you would get absolutely no cueing in the vertical DOF during liftoff or touchdown, as these normally take place well below 10Kts. Are you willing to make that trade-off?

    Instead of just fading out AOA, you could fade over between AOA and verticalG. A bit more code, but might be worth a try.
  18. Mikko Leino

    Mikko Leino New Member

    Joined:
    May 13, 2019
    Messages:
    6
    Occupation:
    Aircraft Maintenance Engineer
    Location:
    Finland
    Balance:
    189Coins
    Ratings:
    +4 / 0 / -0
    My Motion Simulator:
    4DOF
    I have been wondering about this... I never get heave to function on a chopper. But on a jet takeoff roll I sure feel the bouncing and when making sudden pitch changes in flight. I must check the output values tomorrow when i pull on the collective, to see if Im getting anything.

    Hm, I thought heave covers the vertical acceleration, regardless of airspeed? My version doesn't have the vertical G function.
  19. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,910Coins
    Ratings:
    +878 / 3 / -0
    Yes it does. But I understood that you were using AOA instead of verticalG. And that you were fading it out below 10Kts. In that case you should get nothing during liftoff/touchdown in a helo.

    Your fade-out wouldn't affect takeoff in an aircraft though, because you would be way past 10Kts pretty much after 2 seconds during takeoff roll.
  20. bester

    bester atomic

    Joined:
    Nov 2, 2015
    Messages:
    9
    Location:
    France
    Balance:
    - 31Coins
    Ratings:
    +5 / 0 / -0
    My Motion Simulator:
    2DOF
    Does anybody have a complete working code example for all Game vibe options ?
    RPM, Weapons, Landing gear, flaps etc...
    Many Thanks to dirty for this great plugin. :)