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

FlyPT Mover

Discussion in 'FlyPt Mover' started by pmvcda, May 30, 2019.

  1. DerKlausi

    DerKlausi New Member

    Joined:
    Aug 7, 2022
    Messages:
    22
    Balance:
    117Coins
    Ratings:
    +10 / 0 / -0
    See modified .lua script below. Credits to @pmvcda for the original version.

    Code:
    --[[
    
    DCS LUA SCRIPT FOR FLYPT MOVER 3.5.2
    ====================================
    Version from 27 08 2021
    This file should be placed in the folder "C:\Users\YOUR USERNAME\Saved Games\DCS\Scripts\Hooks".
    If the "Hooks" folder doen's exist, create it.
    
    2023/05/04: script enhanced by a FlyPT Mover user to stop telemetry data export if plane is destroyed / player killed. The aim is to prevent violent
    rig motion which is associated with DCS switching to external view and showing the plane spinning and disintegrating.
    This simple detection of player death / plane destruction relies on two criteria:
        1. at least one of a selection of warnings from LoGetMCPState() is detected, the selected warnings focus more on structural damage than instrument failures.
        2. the camera position has changed by more than 5 units (metres) in all 3 coordinates; this is indicative of DCS switching to external view.
    Experiments have shown that both criteria may not be satisfied within the same frame, but with a small delay of some centiseconds. Hence the use of HitIndicator1 & 2 as
    fuses which are tripped as soon as the corresponding condition is met for the first time. Only if both are found to be tripped, the telemetry data export will be stopped.
    Use at your own risk! Please note there may be rare situations where this results in a false positive even if no missile hit has occured!
    
    ]]--
    
    
    Flag1 = 0
    Flag2 = 0
    HitIndicator1 = 0
    HitIndicator2 = 0
    
    local FlyPT_Mover_Callbacks = {}
    
    function FlyPT_Mover_Callbacks.onSimulationStart()
    
        log.write('FlyPT_Mover', log.INFO, "Starting data export")
        package.path = package.path..";.\\LuaSocket\\?.lua"
        package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
        socket = require("socket")
        DCSClient = socket.udp()
        DCSClient:settimeout(0)
        DCSIP = "127.0.0.1"
        DCSPort = 4124 -- If changed, the source should match this value
        DCSClient:setpeername(DCSIP, DCSPort)
           
    end
    
    function FlyPT_Mover_Callbacks.onSimulationFrame()
    
        local FailCount = 0        -- This is a sum parameter used to evaluate plane health
    
        local acceleration = Export.LoGetAccelerationUnits()
        local speed = Export.LoGetVectorVelocity()
        local pitch, roll, yaw = Export.LoGetADIPitchBankYaw()
        local rotationSpeed = Export.LoGetAngularVelocity()
        local altitude = Export.LoGetAltitudeAboveGroundLevel()
        local o = Export.LoGetSelfData()
        --[[
        LatLongAlt.Lat -- Latitude in degress
        LatLongAlt.Long -- Longitude in degress
        LatLongAlt.Alt -- Altitude in meters MSL
        Heading -- Heading in radians
        Pitch -- Pitch in radians
        Bank -- Bank in radians
        ]]--
       
        local mechInfo=Export.LoGetMechInfo()
        --[[
        gear          = {status,value,main = {left = {rod},right = {rod},nose =  {rod}}}
        flaps          = {status,value}
        speedbrakes   = {status,value}
        refuelingboom = {status,value}
        airintake     = {status,value}
        noseflap      = {status,value}
        parachute     = {status,value}
        wheelbrakes   = {status,value}
        hook          = {status,value}
        wing          = {status,value}
        canopy        = {status,value}
        controlsurfaces = {elevator = {left,right},eleron = {left,right},rudder = {left,right}}
        ]]--
       
        alarm = Export.LoGetMCPState()
        --[[
            returned table keys for LoGetMCPState():
            "LeftEngineFailure"
            "RightEngineFailure"
            "HydraulicsFailure"
            "ACSFailure"
            "AutopilotFailure"
            "AutopilotOn"
            "MasterWarning"
            "LeftTailPlaneFailure"
            "RightTailPlaneFailure"
            "LeftAileronFailure"
            "RightAileronFailure"
            "CanopyOpen"
            "CannonFailure"
            "StallSignalization"
            "LeftMainPumpFailure"
            "RightMainPumpFailure"
            "LeftWingPumpFailure"
            "RightWingPumpFailure"
            "RadarFailure"
            "EOSFailure"
            "MLWSFailure"
            "RWSFailure"
            "ECMFailure"
            "GearFailure"
            "MFDFailure"
            "HUDFailure"
            "HelmetFailure"
            "FuelTankDamage"
        ]]--
    
    -- Query camera position
    
        local CameraPosition = Export.LoGetCameraPosition()
        local CamPos = CameraPosition.p
        if Flag2 == 0 then
            CamPosOld = CameraPosition.p
        end
    
        local stall = 0
        for k,v in pairs(alarm) do
            if k == "StallSignalization" then
                if v == true then
                    stall = 1
                end
            end
        end
    
    -- Evaluate relevant warnings and increase FailCount if true
    
        for k,v in pairs(alarm) do
            if k == "LeftEngineFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "RightEngineFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "MasterWarning" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "HelmetFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "HydraulicsFailure" then
                if v == true then
                    FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "LeftAileronFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
    
        for k,v in pairs(alarm) do
            if k == "RightAileronFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "LeftWingPumpFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "RightWingPumpFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "FuelTankDamage" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end  
        for k,v in pairs(alarm) do
            if k == "LeftTailPlaneFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "RightTailPlaneFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "LeftMainPumpFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "RightMainPumpFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "GearFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
        for k,v in pairs(alarm) do
            if k == "RadarFailure" then
                if v == true then
                FailCount = FailCount + 1
                end
            end
        end
    
    -- Simple detection of plane destruction / player death
    
        if ( (math.abs(CamPos.x - CamPosOld.x) > 5) and (math.abs(CamPos.y - CamPosOld.y) > 5) and (math.abs(CamPos.z - CamPosOld.z) > 5) )
        then
            HitIndicator1 = 1
        end
        if (FailCount > 0)
        then
            HitIndicator2 = 1
        end
    
        if (HitIndicator1 == 1) and (HitIndicator2 == 1)
            then
                if Flag1 == 0 then  
                    log.write('FlyPT_Mover', log.INFO, "Ownship destruction / player death detected, stopping telemetry data export.")
                    FlyPT_Mover_Callbacks.onSimulationStop()
                    Flag1 = 1
                end
            end
    
        CamPosOld = CamPos
        Flag2 = 1
    
        -- local engine = LoGetEngineInfo()
        --[[
        RPM = {left, right},(%)
        Temperature = { left, right}, (Celcium degrees)
        HydraulicPressure = {left ,right},kg per square centimeter
        FuelConsumption   = {left ,right},kg per sec
        fuel_internal      -- fuel quantity internal tanks    kg
        fuel_external      -- fuel quantity external tanks    kg  
        ]]--
    
        -- The FlyPT Mover uses Z for vertical and Y to the front
        -- That's the opposite in DCS
        -- Values sent in one string, separated by spaces  
        socket.try(DCSClient:send(
        --               00   01   02   03   04   05   06   07   08   09   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24
        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",
        acceleration.x,                             -- 00 = Lateral acceleration (G)
        acceleration.z,                             -- 01 = Lateral acceleration (G)
        acceleration.y,                             -- 02 = Vertical acceleration (G)
        speed.x,                                     -- 03 = Lateral speed (m/s)
        speed.z,                                     -- 04 = Longitudinal speed (m/s)
        speed.y,                                     -- 05 = Vertical speed (m/s)
        rotationSpeed.y,                             -- 06 = Rotation speed around y (yaw in rad/s)
        rotationSpeed.x,                             -- 07 = Rotation speed around x (roll in rad/s)
        rotationSpeed.z,                             -- 08 = Rotation speed around z (pitch in rad/s)
        o.Heading,                                     -- 09 = Yaw position (rad)
        o.Bank,                                     -- 10 = Roll position (rad)
        o.Pitch,                                     -- 11 = Pitch position (rad)
        Export.LoGetTrueAirSpeed(),                 -- 12 = Air speed (m/s)
        Export.LoGetAircraftDrawArgumentValue(1),     -- 13 = Front/Rear landing gear (0 to 1)?
        Export.LoGetAircraftDrawArgumentValue(2),     -- 14 = Turning landing gear (0 to 1)?
        Export.LoGetAircraftDrawArgumentValue(4),    -- 15 = Left landing gear (0 to 1)?
        Export.LoGetAircraftDrawArgumentValue(6),     -- 16 = Right landing gear (0 to 1)?
        Export.LoGetAltitudeAboveGroundLevel(),     -- 17 = Vertical position relative to ground (m)
        mechInfo.flaps.value,                         -- 18 = Flaps amount (%)
        mechInfo.gear.value,                         -- 19 = Delployed landing gear (%)
        mechInfo.speedbrakes.value,                 -- 20 = Speed brakes (%)
        mechInfo.canopy.value,                         -- 21 = Canopy open (%)
        stall,                                         -- 22 = Stall alarm (0 or 1)
        Export.LoGetAngleOfAttack(),                 -- 23 = Angle of attack
        Export.LoGetModelTime()                     -- 24 = Time in seconds
        )))
    
    
    
    end
    
    function FlyPT_Mover_Callbacks.onSimulationStop()
        log.write('FlyPT_Mover', log.INFO, "Data export stopped")
        Flag1 = 0
        Flag2 = 0
        HitIndicator1 = 0
        HitIndicator2 = 0
        if DCSClient then
            DCSClient:close()
        end
    end
    
    DCS.setUserCallbacks(FlyPT_Mover_Callbacks)
    

    • Useful Useful x 2
    • Like Like x 1
  2. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,107
    Location:
    Portugal
    Balance:
    14,963Coins
    Ratings:
    +2,508 / 17 / -0
    My Motion Simulator:
    6DOF
    Thanks,

    I will try. Seems coincidence, you just got me updating Lua scripts for BeamNG.drive.
    I will pick DCS next and try.
    In the next release, patching is included in the sources
    • Like Like x 3
  3. smitty

    smitty Active Member

    Joined:
    Aug 24, 2021
    Messages:
    132
    Balance:
    818Coins
    Ratings:
    +183 / 2 / -0
    My Motion Simulator:
    6DOF
    I too am getting these jolts on ground to air switching.. try some filtering on the Rig page, in the Actuators field. That catches everything sent by the poses. Also the transition speed on the Source page can be slowed down. I havent figured it out completely but they are much smaller jolts
  4. smitty

    smitty Active Member

    Joined:
    Aug 24, 2021
    Messages:
    132
    Balance:
    818Coins
    Ratings:
    +183 / 2 / -0
    My Motion Simulator:
    6DOF
    I am trying to get Custom Hooks going for City Car Driving. I believe i have found the pointers correctly in cheatengine, but in flypt i get no data. I also tried running Mover as admin. Is there something else i am doing wrong?

    upload_2023-5-7_12-42-11.png
  5. smitty

    smitty Active Member

    Joined:
    Aug 24, 2021
    Messages:
    132
    Balance:
    818Coins
    Ratings:
    +183 / 2 / -0
    My Motion Simulator:
    6DOF
    i noticed i missed a pointer 18C in the above but it still is not getting a value
    upload_2023-5-7_13-2-26.png
  6. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,107
    Location:
    Portugal
    Balance:
    14,963Coins
    Ratings:
    +2,508 / 17 / -0
    My Motion Simulator:
    6DOF
    Is the game 32bits or 64?

    Mover should be running with administrator privilege
  7. smitty

    smitty Active Member

    Joined:
    Aug 24, 2021
    Messages:
    132
    Balance:
    818Coins
    Ratings:
    +183 / 2 / -0
    My Motion Simulator:
    6DOF
    it's 32 bit. no matter what i put in for pointers, i get 0.000. I cant even get a single byte. mover is running as admin.
    also i can get more stable pointers in the form physics.dll + 8E2A14 + A0 but how are these entered in to the mover custom hook?
  8. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,107
    Location:
    Portugal
    Balance:
    14,963Coins
    Ratings:
    +2,508 / 17 / -0
    My Motion Simulator:
    6DOF
    I'm going to test it. I will say something after.
    • Like Like x 1
  9. Mauricio

    Mauricio Member Gold Contributor

    Joined:
    Mar 1, 2011
    Messages:
    38
    Balance:
    39Coins
    Ratings:
    +4 / 0 / -0
    Thank you so much. I gonna try at rig's page!
    • Like Like x 1
  10. Motion4Sim

    Motion4Sim Member

    Joined:
    Jun 13, 2020
    Messages:
    79
    Location:
    Europe
    Balance:
    663Coins
    Ratings:
    +109 / 1 / -0
    My Motion Simulator:
    Arduino, Motion platform, 6DOF
    Hi, does everyone have problems with msfs2020 source enabling and disabling autopilot only when mover is connected ?
    Thanks
  11. Tean33

    Tean33 New Member

    Joined:
    Jan 12, 2023
    Messages:
    26
    Balance:
    183Coins
    Ratings:
    +11 / 0 / -0
    My Motion Simulator:
    2DOF
    Hello @pmvcda and thank you for this great piece of software. I would like to make a donation but the Paypal link on your website points to a suspicious looking Google related address. Is it genuine? Sorry to be suspicious but I got hacked recently and am trying to be more security aware.
    • Like Like x 1
  12. sallerding

    sallerding Member

    Joined:
    Jul 12, 2019
    Messages:
    67
    Location:
    Perth, Western Australia
    Balance:
    344Coins
    Ratings:
    +37 / 0 / -0
    My Motion Simulator:
    AC motor, Motion platform, 6DOF
    Have not experienced that motion4sim. Mainly using pmdg 737
  13. stil550

    stil550 Member

    Joined:
    Aug 28, 2021
    Messages:
    34
    Location:
    USA
    Balance:
    309Coins
    Ratings:
    +23 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    Quick question regarding DCS and helicopter flying. Is there a way to get the shudder effect for the ETL be felt through the rig? I'm new to the helicopter flying, but what I'm reading through right now, is that the stage where the helicopter is going through its transitional lift, going from hover to flying and vice versa, the airframe shudders and it is suppose to be a good indication of the minimum speed at which the pilot should stay when they transition to a hover for a landing, "Riding the shudder".

    I do not get a distinctive shudder in my 3DOF rig, using FlyPT. Any suggestions? I can probably fake it with a noise filter, attached to a specific speed, but was hoping to get a more "natural" feel.
  14. misoswan

    misoswan Active Member

    Joined:
    Jun 27, 2014
    Messages:
    291
    Balance:
    1,032Coins
    Ratings:
    +76 / 1 / -0
    My Motion Simulator:
    3DOF, Arduino, JRK
    yes it's possible I have a profile (not mine) for a 6 dof platform if I get to drop speed my platform starts to shake (you can set the shaking force you want)
  15. Mauricio

    Mauricio Member Gold Contributor

    Joined:
    Mar 1, 2011
    Messages:
    38
    Balance:
    39Coins
    Ratings:
    +4 / 0 / -0
    Hi everyone! How are you guys doing?

    I am having some problems with the movements of the plataform, and I don't know if its possible to solve it via software. It´s mainly on the flight simulators.

    For example, in the roll movement, when I am turning to the left and, suddently, make a right turn, the platform makes a big shake, then start rolling to the right. As it seems, this happens all the time there´s some movement that invert the direction the platform is going, because it´s not only on roll. To clarify this last statment, when the heave is pushing down and, right before it stops, it start to go up, there´s this skake in the transition of the movements.

    Is there some filter I can put to solve this? I tried all combinations of EMALP possible. This happens at SimTools as well.
  16. stil550

    stil550 Member

    Joined:
    Aug 28, 2021
    Messages:
    34
    Location:
    USA
    Balance:
    309Coins
    Ratings:
    +23 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    Can you share your profile please.
    I've done this in mine via the noise, attached it to the speed and had a roll-over filter so that it peaks at around 20 but gradually rolls-off both ways towards 0 as well as after going above 20 knots towards 40. Works pretty well so I'm happy with it, but still would like to see how others have implemented it.
  17. Avee

    Avee Virtual Pilot

    Joined:
    Jul 5, 2020
    Messages:
    141
    Location:
    Germany
    Balance:
    1,119Coins
    Ratings:
    +35 / 1 / -0
    My Motion Simulator:
    2DOF
    @pmvcda Any progress to share on v3.7?
    • Like Like x 4
  18. smitty

    smitty Active Member

    Joined:
    Aug 24, 2021
    Messages:
    132
    Balance:
    818Coins
    Ratings:
    +183 / 2 / -0
    My Motion Simulator:
    6DOF
    I made a pose from noise with the input Speed in m/s and the value filter:
    MUL(ADD(LOGISTIC(ADD(CROP(ADD(MUL(ABS(ADD(VALUE;-18));-1);3.6);0;4);-2);1;1);.9);.3)
    upload_2023-6-23_8-40-46.png

    the -18 sets the center speed (its negative to move the curve) and the 3.6 is the +/- range. then set the min/max of the noise to 0 and 1. This is for MSFS which has separate air/ground poses, i only added it to air so that it doesnt even need to be switched off for planes because we're still on the ground at those low speeds.
  19. stil550

    stil550 Member

    Joined:
    Aug 28, 2021
    Messages:
    34
    Location:
    USA
    Balance:
    309Coins
    Ratings:
    +23 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino

    Thanks! Yeah this is very close to what I did as well, except I didn't even bother refining it via the LOGISTIC, its a straight slope up and down. Since it's a pretty rough noise, I don't feel any abrupt on/off for it even with a sharp transition from 0 to start of the noise. Thanks for sharing.
  20. stil550

    stil550 Member

    Joined:
    Aug 28, 2021
    Messages:
    34
    Location:
    USA
    Balance:
    309Coins
    Ratings:
    +23 / 0 / -0
    My Motion Simulator:
    3DOF, Arduino
    Another question in regards to DCS.
    I'm trying to get another noise going, for when on the ground, idling. Right now the helicopter feels dead when just sitting on the ground at low RPMs, I'm hoping to get some rocking motion into it, just a tiny bit but get something in there to make it feel alive.

    RPM is not registering in DCS, does anyone know if that can be fixed? I'm assuming RPM is probably a retrievable value since it's a pretty universal parameter in any sim. Am I doing something wrong?

    I'm hoping to tie RPM value to some kind of a motion, so that it rocks a little bit at low RPM values and then smooths out at higher.
    • Like Like x 1