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. 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
    Hey guys :)

    first of all, a HUUUUUUUUUUUUGE THANKS to @value1 for allowing me access to the source of the DCS plugin! Never ever could I have come up with anything useful on my own in this regard.

    After a back and forth conversation with @Trip Rodriguez I noticed that the current DCS Plugin exports Euler angles. This leads to some "artefacts" (for lack of a better word) e.g. when rolling through inverted, or when pulling the nose up through the vertical.
    While many of you have learned to cope with those, I wanted to provide a plugin that uses angular rates instead, addressing some of the problems with Euler angles. Additionally I wanted to activate the 3 "Extra" parameters for users to export any data they want.

    Attached to this post you find an EXPERIMENTAL(!!!) plugin for testing :)

    These are the values it exports into the 9 standard slots available in Simtools:

    1. ROLL: Angular rate around the vehicle longitudinal axis in [°/s]
    2. PITCH: Angular rate around the vehicle lateral axis in [°/s]
    3. HEAVE: Acceleration along the vehicle vertical axis in [G]
    4. YAW: Angular rate around the vehicle vertical axis in [°/s]
    5. SWAY: Acceleration along the vehicle lateral axis in [G]
    6. SURGE: Acceleration along the vehicle longitudinal axis in [G]
    7. EXTRA1: OnGround detection as [1/0]
    8. EXTRA2: Indicated airspeed in [Kts]
    9. EXTRA3: Angle of attack of the airfoil in[°]

    Notes:
    1. The OnGround detection is based on the right main gear strut compression. I have not yet tested this for all aircraft. Especially taildraggers are untested. Please report if this is unreliable on your aircraft.
    2. I suspect a bug in DCS concerning erroneous values coming from LoGetIndicatedAirSpeed() and LoGetTrueAirSpeed() in non-zero wind conditions. When used in zero wind conditions it returns correct values. I will try to confirm on the ED forums.
    3. The Extra-slots can be used to export any data. Feel free to play around with the Export.lua:
    Code:
    ---------------------------------------------------------------------------------------------------
    -- EXPERIMENTAL export plugin for SimTools V2.3 (created by Value1, modified by Dirty)
    -- Version 0.01
    ---------------------------------------------------------------------------------------------------
    
    
    Myfunction =
    {
    Start=function(self)
        package.path = package.path..";.\\LuaSocket\\?.lua"
        package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
        socket = require("socket")
    
        my_init = socket.protect(function()
            -- export telemetry to SimTools
            host1 = host1 or "127.0.0.1"
            port1 = port1 or 41230
            c = socket.udp ( )
            c:settimeout ( 0 )
            c:setpeername ( host1, port1 )
        end)
        my_init()
    end,
    
    
    AfterNextFrame=function(self)
        --Euler Angles
        local mySelf = LoGetSelfData()
            local Yaw =     mySelf.Heading
            local Pitch =     mySelf.Pitch
            local Bank =     mySelf.Bank
        local accel = LoGetAccelerationUnits()
        local omega = LoGetAngularVelocity()
    
        --Weight On Wheels
        local NoseGear = LoGetAircraftDrawArgumentValue(1)
        local RightGear = LoGetAircraftDrawArgumentValue(4)
        local LeftGear = LoGetAircraftDrawArgumentValue(6)
     
        local WOW                    -- WOW = Weight on Wheels
        if RightGear > 0 then
            WOW = 1
        else
            WOW = 0
        end
    
        --Air Data
        local AOA = LoGetAngleOfAttack();
        local IAS = LoGetIndicatedAirSpeed()
    
        --send data via UDP
        my_send = socket.protect(function()
            if c then
                socket.try(c:send(string.format("%.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f;\n", omega.x, omega.y, omega.z, accel.x, accel.y, accel.z, WeightOnWheels,IAS,AOA)))
    
                end
        end)
        my_send()
    
    end,
    
    
    Stop=function(self)
        my_close = socket.protect(function()
            if c then
                c:close()
            end
        end)
        my_close()
    end
    }
    
    
    -- =============
    -- Overload
    -- =============
    
    -- Works once just before mission start.
    do
        local PrevLuaExportStart=LuaExportStart
        LuaExportStart=function()
            Myfunction:Start()
            if PrevLuaExportStart then
                PrevLuaExportStart()
            end
        end
    end
    
    -- Works just after every simulation frame.
    do
        local PrevLuaExportAfterNextFrame=LuaExportAfterNextFrame
        LuaExportAfterNextFrame=function()
            Myfunction:AfterNextFrame()
            if PrevLuaExportAfterNextFrame then
                PrevLuaExportAfterNextFrame()
            end
        end
    end
    
    -- Works once just after mission stop.
    do
        local PrevLuaExportStop=LuaExportStop
        LuaExportStop=function()
            Myfunction:Stop()
            if PrevLuaExportStop then
                PrevLuaExportStop()
            end
        end
    end
    


    If you want to use the angular rates for motion cueing, I recommend you use a 1st order highpass filter followed by a 1st order lowpass filter. This should be available in FlyPT as "EMA LP(HP)". And I think the new SimTools v2.4 contains new filters for this. I haven't had time to try it out, so maybe someone can confirm?

    If you have any suggestions/request/questions let me know.

    Dirty :)


    ------------------- EDIT -------------------
    Latest version is v0.10, Download below :)

    Attached Files:

    • Winner Winner x 9
    • Like Like x 2
    • Funny Funny x 1
    Last edited: Nov 6, 2020
  2. Trip Rodriguez

    Trip Rodriguez VR Pilot

    Joined:
    May 8, 2016
    Messages:
    675
    Location:
    Lake Ariel, Pennsylvania
    Balance:
    3,922Coins
    Ratings:
    +330 / 6 / -0
    My Motion Simulator:
    6DOF
    Awesome work!

    I do suggest allowing any/all landing gear suspension trigger "on ground". The way you have it now, if you have a bad landing where the left wheel hits first the "bounce" will be in air mode (soft cue) instead of ground mode (hard cue). The big bounces are way too much fun to miss! =D Likewise if the tail wheel or nose wheel hit first, similar situation.

    To detect any/all wheels on ground I believe you want to use 0,1,4,5,6 . I will be testing 0 and 5 tonight to confirm, the others are certain.

    I'm very curious to see how/if I can make use of the ground detection in SimTools. I probably won't have enough time to tune and experiment and get real testing done on this until monday due to company from out of town being here. I will try to get a short test in tonight.

    I will, of course, be using this LUA and Plugin in conjunction with FlyPT. =)
    • Agree Agree x 1
  3. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,163
    Location:
    Portugal
    Balance:
    15,284Coins
    Ratings:
    +2,539 / 17 / -0
    My Motion Simulator:
    6DOF
    I'm now using 1, 4 and 6.
    4 and 6 left/right compression
    1 front or rear compression
    2 front or rear turning

    But I only have the demo, so...
    • Like Like x 1
  4. 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
    Good idea! Yeah, I guess that makes sense. I'm gonna do this.

    ...would you by any chance happen to know if there is a list somewhere that lists all parameters that can be used with LoGetAircraftDrawArgumentValue(n) and their meaning?
    • Like Like x 1
  5. 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
    • Like Like x 1
  6. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,040
    Location:
    USA
    Balance:
    5,841Coins
    Ratings:
    +1,040 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    Sweet! Thank you guys! Those thumps in loops were jarring.
  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
    v0.02 now available in the first post.

    Any gear strut will trigger OnGround

    Code:
    local WOW = 0        --WOW = Weight On Wheels
        if (LeftGear > 0 or NoseGear > 0 or RightGear > 0)
            then
                WOW = 1
            else
                WOW = 0
        end
    ...still untested for most aircraft.
    • Like Like x 1
  8. 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
    Testet with the P51 and works great :)
    • Like Like x 1
  9. Trip Rodriguez

    Trip Rodriguez VR Pilot

    Joined:
    May 8, 2016
    Messages:
    675
    Location:
    Lake Ariel, Pennsylvania
    Balance:
    3,922Coins
    Ratings:
    +330 / 6 / -0
    My Motion Simulator:
    6DOF
    I swear I'm going to test it asap! Sim hasn't moved since Friday due to family obligations and catching a bug (virus I guess) of some sort. Tomorrow I have to do US Independence day social gatherings. I have to cut the six 1/2" grade eight bolts off the motor braces so I can reinstall the braces, and then I'll be starting to fly with this LUA/SimTools and let you know how it goes!
    Last edited: Jul 4, 2019
  10. Trip Rodriguez

    Trip Rodriguez VR Pilot

    Joined:
    May 8, 2016
    Messages:
    675
    Location:
    Lake Ariel, Pennsylvania
    Balance:
    3,922Coins
    Ratings:
    +330 / 6 / -0
    My Motion Simulator:
    6DOF
    Hi Dirty! Finally got back to the sim tonight, so first thing I'm doing is setting up to test your plugin.

    I've got a question though, and my apologies if you've already told me. How do I use the on-ground detection (extra 1) to give different cues when I'm on the ground vs. in air?
  11. Trip Rodriguez

    Trip Rodriguez VR Pilot

    Joined:
    May 8, 2016
    Messages:
    675
    Location:
    Lake Ariel, Pennsylvania
    Balance:
    3,922Coins
    Ratings:
    +330 / 6 / -0
    My Motion Simulator:
    6DOF
    Ok I put a couple hours in tonight playing with this. Data coming out of the plugin looks really good as near as I could tell but I was having some issues that seemed to be related to my using FlyPT's SimTools 6DOF interface.

    First I figured out to get FlyPT's graphical sim representation to work right I had to number my actuators (starting with #1) 5,6,1,2,3,4. But then when I fired up DCS it was all wrong. So then I tried going back to proper numbering, expecting that to fix it and it was still wrong.

    Don't trust my results 100% though, I'm highly prone to making errors! I will try again this week to verify my results.

    I should definitely test with heXpod software, and see how that goes. I just hate to have to worry about one actuator going out of range bringing all motion to a stop until it comes back into range. That is totally unacceptable to me.

    With my new setup however, If I just limit my surge and especially heave a lot more than I'd like I shouldn't go out of range much if at all. I really want to use as much heave as possible. It's only moments that it's at the extreme ends of it's travel and clipping other cues and big heave gives more sense of flight than anything else IMO.
    Last edited: Jul 7, 2019
  12. 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
    Hey Trip :)

    so far, the OnGround value really doesn't do anything other than showing the status of the detection logic to the user. In this first step I just wanted people to be able to check if the detection logic is working properly. So far, I found it to work reliable, but please report if anyone finds it to be wrong.

    The question of what to do with the information is something that certainly deserves an answer:
    1. Personally, I think the "correct" way to handle things would be to let the plugin only export the data, and then let SimTools, FlyPT-Mover, Nutkicker, BFF, or X-Sim do the processing. It would be a nice and clean separation between the modules, letting each module serve only one purpose. However, I am not sure which software would allow to change the filter variables depending on this value. For Nutkicker I can say that this is a feature I have planned, but will not have available in the first version.
    2. As a preliminary workaround it would be possible to let the plugin export different data depending on the OnGround status. It would allow users to set a gain-value for the different channels, but that would only increase or decrease the values themselves, not change the filter settings that processes the data. I will implement it in the .lua file to test it.
    Dirty :)
    • Like Like x 1
    • Friendly Friendly x 1
  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
    here's an updated Export.lua

    Code:
    ---------------------------------------------------------------------------------------------------
    -- Experimental Export plugin for SimTools V2.3 (created by Value1, modified by Dirty)
    -- Version 0.03
    ---------------------------------------------------------------------------------------------------
    
    
    Myfunction =
    {
    Start=function(self)
        package.path = package.path..";.\\LuaSocket\\?.lua"
        package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
        socket = require("socket")
    
        my_init = socket.protect(function()
            -- export telemetry to SimTools
            host1 = host1 or "127.0.0.1"
            port1 = port1 or 41230
            c = socket.udp ( )
            c:settimeout ( 0 )
            c:setpeername ( host1, port1 )
        end)
        my_init()
    end,
    
    
    AfterNextFrame=function(self)
        --Euler Angles
        local mySelf = LoGetSelfData()
            local Yaw =     mySelf.Heading
            local Pitch =     mySelf.Pitch
            local Bank =     mySelf.Bank
        local accel = LoGetAccelerationUnits()
        local omega = LoGetAngularVelocity()
        
        --Air Data
        local IAS = LoGetIndicatedAirSpeed()
        local AOA = LoGetAngleOfAttack();
    
        --Weight On Wheels
        local LeftGear = LoGetAircraftDrawArgumentValue(6)
        local NoseGear = LoGetAircraftDrawArgumentValue(1)
        local RightGear = LoGetAircraftDrawArgumentValue(4)
        
        local WOW = 0        --WOW = Weight On Wheels
        if (LeftGear > 0 or NoseGear > 0 or RightGear > 0)
            then
                WOW = 1
            else
                WOW = 0
        end
    
        --change exported values when on ground
        if (WOW == 1) then
            accel.x = accel.x * 1.00
            accel.y = accel.y * 1.00
            accel.z = accel.z * 1.00
        end
    
    
        --send data via UDP
        my_send = socket.protect(function()
            if c then
                socket.try(c:send(string.format("%.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f; %.4f;\n", omega.x, omega.y, omega.z, accel.x, accel.y, accel.z, WOW,IAS,AOA)))
    
                end
        end)
        my_send()
    
    end,
    
    
    Stop=function(self)
        my_close = socket.protect(function()
            if c then
                c:close()
            end
        end)
        my_close()
    end
    }
    
    
    -- =============
    -- Overload
    -- =============
    
    -- Works once just before mission start.
    do
        local PrevLuaExportStart=LuaExportStart
        LuaExportStart=function()
            Myfunction:Start()
            if PrevLuaExportStart then
                PrevLuaExportStart()
            end
        end
    end
    
    -- Works just after every simulation frame.
    do
        local PrevLuaExportAfterNextFrame=LuaExportAfterNextFrame
        LuaExportAfterNextFrame=function()
            Myfunction:AfterNextFrame()
            if PrevLuaExportAfterNextFrame then
                PrevLuaExportAfterNextFrame()
            end
        end
    end
    
    -- Works once just after mission stop.
    do
        local PrevLuaExportStop=LuaExportStop
        LuaExportStop=function()
            Myfunction:Stop()
            if PrevLuaExportStop then
                PrevLuaExportStop()
            end
        end
    end
    
    If you want to change the gain of the accelerations on ground, change these values in a text-editor:
    Bildschirmfoto 2019-07-07 um 21.30.28.png
    ...I will recompile the plugin tomorrow to have this included in version 0.03

    Dirty :)
    • Like Like x 1
  14. Trip Rodriguez

    Trip Rodriguez VR Pilot

    Joined:
    May 8, 2016
    Messages:
    675
    Location:
    Lake Ariel, Pennsylvania
    Balance:
    3,922Coins
    Ratings:
    +330 / 6 / -0
    My Motion Simulator:
    6DOF
    Cool! I do agree however that it would be best to let the kinematics software do the job, but this is a good option to have, especially in the meantime.

    It sounds like maybe you didn't see the implementation of this in FlyPT Mover's direct DCS World mode. He has set up two 'sources' (for the same data), and the LUA decides which source to send the telemetry to based on the "on-ground" value.

    So I am able to set up a 100% different "rig" for on the ground. This is fantastic! I was able to tune ground handling with absolutely zero compromises, which is a first and made me super, super happy. Maybe you might consider a similar implementation.

    Anyway it sounds to me like @pmvcda and @hexpod might want to both implement a way to utilize the "on-ground" trigger coming from the plugin. Something in their software that could be used for all flight sims essentially.

    I have to set up IL-2 BoS for playing with a friend but I'm going to be frowning every time I feel the cues on the ground, since I'm now spoiled by having this amazing feature in FlyPT.

    Also of note: FlyPT was concerned about the transition between ground and air mode, but so far all my testing has shown that the transition is flawless. I do agree with you though, that a gradual fade from one to the other would be ideal, with the one exception of the landing bump, and any subsequent bouncing due to pilot error. =D I used to execute (with the exception here and there) perfect butter smooth landings. This is what my 92 year old Dad calls a "grease job", he learned to fly in the 1940's so I don't know if that terminology is still used today. Anyway, now that I have the motion sim I love to feel that landing bump so I no longer go for the "grease job" landing.

    There are certain moments in flight that I feel have the biggest psychological impact on making me feel the thrill of flight. These are the takeoff run, the large upward heave movement as you leave the ground, and the touchdown bump. These three things are always given very high priority for me when I'm tuning the simulator.
    • Like Like x 1
  15. 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
    Updated to v0.03
    • Like Like x 1
  16. gbdesai

    gbdesai New Member Gold Contributor

    Joined:
    May 28, 2019
    Messages:
    23
    Balance:
    84Coins
    Ratings:
    +7 / 0 / -0
    Any ideas on why this may not be installing? I removed the regular DCS plugin and killed all SimTools apps. I used the plugin updater and it says it installed, but I can't find a DCS related plugin in the plugin directory nor the drop down list in Game Manager. Sorry, maybe a newb question, but I'm a newb...
  17. 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
    Are you using the demo version of SimTools, as that won't utilise any plugin except LFS, which is provided for testing purposes. A licensed version of SimTools is needed for other plugins.
    • Agree Agree x 1
    • Informative Informative x 1
  18. gbdesai

    gbdesai New Member Gold Contributor

    Joined:
    May 28, 2019
    Messages:
    23
    Balance:
    84Coins
    Ratings:
    +7 / 0 / -0
    No, Pro version, I had full motion working in the standard DCS plug-in but got whiplash completing a roll. Couldn't get the FLT settings to work either in the regular plug-in. Wanted to try this one. So I removed all DCS related stuff from the c:\users\[user]\AppData\Local\SimTools directory and tried to use Plugin Updater to install the plugin. It said it worked, but no trace of the plugin to be found.
  19. gbdesai

    gbdesai New Member Gold Contributor

    Joined:
    May 28, 2019
    Messages:
    23
    Balance:
    84Coins
    Ratings:
    +7 / 0 / -0
    I just tried reinstalling the regular DCS plugin and it installed fine. Weird. If I try to install the experimental plugin manually, I get an error saying it's an invalid plugin.
  20. Trip Rodriguez

    Trip Rodriguez VR Pilot

    Joined:
    May 8, 2016
    Messages:
    675
    Location:
    Lake Ariel, Pennsylvania
    Balance:
    3,922Coins
    Ratings:
    +330 / 6 / -0
    My Motion Simulator:
    6DOF
    I'll try to get some testing in as soon as possible and see if I have the same problem.

    I didn't have any issues installing the older version of Dirty's plugin, but I don't think I've tried the most recent one yet.

    Last go around what actually stopped me was that I couldn't get the SimTools 6DOF interface (by FlyPT) to talk to the AMC1280USB. FlyPT Mover works with the AMC no problem, but the native SimTools 6DOF interface version was the one I couldn't figure out how to make work.
    • Like Like x 1