Board index FlightGear Development Nasal

'Delaying' setprop in Nasal

Nasal is the scripting language of FlightGear.

'Delaying' setprop in Nasal

Postby legoboyvdlp » Thu Dec 08, 2016 4:09 pm

Hi there!
I'm developing a LGCIU code for the A320 at the moment. I was wondering if there is a way to delay a setprop? It takes two seconds for the nose gear doors to open and close, so I would like to delay the setprop(); of the nose landing gear property for two seconds.

For example:

Code: Select all
gear_up(); #command gear up
setprop("/gear/NLG-doors","in-transit"); #doors begin to open

Wait two seconds

setprop("/gear/NLG-doors","open"); #set gear doors prop to open


The properties and code above are all fake; my code is more complex and uses proper property tree structure and setlisteners ;)
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: 'Delaying' setprop in Nasal

Postby Necolatis » Thu Dec 08, 2016 4:25 pm

One way would be to call a method that is executed 2 second later, something like:

settimer(func () {setprop("/gear/NLG-doors","open");}, 2.0);
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2233
Joined: Mon Oct 29, 2012 1:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2020.3.19
OS: Windows 10

Re: 'Delaying' setprop in Nasal

Postby Richard » Thu Dec 08, 2016 5:30 pm

interpolate("/some/property", value, time_in_seconds);

e.g. interpolate("gear/position-left", 1.0, 0.5);

it's better to define "in transit" as being

gear/position-left > 0
and gear/position-left < 1

as I think that's how it works on most aircraft - i.e. in transit is the state between being uplocked and downlocked
Richard
 
Posts: 810
Joined: Sun Nov 02, 2014 11:17 pm
Version: Git
OS: Win10

Re: 'Delaying' setprop in Nasal

Postby Thorsten » Thu Dec 08, 2016 7:00 pm

I'd code this as part of the FDM systems sections, because...

... gear deployment causes gradual drag increase
... you may want to check hydraulics system functional before doing it
... you may want to check electrical system before doing it
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: 'Delaying' setprop in Nasal

Postby legoboyvdlp » Thu Dec 08, 2016 9:12 pm

We already have gear drag increase, and the hydraulics system is coming along nicely thanks to it0uchpods. On the other hand, the electrical is Syd Adam's default. However, once the it0uchpods electric system is installed, then we can interface the properties.
However, thank you for your suggestions, Thorsten ;)

@the others -- many thanks!
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP


Return to Nasal

Who is online

Users browsing this forum: No registered users and 2 guests