Page 5 of 8 FirstFirst 12345678 LastLast
Results 41 to 50 of 78

Thread: PMDG Offsets

  1. #41
    75+ Posting Member Daveanne's Avatar
    Join Date
    Sep 2007
    Location
    Ellesmere Port, Cheshire
    Posts
    129
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    After the smoothing...

    Mr R, have tried out the programme you sent me and its realy difficult to see if the smoothing works successfully or not, because the results numbers are changing all the time its difficult to observe if they are "dampening" down the movement.

    If possible could you download the FS2Phidgets programme from the "download" section of this site and also install the Phidgets software from their site.

    Once installed the FS2Phidgets interface has an emulation section which immitates and graphically shows a servo, assign it to the throttle and then you will be able to see if the smoothing has a marked effect or not?

    If you don't feel like doing that, then please let me know how I interface the "smoothing" results into the FS2Phidgets interface and I will trial the emulated servo myself?

    Hope you can help?

    Daveanne

  2. #42
    25+ Posting Member
    Join Date
    Feb 2009
    Location
    Preston, UK
    Posts
    37
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Hi,

    I will have a play with the software and see if i can get something working, it is likely that, because the throttle output is moving constantly, we will need to add some dampening code, that will not move the servo until a large enough change occurs,

    dont worry we will sort it, I dont let software beat me

  3. #43
    25+ Posting Member
    Join Date
    Feb 2009
    Location
    Preston, UK
    Posts
    37
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    well thats a fun little app, didnt realise there was a servo emulator

    ok so here is the new code

    Code:
    -- "Display Vals" example LUA plug-in, by Pete Dowson, September 2008
    
    thr1Array = {0,0,0,0,0}
    thr2Array = {0,0,0,0,0}
    thr1Smooth = 1
    thr2Smooth = 1
    thr1LastPos = 1
    thr2LastPos = 1
    loop = 1
    -- Loop forever: to stop this you'll have to use the LuaKill control on it.
    while 1 do
    
    	thr1 = ipc.readSW(0x088C)
    	thr2 = ipc.readSW(0x0924)
    
       if loop<5 then
     
            thr1Array[loop] = thr1
            thr2Array[loop] = thr2
            loop = loop + 1
     
            thr1Smooth = thr1Array[1]
            thr2Smooth = thr1Array[1]            
     
        else
            thr1Smooth = (thr1Array[1] + thr1Array[2] + thr1Array[3] +thr1Array[4] +thr1Array[5]) / 5
            thr2Smooth = (thr2Array[1] + thr2Array[2] + thr2Array[3] +thr2Array[4] +thr2Array[5]) / 5
     
            --shift the array
     
            thr1Array[1] = thr1Array[2]
            thr1Array[2] = thr1Array[3]
            thr1Array[3] = thr1Array[4]
            thr1Array[4] = thr1Array[5]
            thr1Array[5] = thr1
     
            thr2Array[1] = thr2Array[2]
            thr2Array[2] = thr2Array[3]
            thr2Array[3] = thr2Array[4]
            thr2Array[4] = thr2Array[5]
            thr2Array[5] = thr2
     
        end
    
    	
    --write to the offset
    	if thr1Smooth > thr1LastPos + 600 or thr1Smooth < thr1LastPos - 600 then
    		ipc.writeSW(0x66C0, thr1Smooth)
    		thr1LastPos = thr1Smooth 
    	end
    
    	if thr2Smooth > thr2LastPos + 600 or thr2Smooth < thr2LastPos - 600 then
    		ipc.writeSW(0x66C2, thr2Smooth)
    		thr2LastPos = thr2Smooth 
    	end
    	
    
    ipc.display("thr1="..thr1.."\nthr1Smooth="..thr1Smooth.."\nthr2="..thr2.."\nthr2Smooth="..thr2Smooth.."\nthr1LastPos
    
    ="..thr1LastPos)
    
    ipc.sleep(300)
    
    end



    this is the clever bit

    Code:
    	if thr1Smooth > thr1LastPos + 600 or thr1Smooth < thr1LastPos - 600 then
    		ipc.writeSW(0x66C0, thr1Smooth)
    		thr1LastPos = thr1Smooth 
    	end
    
    	if thr2Smooth > thr2LastPos + 600 or thr2Smooth < thr2LastPos - 600 then
    		ipc.writeSW(0x66C2, thr2Smooth)
    		thr2LastPos = thr2Smooth 
    	end
    what we are saying here... If the throttle hasnt moved by at least 600 units then dont update, we then write the value to two FSUIPC offsets

    66c0 and 66c2

    you will need to create a variable in fs2phidgets that points to these offsets and then map the servo to this variable to see the change

    if this works you can then just tweak the range we ignore to increase the 'null' zone

    hope this makes sense!

  4. #44
    75+ Posting Member Daveanne's Avatar
    Join Date
    Sep 2007
    Location
    Ellesmere Port, Cheshire
    Posts
    129
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    OK so far, but nothing happens....?

    OK, have done all that as directed, have assigned the emulated servo to 66C0 and gave it a name of ENGINE_T1_LEVER.

    However when mapping the servo in FS2P the servo now doesn't move at all, even the FS numbers in the table do not increase/decrease.

    ?

    Daveanne

  5. #45
    75+ Posting Member Daveanne's Avatar
    Join Date
    Sep 2007
    Location
    Ellesmere Port, Cheshire
    Posts
    129
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    P.S.

    P.S. Also the display has gone away and is no loger visible.

    Daveanne

  6. #46
    25+ Posting Member
    Join Date
    Feb 2009
    Location
    Preston, UK
    Posts
    37
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    i think its a formatting error when you have pasted it into notepad, the display should still appear

    the line that reads ipc.display should all be one line and include the ="..thr1LastPos) part.. will paste it in without the code tags

    -- "Display Vals" example LUA plug-in, by Pete Dowson, September 2008

    thr1Array = {0,0,0,0,0}
    thr2Array = {0,0,0,0,0}
    thr1Smooth = 1
    thr2Smooth = 1
    thr1LastPos = 1
    thr2LastPos = 1
    loop = 1
    -- Loop forever: to stop this you'll have to use the LuaKill control on it.
    while 1 do

    thr1 = ipc.readSW(0x088C)
    thr2 = ipc.readSW(0x0924)

    if loop<5 then

    thr1Array[loop] = thr1
    thr2Array[loop] = thr2
    loop = loop + 1

    thr1Smooth = thr1Array[1]
    thr2Smooth = thr1Array[1]

    else
    thr1Smooth = (thr1Array[1] + thr1Array[2] + thr1Array[3] +thr1Array[4] +thr1Array[5]) / 5
    thr2Smooth = (thr2Array[1] + thr2Array[2] + thr2Array[3] +thr2Array[4] +thr2Array[5]) / 5

    --shift the array

    thr1Array[1] = thr1Array[2]
    thr1Array[2] = thr1Array[3]
    thr1Array[3] = thr1Array[4]
    thr1Array[4] = thr1Array[5]
    thr1Array[5] = thr1

    thr2Array[1] = thr2Array[2]
    thr2Array[2] = thr2Array[3]
    thr2Array[3] = thr2Array[4]
    thr2Array[4] = thr2Array[5]
    thr2Array[5] = thr2

    end


    --write to the offset
    if thr1Smooth > thr1LastPos + 600 or thr1Smooth < thr1LastPos - 600 then
    ipc.writeSW(0x66C0, thr1Smooth)
    thr1LastPos = thr1Smooth
    end

    if thr2Smooth > thr2LastPos + 600 or thr2Smooth < thr2LastPos - 600 then
    ipc.writeSW(0x66C2, thr2Smooth)
    thr2LastPos = thr2Smooth
    end
    ipc.display("thr1="..thr1.."\nthr1Smooth="..thr1Smooth.."\nthr2="..thr2.."\nthr2Smooth="..thr2Smooth.."\nthr1LastPos="..thr1LastPos)

    ipc.sleep(300)

    end

  7. Thanks Daveanne thanked for this post
  8. #47
    300+ Forum Addict
    Join Date
    Jan 2007
    Posts
    496
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Quote Originally Posted by MrRoper View Post
    i think its a formatting error when you have pasted it into notepad, the display should still appear
    Why not just make the file and attach it? I've done it ... see attached.

    Regards

    Pete
    Attached Files Attached Files

  9. #48
    75+ Posting Member Daveanne's Avatar
    Join Date
    Sep 2007
    Location
    Ellesmere Port, Cheshire
    Posts
    129
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Excellent...!

    Well done sir, running very nicely indeed, graphic shows what the "smoother" is doing and the emulated servo shows the, "lack of" jerky movement too..!!

    Just need to try it on the real ones now, mind you I don't think I will have any problems with it.

    I have tried a few tweeks with the time intervals and I am sure that I can get it down to a fine level that will give smooth lever movements and a realistic setting for the engine N1's ect.

    I have set the programme (LUA throttlesmoothing) to start with a key stroke, how do I start that automatically each time I start FS?

    Presumeably if I do not want the graphic to pop up I delete that last part of the script?

    Once again, many thanks for very excellent help, its nice to know that there someone that is willing to help someone like me, who can build a sim pit, very handy with woodwork, modelling etc, but rather (not now) dumb with programming.

    Yet again, many thanks for your very welcome help.

    Daveanne

    P.S. hope you don't mind if I call on you again if I get more problems with this?

  10. #49
    300+ Forum Addict
    Join Date
    Jan 2007
    Posts
    496
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Quote Originally Posted by Daveanne View Post
    I have set the programme (LUA throttlesmoothing) to start with a key stroke, how do I start that automatically each time I start FS?
    Rename it to "IPCready.lua", as described in the FSUIPC Lua plug-in documentation. You can add anything in that file you want to run all the time. It starts when FS is ready to fly. There's an "IPCinit" facility too, starting earlier, but that doesn't suit anything involving aircraft control as it starts before the aircraft is loaded!

    Pete

  11. Thanks Daveanne thanked for this post
  12. #50
    75+ Posting Member Daveanne's Avatar
    Join Date
    Sep 2007
    Location
    Ellesmere Port, Cheshire
    Posts
    129
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Thanks Peter..

    Peter, thanks for that, I had read in your interim manual about having the programme starting automatically when FS is ready to fly, but didn't quite understand that was achieved just by re-naming the file, so thanks for clearing that up.

    Now I can see a programme working and where to place it, the whole subject is much clearer to see and indeed its prctical uses also.

    The original "fog" in my mind was how to put a programme together, but firstly once I had put one together where to put it within the programme (FS).

    Well just need to install all this into my pit now and report back as to how its gone.

    Many thanks for both of your help's

    Daveanne

Page 5 of 8 FirstFirst 12345678 LastLast

Similar Threads

  1. SIOC MCP 737 PMDG with PMDG 747 in fsx displays and leds don't work
    By dion73 in forum Computer Hardware Setup
    Replies: 7
    Last Post: 04-03-2011, 07:02 AM
  2. PMDG 737-800 OH lights offsets ???
    By Nick1150 in forum I/O Interfacing Hardware and Software
    Replies: 3
    Last Post: 11-03-2010, 12:59 PM
  3. Offsets
    By Kristoffer in forum Phidgets & Cockpit Simulator Builder
    Replies: 8
    Last Post: 04-26-2006, 07:35 AM
  4. MCP Course Set - Offsets
    By Rick Taylor in forum PM General Q & A
    Replies: 3
    Last Post: 02-02-2005, 08:25 AM