Notifications
Clear all

DCS custom export.lua and Simtools settings  

  RSS

Mikko
(@mikko)
New Member
Joined: 2 years ago
Posts: 4
17/10/2020 9:52 pm  

Hi all

Thought I'd share my export.lua, which I'm quite pleased with. I have added some functions that make especially heliopter flying more realistic and rich in feedback. I have a background in general aviation, mainly sailplanes. Therefore I really enjoy what Value1 and Dirty have done with the roll rate function, which is far more realistic than holding a steady tilt when banking / climbing. The AOA function is also great but I encountered serious problems with helicopters.

When flying slowly or hovering, the AOA shifts abruptly between positive and negative values. For example, climbing / descending at slow speeds gives a value of anything between -90° and +90° AOA. Again, flying backwards outputs values from -90° to -180° and +90° to +180°. Flying backwards and transitioning from descent to climbing results in -180° to +180° jerk. Highly annoying and distracting.

The export.lua I attached here outputs no AOA values at low airspeeds, but outputs pitch/bank rate values. While speed increases, the AOA values gradually increase and angle rates decrease. Works great on helos, and pulling high AOA manoeuvres in a MIG29 feel awesome.

I am flying in VR, in which this setup works great! Let me know what you guys think. You might want to dial up yaw, pitch an roll for helos and down for jets. Try an aileron roll in the F-15 and you know what I mean. 😉

Below is the code and pics of the settings are in the next post.

Mikko

 

Code: (copy and replace your export.lua code, don't forget to backup the original)

---------------------------------------------------------------------------------------------------
-- Experimental Export plugin for SimTools V2.35 (created by Value1, modified by Dirty)
-- Version 0.05

-- Added AOA speed & attitude sensitivity for choppers by Mikko
---------------------------------------------------------------------------------------------------


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 OnGround = 0        --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


--change exported values when on ground
    if (OnGround == 1) then
        accel.x = accel.x * 2.00
        accel.y = accel.y * 3.00
        accel.z = accel.z * 2.00
        omega.x = omega.x * 1.00
        omega.y = omega.y * 1.00
        omega.z = omega.z * 1.00
    end
 
 

-- 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    
--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, OnGround, 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



Quote
Mikko
(@mikko)
New Member
Joined: 2 years ago
Posts: 4
17/10/2020 9:55 pm  

Wait for it...


ReplyQuote
Mikko
(@mikko)
New Member
Joined: 2 years ago
Posts: 4
17/10/2020 9:57 pm  

Ok, now I've posted more than one post and I'm able to attach files 🙂 Enjoy.

DCS tuning
DCS axes1
DCS axes2
This post was modified 3 months ago by Mikko

ReplyQuote
JMB-3D
(@jmb-3d)
Estimable Member Customer
Joined: 3 years ago
Posts: 107
21/10/2020 2:40 pm  

Hello Miko

Thank for sharing, i have not tried flight sims yet but may do in the future, thanks for sharing. 

ive just posted a video to help feel the Yaw movement, you may find it informative, 

https://forum.fasetech.com/share-configurations/race-cube-dd2-mounting-yaw-improvement-news/#post-684  

My Rig - Fasetech Racing Cube Simulator (4DOF)
Vive Pro, Asus ROG STRIX X299-E GAMING Motherboard, Intel Core i9-7900X CPU
Asus GeForce RTX 2080 Ti DUAL OC 11GB ,
Fanatec Cs Elite wheel, v1.5 Shifter, Hand brake, He Pro Pedals, Carbon fibre bucket seat, Wind Sim, WAITING ON...Pimax 8KX VR


ReplyQuote
Share: