Jump to content

Virtual copilot addon


Peter Pukhnoy

Recommended Posts

  • Replies 367
  • Created
  • Last Reply

Top Posters In This Topic

  • Peter Pukhnoy

    143

  • Igor Petrov

    79

  • John Rooum

    21

  • Ju_li_en Ke_ml_er

    20

Top Posters In This Topic

Popular Posts

Thanks for letting me know, I'll upload an update later today or tomorrow.

The trigger for the copilot to start waiting for your FMGC setup is the chocks being set. Judging by the log, the chocks are off in the 'on APU' state. Yes - even if you start with the chocks s

Posted Images

Peter Pukhnoy
56 minutes ago, Eric Sanchez said:

I can't seem to get it to work
Can you help me ?

Could you verify that your Prepar3D v5 Add-ons and your FSUIPC folders look similar to this :

1886069386_addonsfolder.PNG.a2e68ea22313b927638cd36c05c976b6.PNG

944058660_fsuipcfolder.PNG.a30eb930131bbe98d298f1f45dac11ae.PNG

Link to post

With FS labs 320 v119, copilot is not lowering the flaps during after start checks. All other actions appear ok and the log file looks normal with no errors.

Something  I am forgetting or do we need a change for FS Labs next update?

Link to post
Peter Pukhnoy
1 hour ago, John Rooum said:

Something  I am forgetting or do we need a change for FS Labs next update?

Did you

  1. enter the T/O setting in the MCDU PERF page
  2. have an ATSU performance request

Those are the two ways that Copilot can read the takeoff flaps setting. ATSU logging needs to be enabled for 2.

EDIT: It does indeed not work because the title of the takeoff performance MCDU page has been repositioned slightly. Please wait for a fix.

Link to post
  • 1 month later...
Enrique Perez

Good evening,sorry in advance i I ask for something which is already solved, but Im suffering since last 2 days to get copilot working.

My sim:p3d v5.1 H.F.1

FSLABS A320/A321 Update v5.0.1.126

I checked both folders mentioned by Peter -Prepar3D v5 Add-ons --ok-- and FSUIPC -not appears FSLABSCOPILOT.LUA

Any help more than wellcome.

 

Thanks

 

Link to post
Peter Pukhnoy
37 minutes ago, Enrique Perez said:

FSUIPC -not appears FSLABSCOPILOT.LUA

The file won't go there by itself, you need to unzip it :) Perhaps you placed the Modules folder in the FSUIPC folder as opposed to the contents of the Modules folder which is what you should have done?

Link to post
Enrique Perez

Thanks Peter for your response.

I placed the contents o the Modules folder in the FSUIPC folder, not the older itself.I attach photo to show how my FSUIPC looks like.

The point is that the missed file I mentioned, I cant find it in the unzip original folder downloaded.

 

Thanks in advance.

fsuipc.png

modules.png

Link to post
Peter Pukhnoy
6 hours ago, Enrique Perez said:

Now working...dont ask me how...:)...Thanks anyways 

Just so you know, the file is there in your screenshot - just under FSUIPC6.dll :D You have the option 'Hide extensions for known file types' enabled in Windows.

Link to post
Peter Pukhnoy
5 hours ago, Michael Gold said:

Hello @Peter Pukhnoy is it possible this could be causing a bug of sorts where the scratchpad on the MCDU is automatically cleared even when I'm not clicking it? Video attached -- I think I have only noticed this after installing your (wonderfully useful!) script.

 

It's intentional, but you can disable it https://forums.flightsimlabs.com/index.php?/topic/25298-copilot-lua-script/&do=findComment&comment=205664

 

  • Thanks 1
Link to post
  • 3 weeks later...
Michael Gold

Thank you, @Peter Pukhnoy. Do you think it would be possible for you to add functionality to configure the script to turn which lights it turns on/off? For example, a lot of US carriers turn off the wing lights at 10,000ft, or in case you've forgotten to turn the turnoff/taxi lights to have it clean those up at 10,000ft as well?

Link to post
Peter Pukhnoy
4 hours ago, Michael Gold said:

Do you think it would be possible for you to add functionality to configure the script to turn which lights it turns on/off?

You can add your own lua code to extend the default functionality.

The code for your concrete example would like like this:

local tenThousandDepOrig = copilot.sequences.tenThousandDep

function copilot.sequences.tenThousandDep()
  FSL.OVHD_EXTLT_Wing_Switch("OFF")
  FSL.OVHD_EXTLT_RwyTurnoff_Switch("OFF")
  FSL.OVHD_EXTLT_Nose_Switch("OFF")
  tenThousandDepOrig()
end

This will prepend the additional commands to the default sequence. To make Copilot load the code, save it in a .lua file with the name of your choice (for example, my_procedures.lua) inside your FSUIPC folder/FSLabs Copilot/custom.

More examples can be found in the manual.

  • Thanks 1
Link to post
Michael Gold
On 1/30/2021 at 2:14 AM, Peter Pukhnoy said:

You can add your own lua code to extend the default functionality.

The code for your concrete example would like like this:


local tenThousandDepOrig = copilot.sequences.tenThousandDep

function copilot.sequences.tenThousandDep()
  FSL.OVHD_EXTLT_Wing_Switch("OFF")
  FSL.OVHD_EXTLT_RwyTurnoff_Switch("OFF")
  FSL.OVHD_EXTLT_Nose_Switch("OFF")
  tenThousandDepOrig()
end

This will prepend the additional commands to the default sequence. To make Copilot load the code, save it in a .lua file with the name of your choice (for example, my_procedures.lua) inside your FSUIPC folder/FSLabs Copilot/custom.

More examples can be found in the manual.

This worked perfectly, Peter, thanks again!

I do have one more question for you if you don't mind. I had a look through the manual but couldn't figure it out. If possible, I'd like to change the lineup action trigger from hitting the seatbelt switch twice to when the wing lights come on. I've found the relevant section in the actions.lua section, but I know nothing about this kind of scripting and I'm not sure what to change, or what to cut out and change and put in a custom .lua file -- can you give me any direction for this one as well, please?

Also, if I wanted to change those to also flip those switches on descending through 10,000ft, would I just change tenThousandDep to tenThousandArr?

Link to post
Peter Pukhnoy
8 hours ago, Michael Gold said:

If possible, I'd like to change the lineup action trigger from hitting the seatbelt switch twice to when the wing lights come on.

Try pasting the following into your file. The last line just adds a random delay between 1 and 5 seconds. You can remove it if you want.

function copilot.sequences.waitForLineup()
  repeat copilot.suspend(1000)
  until FSL.OVHD_EXTLT_Wing_Switch:getPosn() == "ON"
  copilot.suspend(1000, 5000)
end

 

8 hours ago, Michael Gold said:

Also, if I wanted to change those to also flip those switches on descending through 10,000ft, would I just change tenThousandDep to tenThousandArr?

Yes, whenever you want to append or prepend something to a default sequence, you can just wrap the original function with your own actions like I've shown in the previous post. However, I see that the overhead light flipping section is in the middle of the original tenThousandArr, so if you want your lights to be turned on with the rest of the lights, you'll need to copy/paste the original function and insert flipping your lights where you want them.

To test it, you can just call the function in the same file: copilot.sequences.tenThousandArr(). Restart Copilot from its Add-ons menu and it will run immediately.

Link to post
Michael Gold
9 hours ago, Peter Pukhnoy said:

Try pasting the following into your file. The last line just adds a random delay between 1 and 5 seconds. You can remove it if you want.


function copilot.sequences.waitForLineup()
  repeat copilot.suspend(1000)
  until FSL.OVHD_EXTLT_Wing_Switch:getPosn() == "ON"
  copilot.suspend(1000, 5000)
end

 

Will this work without a "local" line like the one in what you shared with me before? As in, as a whole file:

local tenThousandDepOrig = copilot.sequences.tenThousandDep

function copilot.sequences.tenThousandDep()
  FSL.OVHD_EXTLT_Wing_Switch("OFF")
  FSL.OVHD_EXTLT_RwyTurnoff_Switch("OFF")
  FSL.OVHD_EXTLT_Nose_Switch("OFF")
  tenThousandDepOrig()
end

function copilot.sequences.waitForLineup()
  repeat copilot.suspend(1000)
  until FSL.OVHD_EXTLT_Wing_Switch:getPosn() == "ON"
  copilot.suspend(1000, 5000)
end

 

9 hours ago, Peter Pukhnoy said:

Yes, whenever you want to append or prepend something to a default sequence, you can just wrap the original function with your own actions like I've shown in the previous post. However, I see that the overhead light flipping section is in the middle of the original tenThousandArr, so if you want your lights to be turned on with the rest of the lights, you'll need to copy/paste the original function and insert flipping your lights where you want them.

Is this correct?

function copilot.sequences:tenThousandArr()

  FSL.PED_MCDU_KEY_PERF()
  copilot.sleep(plusminus(500))
  while not FSL.MCDU:getString(1,48):find("APPR") do
    FSL.PED_MCDU_LSK_R6()
    copilot.sleep(100)
  end
  local disp = FSL.MCDU:getString(49,71)
  local LS = disp:find("ILS") or disp:find("LOC")

  moveTwoSwitches(FSL.OVHD_EXTLT_Land_L_Switch, "ON", FSL.OVHD_EXTLT_Land_R_Switch,"ON", 0.9)
  FSL.OVHD_SIGNS_SeatBelts_Switch("ON"),FSL.OVHD_EXTLT_Wing_Switch("ON"), FSL.OVHD_EXTLT_RwyTurnoff_Switch("ON"), 
  FSL.OVHD_EXTLT_Nose_Switch("ON")

  if not FSL.GSLD_EFIS_CSTR_Button:isLit() then FSL.GSLD_EFIS_CSTR_Button() end
  FSL.GSLD_EFIS_ND_Range_Knob("20")
  if LS and not FSL.GSLD_EFIS_LS_Button:isLit() then FSL.GSLD_EFIS_LS_Button() end

  FSL.PED_MCDU_KEY_RADNAV()
  copilot.sleep(plusminus(5000))
  FSL.PED_MCDU_KEY_PROG()

end

Thanks!

Link to post
Peter Pukhnoy
7 minutes ago, Michael Gold said:

Will this work without a "local" line like the one in what you shared with me before? As in, as a whole file:

Yes, it will work. In the other example, you needed to save the reference to the original function so that you could call it later. Here, you don't need to call the original function.

8 minutes ago, Michael Gold said:

Is this correct?

Almost - you can't separate statements with commas. Just remove them and you'll be fine.

Link to post
Michael Gold
43 minutes ago, Peter Pukhnoy said:

Almost - you can't separate statements with commas. Just remove them and you'll be fine.

So like this?

  moveTwoSwitches(FSL.OVHD_EXTLT_Land_L_Switch, "ON", FSL.OVHD_EXTLT_Land_R_Switch,"ON", 0.9)
  FSL.OVHD_SIGNS_SeatBelts_Switch("ON")FSL.OVHD_EXTLT_Wing_Switch("ON")FSL.OVHD_EXTLT_RwyTurnoff_Switch("ON")
  FSL.OVHD_EXTLT_Nose_Switch("ON")

 

Link to post
  • 4 weeks later...
Luke Hall

Hello.

I'm really enjoying this excellent addon. It adds all of the help that I want without the hassle of a particular co-pilot addon I was using!

I'm using it in P3DV5 without voice activation and it's all working well apart from a few minor things:

1. My co-pilot chappie isn't switching the weather radar PWS to AUTO, Setting the AUTO BRK, or Pressing the TO CONFIG following the brake and control checks, but he is setting the Weather radar to SYS 1 or 2, so I assume the BRAKE and CONTROL checks are registering as complete.

2. He's not selecting LS when an ILS approach is selected in the MCDU after descending through 10,000 but he is completing the other descent items.

3. Finally, he's not starting the APU, though he is completing the other after landing checks properly.

None of these are the end of the world, but it would be nice to have them working, so any suggestions would be gratefully received :-)

Thanks for making this great module, I'm very impressed!

Luke

Link to post
Peter Pukhnoy
1 hour ago, Luke Hall said:

Thanks for making this great module, I'm very impressed!

Thanks for the positive feedback!

Try the following first:

Create a file called test.lua (or any other name) in your FSUIPC folder with the following content:

FSL = require "FSL2Lua"
FSL.CheckMacros()

Bind it to a key in the FSUIPC assignments menu and run. The name of the control will be Lua Test; if you created the file after starting FSUIPC, you'll need to press Reload All Keys first.

The script will print messages in the FSUIPC log.

  • Like 1
Link to post
Luke Hall

Hi,

Thanks for your response :-)

I think I did it correctly, this is the last part of my FSUIPC.log file:

 1440359 ---------------------- Joystick Device Scan -----------------------
  1440359 Product= Saitek Pro Flight Combat Rudder Pedals
  1440359    Manufacturer= Saitek
  1440359    Vendor=06A3, Product=0764 (Version 2.1)
  1440359    GUIDs returned for product: VID_06A3&PID_0764:
  1440359       GUID= {31FCEBD0-267C-11E9-8002-444553540000}
  1440359       Details: Btns=0, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R1023,U0,V0,X127,Y127,Z0
  1440422 Product= Joystick - HOTAS Warthog
  1440422    Manufacturer= Thustmaster
  1440422    Vendor=044F, Product=0402 (Version 1.0)
  1440422    GUIDs returned for product: VID_044F&PID_0402:
  1440422       GUID= {31FCEBD0-267C-11E9-8003-444553540000}
  1440422       Details: Btns=19, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U0,V0,X65535,Y65535,Z0
  1440422 -------------------------------------------------------------------
  1440422 Device acquired for use:
  1440422    Joystick ID = 1 (Registry okay)
  1440422    1=Saitek Pro Flight Combat Rudder Pedals
  1440422    1.GUID={31FCEBD0-267C-11E9-8002-444553540000}
  1440422 Device acquired for use:
  1440422    Joystick ID = 2 (Registry okay)
  1440422    2=Joystick - HOTAS Warthog
  1440422    2.GUID={31FCEBD0-267C-11E9-8003-444553540000}
  1440422 -------------------------------------------------------------------
  1440469 Aircraft="FSLabs A320X CFM - easyJet A320-214 (G-EZWE)"
  1464234 LUA.6: ------------------------------------------------------
  1464234 LUA.6: Checking macros!
  1482563 LUA.6: Finished checking macros!
  1490922 ### Mode: PAUSE on
 

Link to post
Peter Pukhnoy
44 minutes ago, Luke Hall said:

I think I did it correctly

Yes - and it didn't show any errors :( I think the problem might be that the copilot doesn't hold the buttons depressed long enough for the press to register. I will be uploading a new version in a week or so and I will add the option to increase the pause between pressing and releasing buttons.

The PWS switch is a bit bugged with mouse macros in that it won't move after you invoke the macro only once which is why my code does it twice with a pause in between, but apperently that's not always enough so I'll see if I can do something.

  • Like 1
Link to post
Luke Hall
7 minutes ago, Peter Pukhnoy said:

Yes - and it didn't show any errors :( I think the problem might be that the copilot doesn't hold the buttons depressed long enough for the press to register. I will be uploading a new version in a week or so and I will add the option to increase the pause between pressing and releasing buttons.

The PWS switch is a bit bugged with mouse macros in that it won't move after you invoke the macro only once which is why my code does it twice with a pause in between, but apperently that's not always enough so I'll see if I can do something.

Hi Peter,

Sure, what you've said makes sense. Thanks again for having a look at it for me.
It's great that you're continuing to support and develop this and I'll look forward to trying the next version!

Best wishes,

Luke

Link to post
Luke Hall

I just thought I'd update this...

I have discovered that I wasn't fully completing the control checks during taxi. Specifically my rudder check wasn't being recognised due to a calibration issue with my pedals. Now that I've fixed it, the co pilot is completing the taxy checks properly, including setting the auto brake and PWS. So, there's no bug there.

The only function that is still not working is starting the APU after landing on spoiler disarm.

Best wishes,

 

Luke

Link to post
  • 2 weeks later...
Peter Pukhnoy
On 2/28/2021 at 1:46 AM, Luke Hall said:

Finally, he's not starting the APU

This should be fixed in the latest version.

Link to post
John Rooum
Peter Pukhnoy
20 minutes ago, John Rooum said:

One major change from v1 versions seemed to be the use of ".ogg" sound files rather than the previous wav files. So I changed back to the original v1 sounds folder and all was well? As FS Labs has always used ogg sound files - which play ok on my system - cannot think of reason why copilot should not be able to play them?

Well, that's embarrassing :rolleyes: I didn't think to change the extension in the code that loads the files. On my machine it still worked because I didn't delete the wav files. I'll upload a fix today. Thanks for reporting!

  • Like 1
Link to post
  • 2 weeks later...
Igor Petrov

Hello Peter,

[01:26:44] [debug] Event: Engine shutdown
[01:26:44] [debug] Action: 'stop' 'Waiting for the brake check' on event 'Engine shutdown'
[01:26:44] [debug] Action: 'stop' 'Waiting for the flight controls check' on event 'Engine shutdown'
[01:26:44] [debug] Action: B98100CF0
[01:26:44] [debug] Action: 'stop' 'Lineup' on event 'Engine shutdown'

What is Action: B98100CF0? I haven't used it yet, just checked the log.

Latest P3Dv5, FSLA320, CPv2.04 here.

Thanks,

Link to post
Peter Pukhnoy
30 minutes ago, Igor Petrov said:

What is Action: B98100CF0? I haven't used it yet, just checked the log.

I don't know, but it's nothing important. If an Action doesn't have a log tag, its lua table id is used in the log.

Just to be clear, an Action isn't necessarily something like the after start or lineup action. It's just any event listener.

  • Like 1
Link to post
Igor Petrov

From the manual:

Quote

Here's how to make the bindings:

  1. Create the file Copilot for FSLabs\scripts\autorun.lua

What's written there, sorry I can't get my head around that. How to creat a file for another file, in this case for autorun.lua? What does that mean?

Thanks. 

Link to post
Peter Pukhnoy
9 minutes ago, Igor Petrov said:

What does that mean?

It means "create the file autorun.lua in the scripts folder". You can also watch the example video that's on the same page where I do that.

Link to post
Igor Petrov
18 minutes ago, Peter Pukhnoy said:

You can also watch the example video that's on the same page where I do that.

Unfortunately I can't make out what you're showing there, the letters are tiny, video is in fast motion and you don't explain what you're doing there anyway.

Anyway I'm trying fo figure out. 

Thanks!

Edited by Igor Petrov
Link to post
Igor Petrov

So, I'm trying to bind a button on my joystick for unmute Copilot to listen to my command when pressed and mute it when released. I'm going to create autoran.lua and write the following script in it:

Bind { key = "A", onPress = unmuteCopilot, onRelease =  muteCopilot}

 Shall I add Smoke toggle in FSUIPC and assign A button to that function?

Thanks. 

Link to post
  • Peter Pukhnoy changed the title to Virtual copilot addon

×
×
  • Create New...