Jump to content

Recommended Posts

Hello captains, I wanted to present you my Lua Script used as copilot in the 737.

I wanted a very robust and simple solution, and so far the Lua script has proven to be reliable. While there is some limitations stated in the PDF manual I have written for you, it's a great help not to fly alone and have a very simple but efficient first officer !

All the best, and please let me speak about  Speedy Copilot ! :)

What it Speedy Copilot ?

Speedy Copilot makes for you the steps normally done by the first officer and pilot monitoring, when you are pilot flying and captain of a Boeing 737. Speedy copilot is intended for the IXEG 737 (version 1.21 and above).

It was tested and works with X-plane 11.20 and IXEG 1.21.

It is not very realistic to do all the steps required in the procedures on your own. The Flight Crew Operating Manual makes a clear separation between actions from the left hand seat and the right hand seat. So we'd like to have the right hand actions (F/O, PM) done for us in reaction to the phase of flight and to left seat actions (CPT, PF).

Several options exist to have a virtual copilot flying with you In X-Plane. But they might be technically complex, challenging to maintain, or require payware softwares.

The intent was to provide a simple solution!

We have made a transcript from the FCOM into a Lua script for the IXEG 737.

We have made the transcription of the following procedures :

  • Preflight procedure (triggered by the left hand side oxygen mask test)

  • Before start (triggered by the beacon to ON)

  • Before taxi (trigger by both engine generators to ON)

  • Runway Entry procedure (including TCAS control, triggered by left outboard landing light)

  • Take off run : gear and flaps retraction schedule (automatic trigger per rate and speed)

  • Flight 100 and climbing items (automatic trigger per captain altitude)

  • Flight 100 and descending items (automatic trigger per captain altitude)

  • Approach, flaps extension schedule (automatic trigger per altitude and speed)

  • Go around (reversion to Take Off procedure above) (automatic trigger at positive rate)

  • After landing procedure (triggered by speedbrake down on ground)

  • Apron entry (lights and doors) (triggered by runway turnoff lights OFF)

  • Shutdown procedure until turn around state (beacon to OFF)

The procedures are either manually triggered or automatically called.

The Copilot is not calling the checklist. The copilot is doing the procedure.

 

DOWNLOAD

 

Edited by XPJavelin
updated version number to final 3.3
  • Like 1

Share this post


Link to post
Share on other sites

I have updated the script with vocal remarks made by the first officer and also the activation of the PA emitter when the PA button is triggered. It is in the process to be uploaded, expect it for 0600Z 2018-9-6.

Share this post


Link to post
Share on other sites

I have corrected a few bugs. For instance this critical one :
 

    dataref("ENG1STARTER", "ixeg/733/engine/eng1_start_act", "readonly")

    dataref("ENG2STARTER", "ixeg/733/engine/eng2_start_act", "readonly")

is now,on my computer version, readonly instead of writable because it is suspected to cause troubles at engine start (actuator not being able to move to the OFF position automatically). Therefore, engine start switches are now in the responsability of the captain with speedy copilot.

I will upload at a later date the correction. In the mean time, if you encounter problems at startup (false behavior of switch or aircraft crash), I suggest you do the correction above..

Edited by XPJavelin

Share this post


Link to post
Share on other sites

I am really looking forward to trying this out, sounds like a a lot of hard work, well done.  I guess you want bugs and suggestions reported as more people use it?

 

 

My next flight: 10.06.18  Dep 10pm local - ENBR Bergen - EGPH Edinburgh - TNT Cargo flight

Edited by Iain

Share this post


Link to post
Share on other sites

Thank you very much of your interest.

Of course I can listen to the comments and bug reports. I have made some minor bug removal,not uploaded to the server at this time.

The main thing is  I had trouble with some datarefs. I would have prefered sending custom  commands, instead, sometimes, monitoring dataref in "writable" mode had some negative effects (the switch was not responding normally anymore, etc...). So far I have reached a state were I am happy with it, with the exception of engine start switches I has to remove from F/O responsability (e.g. moving them to readonly mode).... and some other switches less critical.

I am doing currently the flight from the majestic scenery of Kerkira LGKR to LFMT, and it seems to be fine.

Thank you again !

B733_39.png

Share this post


Link to post
Share on other sites

Hi 

I just gave it a quick try and have a few small problems and question.

When entering the plane, I here the copilot voice mumbling, a pen moving around and clip board noises, is that deliberate?

I get a sync Baro (the word Baro is not easy to understand, but then I see the local pressure displayed by your script at the bottom left, the only problem is, the pressure displayed is nowhere near the real pressure?

When I start the engine (I start No. 2 first), it reaches about 40N1, then increases dramatically and the plane shoots off into space and XP crashes, I tested it 3 times and the same result each time.  I hadn't pressed the Oxygen mask before engine start, I mention that in case that must be done.

Thanks for your feedback.  I have the shooting into space recorded if you need to see whats going on.

Share this post


Link to post
Share on other sites

Hi ! 

 

Thank you for your time. And your interest. 

Yes it is mandatory to perform all the steps. The copilot cannot skip procedures, otherwise next procedures wont be triggered.

I had also the space shooting and deactivated the engine start switches from the copilot tasks because manipulating them had that bad side effect on engine start, nevertheless prestart procedures are done or not. . I did not uploaded the corrected script at that time but it's identified and fixed in the next version. 

I have also removed the sound of the copilot stretching his muscles when entering the chu abin in the next version (was not very happy with it) but kept intentionnaly the other environnemental sounds. I recognize it was a quick recording and some sounds should be improved. 

When you set an altimeter setting, you hear the pilot telling you that he synchronized his baroaltimeter. for sure the quick and dirty" sync baro" should be replaced by a more appropriate sentence. :)

 

 

Edited by XPJavelin

Share this post


Link to post
Share on other sites

Is it fixed in the current download version or should I wait for the next version?

Share this post


Link to post
Share on other sites

Version 1.3 from 2018-06-12 2130z

Change log

* v 1.2 : Sound set totally reworked for more clarity, including PA annoucement (only with PA receiver tuned) and copilot. [Done at work when the boss was not noticing ;)]

* v 1.2 : When you set an altimeter setting, you hear the pilot telling you that he synchronized his baroaltimeter shortly after yours with "altimeter updated"

* v 1.2 : Engine start switches bug which crashed the aircraft is now repaired (However, at that time, you'll have to do it yourself, I'm sorry)

* v 1.2 : Autobrake switch differently handled, code speaking. (However, at that time, you'll have to do it yourself, I'm sorry)

* v 1.2 : Code tweaking

* v 1.2 : Reworked the logic for FL100 - it is no more mandatory to fly above FL100 in cruize to trigger subsequent flows. It remains mandatory to perform all the steps and procedures from the FCOM in the right order. The copilot cannot skip procedures, otherwise next procedures wont be triggered.

* v 1.3 : Repaired the logic to trigger approach mode (was broken in version 1.2)

It was tested in XP 11.20 and IXEG Classic 1.21, Better Pushback and JAR GroundHandling.

Edited by XPJavelin

Share this post


Link to post
Share on other sites

Version 2.0 from 2018-06-16

Change log

* v 2.0 : Engine start switches CONTINUOUS (after start and before landing) is now handled by the copilot, with the use of a different Lua function not conflicting with IXEG software

* v 2.0 : Autobrake switch is now fully handled by the copilot, with the use of a different Lua function not conflicting with IXEG software

* v 2.0 : Press. FLT - GRD switch is now handled by the F/O.

* v 2.0 : Guarded switches (flt_control_A_guard, flt_control_B_guard, spoiler_A_guard, spoiler_B_guard, alt_flaps_guard, att_pwr_guard, stby_pwr_guard and bus_xfr_guard) now checked guarded by the F/O during preflight.

* v 2.0 : The F/O sets his CDU to LEGS page as part of the before start flow, per FCOM.

Speedy Copilot_2.pdf

 

 

Edited by XPJavelin
  • Like 1

Share this post


Link to post
Share on other sites

I´m really diving into this script trying to improve it.

I´ve already added a flap retraction altitude of 1.000ft, so the FO doesn´t set flaps 1 right after liftoff... which is a little unhandy ._.

I´m trying to make the FO handle the GRD/FLT switch, but if i enter the dataref into the script, lua crashes. :P no idea why.

I´ll also try to make it set flap 30 for final. i´m a flap 30 guy ._.

I´wonder if it would be possible to link takeoff and landing config to the FMC data. Would be awsome.

I´m also trying to make the FO arm the speedbrakes... which doesn´t work. Same problem the engine start switches have i guess : P

This script has plenty of potential : )

EDIT: Copilot now also starts chrono during before taxi procedures and stops it during after shutdown procedure.

Edited by SkyFly
  • Upvote 1

Share this post


Link to post
Share on other sites

Hi,yes the chronometer is left apart in my version 2.0.

But the engine start swithes is solved, and the flap retraction altitude is a good idea...

Did you use the version 2.0 as a basis? Because it is greatly improved in regard to previous versions 1.x...

In theversion 2, my the FO handles the GRD/FLT switch without problem.

The solution is to use the Lua function "set" instead of the "dataref" function (see fly_with_Lua documentation).

For flaps 30, I didn't do that at that time.It is very easy to change FLAPS 40 for FLAPS 30,but it requires more code to create a situation for FLAPS 30 OR FLAPS 40.

I am glad you like my work ! And try to improve it !! Just,be sure your work is based on 2.0...

 

  • Like 1

Share this post


Link to post
Share on other sites

I din't want the FO to arm speed brake because I am focussing on Pilot Monitoring on right hand seat. In the FCOM, landing procedure (NP 21.49), it is the Pilot Flying who "Set the speed brake lever to ARM"... I found it great the Captain PM to be in charge of it so I didn't try to add it..

Anyway, you can decide differently with your own SOP...
 

Quote

I´wonder if it would be possible to link takeoff and landing config to the FMC data.

 

That would be great, at the moment, I don't now how to store a data displayed in the CDU into a Lua variable. It is not an IXEG dataref... Instead I would be inclined to find a trigger that allow FLAPS 40 or FLAPS 30.

The best way is to tell the copilot with a workaround like pushing a specific button below 6000 feet, he understands it will be one of the configurations instead of the other and then does :


    if planned_flaps == 40 then FLAPS = 1  end --flaps 40*
    if planned_flaps == 30 then FLAPS = 0.xx  end --flaps 30*

I have updated it to allow Flaps 30 on landing, it is ready and will be uploaded in v2.1

I have updated the documentation. But still have to test the new version 2.1 before uploading.

 

Speedy Copilot_2.pdf

Edited by XPJavelin
  • Like 1

Share this post


Link to post
Share on other sites

The version 2.15 is now available on x-pilot.com and on my website. :)

Per user request, Flaps 30 can be selected instead of Flaps 40 for landing. How to do that is documented in the PDF documentation. The version 2.15 has been tested on a typical flight profile with CRZ above FL100 and no sign of malfunctions was spotted throughout the different phases of flight but feel free to report any here. Happy flights !

  • Like 1

Share this post


Link to post
Share on other sites

Great!

However... engine start switches and FLT/GRD switch doesn´t work for me. i don´t know why. i´ve checked which version i have. it´s clearly 2.0. :wacko:

 

for flap retraction i simply added:

if speed >= 140 and radioaltitude >= 1000 and step == 1 then

 

It shure is possible to build another trigger to switch between 1000 and 1500 ft. :wub:

I also have reworked the flap setting values. (probably completely useles but i´m a perfectionist :P )

I noticed, that the generator connetion sound is cut out. probably due to the checklist popping up.

 

I´d change the after landing procedure trigger to the strobes as the turnoff lights are often used for taxiing. The strobes are always switched off when you leave the runway.

I´d change the takoff items trigger to one of the inboard landing lights as i for example like to take off without the outboards for fuel saving reasons.

 

I have so many ideas for this script : P  I can write them down and send them to you if you like : )

 

Share this post


Link to post
Share on other sites
2 hours ago, SkyFly said:

after landing procedure trigger

The after landing trigger was SPOILERS DOWN and, per FCOM, I prefer the F/O to handle the strobe switch on his side. However, it is perfectly understandable that you want to change your triggers to your liking and your own logic. You are very welcome to do that.

2 hours ago, SkyFly said:

I´d change the takoff items trigger to one of the inboard landing lights

Nice idea !

2 hours ago, SkyFly said:

engine start switches and FLT/GRD switch doesn´t work for me

With Speedy Copilot 2.15, engine start switches are manually activated by you, for the start procedure. Then ,during after start flows (and in approach,later), tjeF/O switches them to CONTINUOUS. I just tested that,and it worked perfectly on my computer. Did you erase the previous versions of the script before copying the last version ? Also, close and restart X-Plane for and after the installation to erase any global variable values.

2 hours ago, SkyFly said:

for flap retraction i simply added:

if speed >= 140 and radioaltitude >= 1000 and step == 1 then

I did not change the trigger in version 2.15 following your suggestion, because I made several tests with the current state of triggers for the after takeoff flow to ensure they are robust as is. The triggers are sensitive, because it has to work both for take off and go around. I remember fine tuning those takeoff triggers and it is not clear to me (without doing a series of tests) if the after takeoff sequence would keep safe and operationnal with your modification, but I hope so. So I reserve this modification for later so far. In the mean time, you are very welcome to modify the script on your computer of course.

 

2 hours ago, SkyFly said:

I have so many ideas for this script : P  I can write them down and send them to you if you like : )

I welcome your ideas and suggestions.

Thank you for your interest. :)

Edited by XPJavelin
  • Like 1

Share this post


Link to post
Share on other sites

I´m downloading 2.15 a this moment. I´ll modify it like i did in 2.0 and test it from top to bottom, probably next wekend.

I didn´t thought about the go around problem with the flap retraction altitude. I´ll have to put some crativity into that.

Share this post


Link to post
Share on other sites
31 minutes ago, SkyFly said:

didn´t thought about the go around problem with the flap retraction altitude

I don't think there will be a problem, really, it is just that I did not tested it and can't say it will work. ;-)

Share this post


Link to post
Share on other sites

Hi @XPJavelin

Thanks for this nice script. I see that you mention that all steps are performed "speedily" as you couldn't get delays between steps to work without pausing everything.

So I took your code from version 2 and added this "delay" logic and it's working pretty well. It does however clutter the code a bit due to the fact that I'm using os.clock() and checking for how much time passed since the previous step was done. Currently I'm using a random delay of between 0.5 and 1.5 seconds between steps. It gives you the feeling that the copilot is sometimes thinking of what he must do next.

I'm pretty sure that someone with more LUA knowledge could probably write better (more elegant) code than what I have done.

If you are interested let me know and I will share.

PS: I think you should also rename your script to "Not so speedy Copilot" once the random delays have been added. :P

Share this post


Link to post
Share on other sites
2 hours ago, jfjoubert said:

It does however clutter the code a bit due to the fact that I'm using os.clock() and checking for how much time passed since the previous step was done. Currently I'm using a random delay of between 0.5 and 1.5 seconds between steps. It gives you the feeling that the copilot is sometimes thinking of what he must do next.

Hi,

I like the randomness idea - I was thinking the same in what I have written here (I've added alot since this preview) >>> https://drive.google.com/open?id=1k-90ng-W0l09Zuw986TV7v5TR8FFUfhu

And yes, my code is very lengthy based on the pause of typically around one second that i do between each step.

Of course this is the 757 and was built to fill my own needs so is not as sophisticated as speedy copilot i.e. I do other actions from other triggers but I am currently porting this into the IXEG and will make it available when it is ready.

-Carl

Share this post


Link to post
Share on other sites

Hi

Quote

PS: I think you should also rename your script to "Not so speedy Copilot" once the random delays have been added.

ahah !;D ;)

I like the randomness idea too.

I found a way to pausing a LUA script but it was pausing the whole simulator (simulator freeze, waiting for the Lua  with os.clock function to be finished) , therefore, not interesting at all. We cannot pause the whole aircraft while flying,it would looks like a giant stutter !

Quote

os.clock()

When you use this function, are your sure,that you don't produce that giant stutter ? (I rejected that method).

My attempt used a function calling sleep(1) for a pause of 1second :

function sleep(n)

 local t = os.clock()

 while os.clock() - t <= n do

  -- nothing

end

end

-- function sleep is dissused because it pauses the whole simulator !

I have investigated the Internet and found the function pause was not available in Lua (except maybe with the last version of it).

Quote

It does however clutter the code

Not sure it should clutter the code extremely : if you write the code into a function and call it - like sleep(1) - , it is a one-liner !

If you find an elegant solution, you are very welcome to share it here.

(And just as a reminder the current version is still 2.15, change log attached.)

Speedy Copilot_2.pdf

Edited by XPJavelin

Share this post


Link to post
Share on other sites

@XPJavelin Thank you too and for your solution to the engine start switches which uses the set command. I've also applied the set command to set my gear lever to off after take off.

Here is an excerpt below from one of my features showing how i pause between actions. This particular function is started by choosing it from the menu (I wrote this particular function just to set the status of lights, gear etc. when i do some approach practice from 10 miles out.

There are probably much better ways :) and far more efficient ways than my coding that I learnt as i went along :)  Aircraft_shooting_approaches () is active every second as i use do_often. The code only runs in the function when  r_trigger_shooting_approaches is true. The last item in my function always sets the trigger to false, r_trigger_shooting_approaches = false

function Aircraft_trigger_shooting_approaches ()
if r_debug > 1 then logMsg( "[blocks_off 7373 First Officer] Aircraft_trigger_shooting_approaches - is now active") end
r_trigger_start_time = os.clock () 
r_trigger_shooting_approaches = true
end

function Aircraft_shooting_approaches ()

if r_trigger_shooting_approaches then

if r_debug > 0 then logMsg( "[blocks_off 7373] First Officer] Aircraft_shooting_approaches - is now active") end

function message()
draw_string( 50, 20, "Shooting Approaches...", "black" )
end

if os.clock() > r_trigger_start_time +1 then
w_acft_flap = 0.5
end 

if os.clock() > r_trigger_start_time +2 then
w_acft_l_outboard = 2
w_acft_r_outboard = 2
end

...other code

if os.clock() > r_trigger_start_time + 22 then
r_trigger_shooting_approaches = false
if r_debug > 0 then logMsg( "[blocks_off 7373 First Officer] Aircraft_shooting_approaches - has now ended") end
function message()
draw_string( 50, 20, "", "black" )
end
end
end
end
--end of function Aircraft_shooting_approaches () 

add_macro( "7373 Shooting Approaches", "Aircraft_trigger_shooting_approaches () " )

do_often ("Aircraft_shooting_approaches ()")

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×