Jump to content

Copilot lua script


Peter Pukhnoy

Recommended Posts

  • Replies 178
  • Created
  • Last Reply

Top Posters In This Topic

  • Peter Pukhnoy

    72

  • Igor Petrov

    35

  • António Abreu

    14

  • Antonio King

    11

Top Posters In This Topic

Popular Posts

1.1.4 is compatible with A320-X v5.0.1.100-105, A319-X v4.0.1.100 and A321-X v5.0.1.103 Due to the script utilising mouse macros for its interaction with the cockpit controls, it might not functi

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

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

Posted Images

John Rooum

Hi Peter

Noticed this flying with copilot over the last 2 days. Seems new to v1.1.3 as I cannot remember this problem previously. Essentially it means one CDU is unusable when copilot is active. I normally run one cdu for normal aircraft operation with the other available for fs labs settings and the ATSU during flight - no problems with earlier versions. Seems a bit like “using a sledgehammer to crack a nut” as it’s easy to delete the messages manually as necessary.

is it essential to this version.?

John

Link to post
Peter Pukhnoy
2 hours ago, John Rooum said:

Hi Peter

Noticed this flying with copilot over the last 2 days. Seems new to v1.1.3 as I cannot remember this problem previously. Essentially it means one CDU is unusable when copilot is active. I normally run one cdu for normal aircraft operation with the other available for fs labs settings and the ATSU during flight - no problems with earlier versions. Seems a bit like “using a sledgehammer to crack a nut” as it’s easy to delete the messages manually as necessary.

is it essential to this version.?

John

I'm not sure why you weren't noticing this function before as it's always been there. I'm not going to remove it but I will make a list of the system messages so that it doesn't just clear out any message. I was too lazy to do that because I don't remember those by heart and I never use the second MCDU anyway.

You can disable this function by placing this file into FSLabs Copilot\custom: DontClearScratchpad.lua

Link to post
John Rooum

Thanks Peter. Just what was needed and works fine.

BTW I see no need to change it as you suggest - this lua along with the padelay give us lots of options to tune copilot as we wish

great programme!

  • Like 1
Link to post
Sergey Partolin

Hi
when installing this program, the sim crashes, with an error ucrtbase.dll

copilot 1.1.3

A320 - 5.0.1.101

sim - prepar3d v5 HF2

Link to post
Peter Pukhnoy
7 minutes ago, Sergey Partolin said:

Hi
when installing this program, the sim crashes, with an error ucrtbase.dll

copilot 1.1.3

A320 - 5.0.1.101

sim - prepar3d v5 HF2

Hi Sergey,

How did you determine that it's Copilot causing the crash?

At what point does the crash occur exactly?

Link to post
Stefan van Hierden

Wonderfull stuff and kudo's to you! I really like this addon.

 

I've seem to have issues after takeoff selecting flaps two by voice after a flaps 3 takeoff. When I manual select flaps two and later say flaps 1 the copilot seem to wake up again.

I don't have an issue requesting flaps 2 on landing so it doesn't seem to be my phrasing.

Ps, is it hard to program that the transponder is set to C on pushback instead of the lineup flow? Don't mind setting the transponder on manually but would like to have my copilot do it for me :P. Can I set it for example by a voice command myself in the option files?

 

Thanks!

Link to post
Peter Pukhnoy
2 hours ago, Stefan van Hierden said:

I've seem to have issues after takeoff selecting flaps two by voice after a flaps 3 takeoff. When I manual select flaps two and later say flaps 1 the copilot seem to wake up again

It's programmed like that according to real world operations - during a flaps 3 takeoff you go straight to flaps 1, skipping flaps 2.

2 hours ago, Stefan van Hierden said:

Ps, is it hard to program that the transponder is set to C on pushback instead of the lineup flow? Don't mind setting the transponder on manually but would like to have my copilot do it for me :P. Can I set it for example by a voice command myself in the option files?

You can add your own voice commands and more by making a lua plugin. The API documentation and some examples can be found in the manual. Adding voice commands couldn't be easier, however you should think about how to activate the voice commands as close as possible to when they're going to be used so as to minimize the chance of false recognition events. Here's some code that adds a voice command that is activated when the copilot is done with his preflight actions and sets the transponder to on when triggered:  plugin.lua You'll need to open the file and define the phrase(s) of the voice command. Drop it into FSUIPC folder\FSLabs Copilot\custom and it will be loaded when Copilot starts or is restarted.

  • Like 1
Link to post
Stefan van Hierden

Thank you Peter!

Never knew about flaps 3-1 logic :).
Will try the the voice commands. I've only used some basic lua in DCS and your example looks straight forward. Will have a look at the manual as well.

Link to post
Simon Dettling

Hi Peter

I recently did my first flight on the updated A321-X (v5.0.1.103).  I did have some small issues with the latest version of the Copilot lua script (1.1.3) that I wanted to report. (I didn't expect it to work though, as you stated that the latest version only works with the A320-X with version 5.0.1.100 and older builds in P3D v4).

I've built a custom script (attached) that sets up the flight deck to my liking after loading the "On Battery" Panel State. I noticed that some Knobs weren't triggered. Also during the different flight phases, some actions weren't triggered as before. In FSUIPIC.log I see:

259781 LUA.2: FSL2Lua: Control VC_GSLD_FCU_DimLt_Knob isn't responding to mouse macro commands
Most likely its macro is invalid
FSL2Lua version: 1.1.2
Check compatibility at https://forums.flightsimlabs.com/index.php?/topic/25298-copilot-lua-script/&tab=comments#comment-194432
source: ... v5 Add-ons\FSUIPC6\FSLabs Copilot\custom\custom.lua:61
   266375 LUA.2: FSL2Lua: Control VC_GSLD_CP_EFIS_VORADF_1_Switch isn't responding to mouse macro commands
Most likely its macro is invalid
FSL2Lua version: 1.1.2
Check compatibility at https://forums.flightsimlabs.com/index.php?/topic/25298-copilot-lua-script/&tab=comments#comment-194432
source: ... v5 Add-ons\FSUIPC6\FSLabs Copilot\custom\custom.lua:69
   274437 LUA.2: FSL2Lua: Control VC_PED_INTEG_LT_MainPnl_Knob isn't responding to mouse macro commands
Most likely its macro is invalid
FSL2Lua version: 1.1.2
Check compatibility at https://forums.flightsimlabs.com/index.php?/topic/25298-copilot-lua-script/&tab=comments#comment-194432
source: ... v5 Add-ons\FSUIPC6\FSLabs Copilot\custom\custom.lua:83
   276656 LUA.2: FSL2Lua: Control VC_PED_WXRadar_Tilt_Knob isn't responding to mouse macro commands
Most likely its macro is invalid
FSL2Lua version: 1.1.2
Check compatibility at https://forums.flightsimlabs.com/index.php?/topic/25298-copilot-lua-script/&tab=comments#comment-194432
source: ... v5 Add-ons\FSUIPC6\FSLabs Copilot\custom\custom.lua:85
   279312 LUA.2: FSL2Lua: Control VC_PED_ATCXPDR_THRT_Switch isn't responding to mouse macro commands
Most likely its macro is invalid
FSL2Lua version: 1.1.2
Check compatibility at https://forums.flightsimlabs.com/index.php?/topic/25298-copilot-lua-script/&tab=comments#comment-194432
source: ... v5 Add-ons\FSUIPC6\FSLabs Copilot\custom\custom.lua:87

With the A320-X (v5.0.1.103), everything seems to work just fine. :)

Thanks!

P.S. I do have version 1.1.3 installed, even though FSUIPC6.log mentions 1.1.2.

custom.lua

Copilot.log

FSUIPC6.log

Link to post
Peter Pukhnoy

@Simon Dettling

I have to admit that I've been a bit lazy with checking the macros since I haven't been simming myself for a while. I just assumed nothing has changed since I didn't see anything in the update log. I'll check now.

  • Thanks 1
Link to post
Peter Pukhnoy

@Simon Dettling Fixed in 1.1.4. You can check the macros when installing a new FSLabs version yourself, if you want - by running

FSL:disableSequences()
FSL.CheckMacros()

.

  • Thanks 1
Link to post
Simon Dettling
18 minutes ago, Peter Pukhnoy said:

@Simon Dettling Fixed in 1.1.4. You can check the macros when installing a new FSLabs version yourself, if you want - by running


FSL:disableSequences()
FSL.CheckMacros()

.

Just did a short test, works like a charm now! Thanks for the quick update :)

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

Can I use Copilot from a saved hold short situation, will it catch up to the position?

It will load in the same state as if you just started the engines.

Link to post
Igor Petrov

So, no way to bring it up to speed at a saved Hold short? Perhaps at Ready to taxi? Any suggestions? 

Thank you very much for you script btw, unlike FS2Crew it is very smart and delicate. 

Cheers,

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

So, no way to bring it up to speed at a saved Hold short? 

It will already be up to speed since it awaits lineup and takeoff after it detects engine start, so you can just start with triggering the lineup procedure. It will also be waiting for the brake and flight controls checks, but those can be skipped.

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

It will already be up to speed since it awaits lineup and takeoff after it detects engine start, so you can just start with triggering the lineup procedure. It will also be waiting for the brake and flight controls checks, but those can be skipped.

So, 2 Seat belts chimes after saved scenario loading, then, when ready, just throttle to flex/toga? Do I get that right? Do I miss anything else?

Thanks!

Link to post
Igor Petrov
On 8/2/2020 at 10:02 PM, Peter Pukhnoy said:

@Simon Dettling Fixed in 1.1.4. You can check the macros when installing a new FSLabs version yourself, if you want - by running


FSL:disableSequences()
FSL.CheckMacros()

.

Could you expand on that a little? Are these just 2 lines of a lua script, that I should drop in FSUIPC6 folder? What should I expect of them?

Thanks!

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

So, 2 Seat belts chimes after saved scenario loading, then, when ready, just throttle to flex/toga? Do I get that right?

Correct.

6 minutes ago, Igor Petrov said:

Could you expand on that a little? Are these just 2 lines of a lua script, that I should drop in FSUIPC6 folder? What should I expect of them?

This is just lua code I run each time an FSLabs update comes out  to check if the mouse macros have changed, you don't need this for normal operation.

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

Correct.

This is just lua code I run each time an FSLabs update comes out  to check if the mouse macros have changed, you don't need this for normal 

I'll try that, will there be some message on the screen? Where to look for the result of running it?

Thanks

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

Where to look for the result of running it?

In the FSUIPC logging output.

  • Like 1
Link to post
Igor Petrov
3 hours ago, Peter Pukhnoy said:

It will already be up to speed since it awaits lineup and takeoff after it detects engine start, so you can just start with triggering the lineup procedure. It will also be waiting for the brake and flight controls checks, but those can be skipped.

Unfortunately it does not, the brake application doesn't trigger WX radar, PWS, Auto BRK MAX, TO Config if loaded saved Hold short scenario.

Perhaps I'm doing something wrong, so where to check?

Thanks.

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

the brake application doesn't trigger WX radar, PWS, Auto BRK MAX, TO Config if loaded saved Hold short scenario.

Did you do the flight controls check? The trigger for the taxi procedure is completing the brake and the flight controls check.

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

Did you do the flight controls check? The trigger for the taxi procedure is completing the brake and the flight controls check.

Tried to do that as well to no avail, the script doesn't want to pick up from a saved scenario.

Any thoughts?

Thanks.

 

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

just reads out FMA.

I think you have something else running in parallel as my script doesn't read out the FMA.

18 minutes ago, Igor Petrov said:

Tried to do that as well to no avail, the script doesn't want to pick up from a saved scenario.

Have you been able to run it successfully without a saved scenario? Does the log show anything?

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

I think you have something else running in parallel as my script doesn't read out the FMA.

Have you been able to run it successfully without a saved scenario? Does the log show anything?

Sorry, it was: 

'Thrust set'
‘One hundred’
‘V1 (if it’s not played by the aircraft itself)
‘Rotate’
‘Positive climb’

And yes, it did work when from the beginning.

Thanks.

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

And yes, it did work when from the beginning.

Do the following please:

  1. Set log_level to 1 in options.ini
  2. Load your saved scenario
  3. Try to trigger the taxi procedure by doing the brake and flight control checks (there is a 30 second delay once the engines are running before you can do the latter)
  4. Attach the log file
Link to post
Igor Petrov
52 minutes ago, Peter Pukhnoy said:

Do the following please:

 

  1. Try to trigger the taxi procedure by doing the brake and flight control checks (there is a 30 second delay once the engines are running before you can do the latter)

You sure the brake check goes before the flight control check? It worked for me the other way around when from the beginning. Anything special about this particular order?

Thank you!

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

Anything special about this particular order?

No, the order shouldn't matter.

Link to post
Khoa Nguyen

Hi @Peter Pukhnoy, amazing mod thank you,

However today after my landing the Apu wasn't started, I thought it would start the apu as soon as I disarm the spoilers ? Other actions like flaps up, landing lights runway light.... work fine. And I'm not using voice command.

 

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

The log is attached.

For some reason SimConnect reports that you're not on the ground when you load your scenario. I'm afraid there's nothing I can do about that. You can, however, manually force the taxi phase with a key binding, like this :

 test.lua(drop the file into FSLabs Copilot\custom)

1 hour ago, Khoa Nguyen said:

Apu wasn't started

Unzip this into your FSUIPC folder and see if it happens again in your next few flights: copilot.zip

  • Like 1
Link to post
Igor Petrov
23 minutes ago, Peter Pukhnoy said:

For some reason SimConnect reports that you're not on the ground when you load your scenario. I'm afraid there's nothing I can do about that. You can, however, manually force the taxi phase with a key binding, like this :

 test.lua(drop the file into FSLabs Copilot\custom)

With a key binding? Like how exactly? ))

Thanks!!

 

PS: CTRL+SHIFT+F12!

Is occupied by gsx2, will try to edit to CTRL+SHIF+F10

Link to post
Igor Petrov

I think it works now - PACKs go back on, Spoilers seem to disarm as requried time-wise, however I have to raise gear and retract flaps manually.

Landings lights go off and retract at 10K on their own.

Is that all correct?

Thanks! 

 

Link to post
Igor Petrov
1 hour ago, Peter Pukhnoy said:

You can, however, manually force the taxi phase with a key binding

The taxi phase in context still requires the controls check, doesn't it?

Could you make another lua that would require only the brakes check? And, perhaps, somehow incorporate it into a voice command as well.

Thank you! 

Link to post
Khoa Nguyen
7 hours ago, Peter Pukhnoy said:

For some reason SimConnect reports that you're not on the ground when you load your scenario. I'm afraid there's nothing I can do about that. You can, however, manually force the taxi phase with a key binding, like this :

 test.lua(drop the file into FSLabs Copilot\custom)

Unzip this into your FSUIPC folder and see if it happens again in your next few flights: copilot.zip

Thanks for the reply Peter, I would like to bind one button in the VC to trigger some series of events, what kind of function should I add in the custom file ? what i see in your custom manual is just for voice commands. Thanks

Link to post
Peter Pukhnoy
1 hour ago, Khoa Nguyen said:

Thanks for the reply Peter, I would like to bind one button in the VC to trigger some series of events, what kind of function should I add in the custom file ? what i see in your custom manual is just for voice commands.

Which button? Also, a switch would be more preferable.

6 hours ago, Igor Petrov said:

Could you make another lua that would require only the brakes check? And, perhaps, somehow incorporate it into a voice command as well.

You mean a voice command that would trigger the same action as the bind I sent you but also would make it so only the brake check triggers the taxi procedure?

Link to post
Khoa Nguyen
41 minutes ago, Peter Pukhnoy said:

Which button? Also, a switch would be more preferable.

You mean a voice command that would trigger the same action as the bind I sent you but also would make it so only the brake check triggers the taxi procedure?

just for testing purpose, i want to test with a button, do we have any event detects when the button is pressed ? and how can I add to custom lua ?

Or simply call a name of a button FSL.XXX() ? 

Actually what I wanted is instead of requesting metar by voice, I prefer to use with a button

Thanks Peter

Link to post
Peter Pukhnoy
1 hour ago, Khoa Nguyen said:

Actually what I wanted is instead of requesting metar by voice, I prefer to use with a button

Are you sure you want to press a button in the virtual cockpit to request the metar? Just in case, I've also included a line that creates a keyboard key bind. test.lua

Link to post
Igor Petrov
2 hours ago, Peter Pukhnoy said:

Which button? Also, a switch would be more preferable.

You mean a voice command that would trigger the same action as the bind I sent you but also would make it so only the brake check triggers the taxi procedure?

Actually I don't think a voice command is really needed to trigger taxi procedure, but using the brake check only for it after loading a saved scenario would be nice.

Link to post
Peter Pukhnoy
2 hours ago, Igor Petrov said:

but using the brake check only for it after loading a saved scenario would be nice.

Try this (delete the other file): HandleSavedFlight.lua

If you load any flight other than the default one (this includes any scenario where you're actually in the air so you might want to modify the condition in the code), it will force the taxi phase and make the brake check the only trigger for the taxi procedure.

  • Like 1
Link to post
Igor Petrov
2 hours ago, Peter Pukhnoy said:

Try this (delete the other file): HandleSavedFlight.lua

If you load any flight other than the default one (this includes any scenario where you're actually in the air so you might want to modify the condition in the code), it will force the taxi phase and make the brake check the only trigger for the taxi procedure.

How to bind a different key combo in the above?

Thanks!

PS: I understand no keystrokes are required.

Edited by Igor Petrov
Link to post
Khoa Nguyen

@Peter Pukhnoy

I have some questions / reports : 

On 8/22/2020 at 1:26 AM, Peter Pukhnoy said:

Unzip this into your FSUIPC folder and see if it happens again in your next few flights: copilot.zip

The APU was still not started after landing (used your new lua script) - not in voice commande mode

I did two flights today and the trim in two flights were not set correctly (please check screenshots below)

  • 1.5UP  => copilot sets 1.7UP
  • 0.4DN => copilot sets 0.3DN

Thrust set was called out for the A321 but not A320 IAE

 

2020-8-22_16-5-55-194.jpg

2020-8-23_8-2-53-406.jpg

Link to post

×
×
  • Create New...