Jump to content

Virtual copilot addon


Peter Pukhnoy

Recommended Posts

Peter Pukhnoy
2 minutes ago, Igor Petrov said:

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

No, you don't have to. They're two different methods that do the same thing.

Link to post
  • 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

Igor Petrov
Just now, Peter Pukhnoy said:

No, you don't have to. They're two different methods that do the same thing.

Oh, I think it is getting warmer!

Thank you.

Link to post
Igor Petrov
6 minutes ago, Igor Petrov said:

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}

 

So if I'd like to use a joystick button instead of a key for Copilot's mute/unmute control then I should use the second method explained in the video only?

Thanks.

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

So if I'd like to use a joystick button instead of a key for Copilot's mute/unmute control then I should use the second method explained in the video only?

I'm a bit confused - which second method? You would need to initialize a joystick and then myJoy:onPress(buttonNum, unmuteCopilot) and myJoy:onRelease(buttonNum, muteCopilot)

You can bind your button in FSUIPC to the smoke toggle command to do the same thing.

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

I'm a bit confused - which second method? You would need to initialize a joystick and then myJoy:onPress(buttonNum, unmuteCopilot) and myJoy:onRelease(buttonNum, muteCopilot)

You can still use FSUIPC and the smoke toggle command to do the same thing.

I'll try that now.

PS: sorry I was a mess - keys, video, pictures... To some reason they didn't play clearly for me. 

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

I'll try that now.

PS: sorry I was a mess - keys, video, pictures... To some reason they didn't play clearly for me. 

You should also add muteCopilot() at the top of your autorun.lua since you want it muted by default.

EDIT: It probably won't work since autorun.lua is started first and the muted flag is reset when you restart copilot. I'll change that behavior in the next version.

  • Like 1
Link to post
Igor Petrov

 

19 minutes ago, Peter Pukhnoy said:

You should also add muteCopilot() at the top of your autorun.lua since you want it muted by default.

But I won't be able to use it with the SMOKE TOGGLE/FSUIPC method will I?

 Thanks.

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

 

But I won't be able to use it with the SMOKE TOGGLE/FSUIPC method will I?

 Thanks.

You can use the lua functions and the smoke toggle commands together at the same time.

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

You can use the lua functions and the smoke toggle commands together at the same time.

Yes, I just had to swap 0 and 1 to make it work my way: now when I press and hold my comms button Copilot is unmuted, when I release it goes back to mute status as Copilot.log shows.

Now I get this in the log: 

[23:03:42] [warning] PF MCDU Http request error 12152

Does it say my MCDU is not turned On yet?

Thanks.

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

Does it say my MCDU is not turned On yet?

If it's something that you only see occasionally, it's nothing to worry about. I get an error from time to time as well, although I don't remember if it's the same code.

Link to post
Igor Petrov

No Pressure Zero call:

[00:42:46] [info] Unmuted
[00:42:49] [info] Recognized phrase 'brake check', confidence: 0.9521
[00:42:49] [debug] Event: VoiceCommand: brake check
[00:42:49] [debug] Coroutine action: Brake check
[00:42:50] [debug] Event: CB612F6A0
[00:42:50] [debug] Action: CB612FC90
[00:42:50] [debug] Event: BDD4C44B0
[00:42:50] [debug] Action: BDD4C3970
[00:42:50] [debug] Finished coroutine action: Brake check
[00:42:52] [info] Muted

Thanks

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

No Pressure Zero call:



 

There are a couple of parameters (that I chose rather arbitrarily) that need to be satisfied:

  • GS between 0.2 and 3 knots
  • Brake application above 0.5 percent

Nothing has changed in the brake checking code since the first version.

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

There are a couple of parameters (that I chose rather arbitrarily) that need to be satisfied:

  • GS between 0.2 and 3 knots
  • Brake application above 0.5 percent

I tried. So if I'm not able to apply brake above 0.5% while GS between 0.2 and 03knots and at the same time make my "Brake check" call then the script is broken from that point on?

Thanks.

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

So if I'm not able to apply brake above 0.5% while GS between 0.2 and 03knots and at the same time make my "Brake check" call then the script is broken from that point on?

You can say brake check as many times as you want and it will succeed once the conditions are met. If you don't have a successful brake check before the takeoff the script will only be broken in the sense that the copilot isn't going to do his during taxi sequence which starts when both the brake and flight controls checks are completed.

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

You can say brake check as many times as you want and it will succeed once the conditions are met. If you don't have a successful brake check before the takeoff the script will only be broken in the sense that the copilot isn't going to do his during taxi sequence which starts when both the brake and flight controls checks are completed.

Ok, I'm working through it again from reload.

Thanks.

Link to post
Igor Petrov
Quote

Preflight

  • Check FMGC data insertion (the script doesn't actually check anything, it just cycles through the MCDU pages)
  • Set up the EFIS

Trigger:

Fill out the PERF and INIT B pages

Does it matter on which MCDU? 

Otherwise nothing happens, doesn't work here?

Thanks.

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

Does it matter on which MCDU? 

It should be done on the PF side MCDU.

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

It should be done on the PF side MCDU.

And if it's done already on the opposite one? Even if I bring up INIT and PERFORMANCE pages on the necessary one after? Doesn't break up anything I guess, not important?

Thanks. 

Link to post
Peter Pukhnoy
Just now, Igor Petrov said:

 Even if I bring up INIT and PERFORMANCE pages on the necessary one after?

Note that there will be a random delay (up to 3 minutes or so). Your INIT B and PERF page data insertion (takeoff speeds, ZFW and block fuel) should be acknowledged with an "FMGC is set up" log message.

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

It should be done on the PF side MCDU.

Isn't PF on the left side by default? Here:

 

PM_seat=right ;Where the Pilot Monitoring sits in the cockpit - left or right
button_sleep_mult=1

Thanks.

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

Isn't PF on the left side by default?

It is. So if you insert the ZFW, block fuel and all three V-speeds, you don't immediately get an "FMGC is set up" log message?

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

It is. So if you insert the ZFW, block fuel and all three V-speeds, you don't immediately get an "FMGC is set up" log message?

Going through all over again, I'll confirm.

Thanks.

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

It is. So if you insert the ZFW, block fuel and all three V-speeds, you don't immediately get an "FMGC is set up" log message?

It works. Very nice feature - PM flips pages on his MCDU and checks the flight plan on his ND.

Thanks.

  • Like 1
Link to post
Kevin Conlon

Just purchased the A3xx (was using the 'other one') and I am impressed.  What I am finding challenging is mapping my hardware to work with this new 'bus.  I generally use SPAD but haven't had much luck and LINDA doesn't recognize the EFIS; so I thought I'd try Copilot and FSL2Lua.  I've gotten some of the scripting to work and I am learning but have a question on how to control my GF-EFIS.  I found the vendor and hardware ID's but not sure how to map the 2 rotaries (baro and DH) and 2 rotary switches (Mode and Range).

Has anyone been able to map these?

 

 

Link to post
Peter Pukhnoy
1 hour ago, Kevin said:

Has anyone been able to map these?

I found a thread on the LINDA forum where the developer said that the switches on the GF-EFIS don't behave like a standard HID device, so I don't think my HID interface can help you either.

Link to post
Igor Petrov
3 hours ago, Kevin said:

Just purchased the A3xx (was using the 'other one') and I am impressed.  What I am finding challenging is mapping my hardware to work with this new 'bus.  I generally use SPAD but haven't had much luck and LINDA doesn't recognize the EFIS; so I thought I'd try Copilot and FSL2Lua.  I've gotten some of the scripting to work and I am learning but have a question on how to control my GF-EFIS.  I found the vendor and hardware ID's but not sure how to map the 2 rotaries (baro and DH) and 2 rotary switches (Mode and Range).

Has anyone been able to map these?

 

 

 

Link to post
Igor Petrov

I'm trying to create a simple test binding for Release Parking Brake function. I made a new autorun.lua with the following text:

Bind {key = "CONTROL+F5", onPress = {FSL.PED_PARK_BRAKE_Switch, "OFF"}}

I dropped autorun.lua in Prepar3D v5 Add-ons\Copilot for FSLabs\scripts folder.

I press Ctr+F5 keys in the cockpit but the script does not work.

What am I missing here?

Thanks.

PS: it is in 2.04 yet

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

I'm trying to create a simple test binding for Release Parking Brake function. I made a new autorun.lua with the following text:


Bind {key = "CONTROL+F5", onPress = {FSL.PED_PARK_BRAKE_Switch, "OFF"}}

I dropped autorun.lua in Prepar3D v5 Add-ons\Copilot for FSLabs\scripts folder.

I press Ctr+F5 keys in the cockpit but the script does not work.

What am I missing here?

Thanks.

PS: it is in 2.04 yet

Control isn't available in 2.04 - only LControl and RControl (same goes for shift and alt). It should work  in 2.05 though.

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

Control isn't available in 2.04 - only LControl and RControl (same goes for shift and alt). It should work  in 2.05 though.

My autorun.lua reads now:

FSL:setPilot "CPT"
Bind {key = "LCONTROL+F5", onPress = {FSL.PED_PARK_BRAKE_Switch, "OFF"}}

And it still doesn't send the keycombo.

Thanks.

Link to post
Igor Petrov

In Add-ons menu there is FSL2Lua entry with Restart script option. Where does it come from and what does it do? To restart Copilot for FSLabs it's enough to select Restart option.

Thanks.

  • Like 1
Link to post
devrim cagdas
7 hours ago, Kevin said:

Just purchased the A3xx (was using the 'other one') and I am impressed.  What I am finding challenging is mapping my hardware to work with this new 'bus.  I generally use SPAD but haven't had much luck and LINDA doesn't recognize the EFIS; so I thought I'd try Copilot and FSL2Lua.  I've gotten some of the scripting to work and I am learning but have a question on how to control my GF-EFIS.  I found the vendor and hardware ID's but not sure how to map the 2 rotaries (baro and DH) and 2 rotary switches (Mode and Range).

Has anyone been able to map these?

 

 

I did it with help of my friend (Özgür Ergül). Actually he showed me how to do it. You can use spare fsuipc offsets for every position of EFIS RNG/MODE rotary switches.

Link to post
Igor Petrov
1 minute ago, devrim cagdas said:

I did with help of my friend (Özgür Ergül). Actually he show me how to do it. You can use spare fsuipc offsets for every position of EFIS RNG/MODE rotary switches.

Do you mind sharing an example of a rotary control and a button/switch?

Link to post
devrim cagdas
1 hour ago, Igor Petrov said:

Do you mind sharing an example of a rotary control and a button/switch?

sure, but first of all I use mobiflight to configure.

For hardware part, I use 1 pole 12 position rotary switch. which is "not" a perfect fit for those switches. You may use 1 pole 10 position rotary switch which fits better. I will change them after I recieve the new ones.

1P10T 1 Pole 10 pozisyon seçilebilir 1 güverte bant kanal döner anahtar seçici|Switches| - AliExpress

Lvars for those switches are 

VC_GSLD_CP_EFIS_ND_Range_Knob

VC_GSLD_FO_EFIS_ND_Mode_Knob

you can use attached script to define offsets for those lvars

If you dont use mobiflight, Its meaningless to tell the rest.

 

EFIS ROTARY SW.txt

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

In Add-ons menu there is FSL2Lua entry with Restart script option. Where does it come from and what does it do? To restart Copilot for FSLabs it's enough to select Restart option.

Thanks.

It reloads autorun.lua. If you edit the file, you need to reload it for the changes to take effect.

  • Like 1
Link to post
Igor Petrov
16 minutes ago, devrim cagdas said:

sure, but first of all I use mobiflight to configure.

For hardware part, I use 1 pole 12 position rotary switch. which is "not" a perfect fit for those switches. You may use 1 pole 10 position rotary switch which fits better. I will change them after I recieve the new ones.

1P10T 1 Pole 10 pozisyon seçilebilir 1 güverte bant kanal döner anahtar seçici|Switches| - AliExpress

Lvars for those switches are 

VC_GSLD_CP_EFIS_ND_Range_Knob_

VC_GSLD_FO_EFIS_ND_Mode_Knob_

you can use attached script to define offsets for those lvars

If you dont use mobiflight, Its meaningless to tell the rest.

 

EFIS ROTARY SW.txt 404 B · 1 download

I got you, thanks. 

 

6 hours ago, Kevin said:

Just purchased the A3xx (was using the 'other one') and I am impressed.  What I am finding challenging is mapping my hardware to work with this new 'bus.  I generally use SPAD but haven't had much luck and LINDA doesn't recognize the EFIS; so I thought I'd try Copilot and FSL2Lua.  I've gotten some of the scripting to work and I am learning but have a question on how to control my GF-EFIS.  I found the vendor and hardware ID's but not sure how to map the 2 rotaries (baro and DH) and 2 rotary switches (Mode and Range).

Has anyone been able to map these?

 

 

Kevin, I think there's an easier way to bind. The thing is that FSUIPC recognizes every GF's rotary, button and switch as a discreet joystick button. So you can bind a lua with the required FSL control to every such joystick button pressed in FSUIPC. But you'll need help on lua files with FSLA320X internal controls more knowledgeable than I.

Edited by Igor Petrov
Link to post
Igor Petrov
3 hours ago, Peter Pukhnoy said:

I've attached a test version featuring checklists to the opening post:

 

Can I just overwrite v2.04 folders and files or do I need to install clean?

Thanks.

Link to post
Igor Petrov

v2.05 question:  can I use the new checklist facility without voice commands enabled in Options.ini? I'd better bind some keys to start each one if there are no sequential triggers.

I've used Voice Attack with Copilot, and it works much much better in recognizing my voice commands to some reason. Therefore I've decided to use Copilot  with [Voice_control] enable=0 option, but Voice Attack triggers anything I want anyway.

Thanks.

Edited by Igor Petrov
Link to post
Peter Pukhnoy
6 hours ago, Igor Petrov said:

Can I just overwrite v2.04 folders and files or do I need to install clean?

Always overwrite unless stated otherwise.

6 hours ago, Igor Petrov said:

I'd better bind some keys to start each one if there are no sequential triggers.

You could do that, but there's no way around responding to challenges with voice.

6 hours ago, Igor Petrov said:

I've used Voice Attack with Copilot, and it works much much better in recognizing my voice commands to some reason

That's weird because both use the same SAPI engine for recognition. Perhaps the confidence thresholds are set lower in Voice Attack? Every voice command in Copilot has a threshold of either 0.9 or the default of 0.93. You could try lowering the threshold for each voice command with this code (I can a global default confidence setting if that works):

for _, vc in pairs(Event.voiceCommands) do
  vc:setConfidence(0.8)
end

 

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

You could do that, but there's no way around responding to challenges with voice.

The responses could also be TTS or voice - read.

6 hours ago, Peter Pukhnoy said:

That's weird because both use the same SAPI engine for recognition. Perhaps the confidence thresholds are set lower in Voice Attack? Every voice command in Copilot has a threshold of either 0.9 or the default of 0.93. You could try lowering the threshold for each voice command with this code (I can a global default confidence setting if that works):



for _, vc in pairs(Event.voiceCommands) do
  vc:setConfidence(0.8)
end

 

I'll play with that. Where Voice Attack is much better - it shows what it hears from your voice and you can add those snippets to the recognized sets. But I think there's also another problem here: to some reason Win10's speech recognition turns my microphone's sensitivity one notch down occasionally and that's where it fails to recognize. I think this is something to do with SR/Control Panel/Microphone Setup that kicks in spontaneously. I've observed that before, and my audio environment is quite noizy with an A/C and a big water-cooled tower with 12 or more fans humming. However Voice Attack works flawlessly, even surprizing how good it is at recognizing what I say. So I wish you could maintain a non-voice version of your wonderful and smart Copilot, and checklists can be written with VA as well, no problem.

Thanks.

Link to post
Igor Petrov
On 4/22/2021 at 11:56 AM, Igor Petrov said:

The responses could also be TTS or voice - read.

I'll play with that. Where Voice Attack is much better - it shows what it hears from your voice and you can add those snippets to the recognized sets. But I think there's also another problem here: to some reason Win10's speech recognition turns my microphone's sensitivity one notch down occasionally and that's where it fails to recognize. I think this is something to do with SR/Control Panel/Microphone Setup that kicks in spontaneously. I've observed it before, and my audio environment is quite noizy with an A/C and a big water-cooled tower with 12 or more fans humming. However Voice Attack works flawlessly, even surprizing how good it is at recognizing what I say. So I wish you could maintain a non-voice version of your wonderful and smart Copilot, and checklists can be written with VA as well, no problem.

Thanks.

Edited by Igor Petrov
Link to post
Peter Pukhnoy
43 minutes ago, Igor Petrov said:

The responses could also be TTS or voice - read.

I'm not sure how that would work exactly. Like, how would you do an interaction like this without you actually speaking: https://www.youtube.com/watch?v=c3eyeqbF_Gg. In any case, I'm not interested in implementing non-voice checklist functionality, sorry.

 

Link to post
Kevin Conlon
3 hours ago, Igor Petrov said:

I got you, thanks. 

 

Kevin, I think there's an easier way to bind. The thing is that FSUIPC recognizes every GF's rotary, button and switch as a discreet joystick button. So you can bind a lua with the required FSL control to every such joystick button pressed in FSUIPC. But you'll need help on lua files with FSLA320X internal controls more knowledgeable than I.

Thanks Igor.  For some reason FSUIPC (6.1.0) does not 'see' my GF hardware.  It does appear in HidScanner.  I have  GFDev64.dll  in the module directory within P3D. 

Vendor=09F3, Product=0030 (Version 1.2)
  Manufacturer= GoFlight
  Product= GoFlight GF-T8 control module
  Serial Number= GoFlight GF-T8 control module
  Usage Page: 2
  Input Report Byte Length: 2
  Output Report Byte Length: 0
  Feature Report Byte Length: 2
  Number of Link Collection Nodes: 4
  Number of Input Button Caps: 1
  Number of InputValue Caps: 0
  Number of InputData Indices: 8
  Number of Output Button Caps: 0
  Number of Output Value Caps: 0
  Number of Output Data Indices: 0
  Number of Feature Button Caps: 1
  Number of Feature Value Caps: 2
  Number of Feature Data Indices: 3
  Buttons range 1 -> 8 at indices 0 -> 7

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

×
×
  • Create New...