Board index FlightGear Development Aircraft Systems

Multi properties animations

Modeling aircraft systems, like electrical stuff, hydraulics, pneumatics? Feel free to ask support.

Multi properties animations

Postby daweed » Thu Nov 12, 2015 8:10 pm

Hello evryone,

i am actually working on the overhead panel from the A330
I have update (and transmit my work to the dev team) the behavior of the apu master / starter switch

i am actually working on the external power switch.

Kory switches on the A330 overpanel are actually made with 2 distincts 3D objects, the upper part and lower part

Image

For the external power switch here is the behavior we should have

When an external power souce is connected to the plane, the upper part of this switch should be light in green with the "AVAIL" word illuminated.
When pressing the switch , the upper part should light off and the lower part should light up displaying "ON" in blue

One more pression on the switch should switch back to AVAIL light on and ON light off

In the properties tree we have 2 properties in touch with that:

* /services/external-pwr/enable (this property tell is an external propertie is connected to the aircraft and is toogle by a check box in one of the aircraft menu)

* /controls/electric/external-power (this property is toogle by the external power switch on the overhead panel)

In the overhead XML file only the lower part is actually managed.

here is the actual code :

Code: Select all
<animation>
      <name>External power pick</name>
      <type>pick</type>
      <object-name>ExtPwrBtn1</object-name>
      <object-name>ExtPwrBtn2</object-name>
      <action>
         <button>0</button>
         <repeatable type="bool">false</repeatable>
         <binding>
            <command>property-toggle</command>
            <property>controls/electric/external-power</property>
         </binding>
            <binding>
            <command>nasal</command>
                <script>utils.clickSound(6)</script>
            </binding>
      </action>
   </animation>
   <animation>
      <name>External power on</name>
      <type>textranslate</type>
      <object-name>ExtPwrBtn2</object-name>
      <property>controls/electric/external-power</property>
      <factor>0.5</factor>
      <axis>
         <x>1</x>
         <y>0</y>
      </axis>
   </animation>


As i understand, when pressing the switch with code, a texture translation is apply on the lower part (ExtPwrBtn2) to display the "On" indication.

=> so i added a section to manage the upper part, but i encouter a problem to have the texture animation on the upper part of this object as it depends from the 2 properties with conditionnal instructions

Code: Select all
<animation>
      <name>External power avail</name>
      <type>textranslate</type>
      <object-name>ExtPwrBtn1</object-name>
      <condition>
             <and>
            <property>services/external-pwr/enable</property>
                                <not>
                                      <property>controls/electric/external-power</property>
                                </not>
             </and>
      </condition>
      <factor>0.5</factor>
      <axis>
         <x>1</x>
         <y>0</y>
      </axis>
   </animation>


As i understood i tell here :

If power sources is connected and not activate => texture translation should happen

And so if the switch is pressed, ,the controls/electric/external-power goes to true, and then , the condition is no more true, so the translation should go back (and so display a black texture (light off)

=> this doesnt work ... but i don't understand why

So if some xml texture translate knowledge have the solution .... thanks by advance.

=> i solved this issue by adding a new property in the tree that manage the upper part and update the property with nasal code in the electric system of the aircraft, but i think this is a heavy solution and texture translate should be manage by the condition.

So i really like to manage with the XML file code (there is more other korry switch to manage with more than one property and update nasal is heavy and could bring some unstable behavior.
Windows 10 / Linux Mint 20
AMD Ryzen 7 3700X |32 Go RAM GeForce RTX 3070 Ti 8 Go
FG Interface
Lyon Saint Exupery Scenery

ATC on LFLL on Friday 19:00 UTC => 22:00 UTC
daweed
 
Posts: 398
Joined: Thu Dec 11, 2014 11:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Linux Mint 20

Re: Multi properties animations

Postby Thorsten » Fri Nov 13, 2015 11:26 am

So i really like to manage with the XML file code (there is more other korry switch to manage with more than one property and update nasal is heavy and could bring some unstable behavior.


In general complicated conditions should (and do) work for me in much more complex cases, so I suspect there may be an issue with referencing properties which aren't what you think they are.

For more complex systems modeling, I would consider doing the internal state of the system in the systems model (either via JSBSim tags or for YaSim as property rules and have a simple flag there which can be used for the animation, rather than using Nasal.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Multi properties animations

Postby sanhozay » Fri Nov 13, 2015 12:04 pm

I guess the other possibility is that the object is not mapped to the texture in the way you hope it is?
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 12:57 pm
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: Multi properties animations

Postby daweed » Fri Nov 13, 2015 3:25 pm

sanhozay wrote in Fri Nov 13, 2015 12:04 pm:I guess the other possibility is that the object is not mapped to the texture in the way you hope it is?


I am sure about this, i have imported the ac file in blender and checked what is the png texture file apply to the 3D object.
I have created a new material and new texture file and applied it to the object

If i dont use condition structure, and only use the /services/external-pwr/enable (witch is toogle by a checkbox) on the upper part => the texture translation work, check box tick, avail light "appear" , untick avail light go off

Pressing the korry, that bring up the "On" light up, but as there no condition with "controls/electric/external-power", the the avail light dont goes off
I have a look on nasal script, the external power sources need to be connected (checkbox ticks) to have the "On" light, and when pressing the Korry, the controls/electric/external-power is set to "true", that why i am pretty sure that the properties are the goods one.

The tweak i made by adding a property in the tree work, in fact i added a property that tell if the power source is used (but that should be the controls/electric/external-power who should tell me that) and update nasal code to have a condition with the connected information and set the property as needed

Then update the xml file to use for this object the new property
=> this solution is working perfectly, but i would expect to understand why the condition on XML file doesnt work as the nasal solution will not fit for an another part i am working on.

I ll post more screenshot & nasal code i found

Does conditions really available for a "pick" animation ?

Thanks for your reply & help

Best regards
Windows 10 / Linux Mint 20
AMD Ryzen 7 3700X |32 Go RAM GeForce RTX 3070 Ti 8 Go
FG Interface
Lyon Saint Exupery Scenery

ATC on LFLL on Friday 19:00 UTC => 22:00 UTC
daweed
 
Posts: 398
Joined: Thu Dec 11, 2014 11:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Linux Mint 20

Re: Multi properties animations

Postby daweed » Tue Nov 17, 2015 1:11 pm

@Thorsten after many test, i am not able to use condition with pick animation.
Please could u post me an example ... or tell me what is wrong in mine.

Best regards & thanks by advance.
Windows 10 / Linux Mint 20
AMD Ryzen 7 3700X |32 Go RAM GeForce RTX 3070 Ti 8 Go
FG Interface
Lyon Saint Exupery Scenery

ATC on LFLL on Friday 19:00 UTC => 22:00 UTC
daweed
 
Posts: 398
Joined: Thu Dec 11, 2014 11:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Linux Mint 20

Re: Multi properties animations

Postby daweed » Wed Nov 18, 2015 12:55 pm

daweed wrote in Tue Nov 17, 2015 1:11 pm:@Thorsten after many test, i am not able to use condition with pick animation.
Please could u post me an example ... or tell me what is wrong in mine.

Best regards & thanks by advance.


No one have an idea where i am wrong ?

here what i have and what i know :

there is 2 properties in the aircraft tree !

+ /services/external-pwr/enable (set to true when connecting the external power source)
+ /controls/electric/external-power (set to true when pressing the swithc on the Overhead panel

Here are the 3D model with the object name :

Image

What i d like to do is a texture translation animation on the ExtPwrBtn1 object when the first propertie is connected (so she is a true <= that already work) and then the second property is false (that already work too) with a translation on x axis
So that why in the xml file i add the code

Code: Select all
<animation>
      <name>External power avail</name>
      <type>textranslate</type>
      <object-name>ExtPwrBtn1</object-name>
      <condition>
             <and>
                <property>/services/external-pwr/enable</property>
                <not>
                    <property>/controls/electric/external-power</property>
                 </not>
             </and>
      </condition>
      <factor>0.5</factor>
      <axis>
         <x>1</x>
         <y>0</y>
      </axis>
</animation>


When i use nasal to manage the condition (the same way , same properties) and affect an another one as result with some nasal code lines and use the result property in the animation it work, so texture affectation, uv map ... etc are good

But trying to manage condition in the xml file as explain here wiki animation that doesn't work ... i just need help to understand why , and what is wrong in what i wrote.

Best regards
Windows 10 / Linux Mint 20
AMD Ryzen 7 3700X |32 Go RAM GeForce RTX 3070 Ti 8 Go
FG Interface
Lyon Saint Exupery Scenery

ATC on LFLL on Friday 19:00 UTC => 22:00 UTC
daweed
 
Posts: 398
Joined: Thu Dec 11, 2014 11:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Linux Mint 20

Re: Multi properties animations

Postby Thorsten » Wed Nov 18, 2015 7:51 pm

There's only so much time in a day...

At this point, there's two possibilities:

1) conditions in the textranslation animations do not work like in other animations (where arbitrary complex syntax works) - that'd be a bug

2) there's something wrong with your condition

The relevant test is whether you can make your condition work with any other animation (take select for instance). If the same tag gives you correct behavior for the select animation it's 1), else it's 2).

If it's 2), the questions are

a) is the path and property spelled correctly?
b) is the variable type what you think it is?
c) does perhaps replacing

Code: Select all
<property>/services/external-pwr/enable</property>


by

Code: Select all
<equals>
<property>/services/external-pwr/enable</property>
<value>1</value>
</equals>


help.

Break the problem down into testable scenarios, proceed to rule out one by one, get the answer - that's how debugging is done :-)
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Multi properties animations

Postby daweed » Wed Nov 18, 2015 9:15 pm

Thanks, i will report asap, will made rules test one by one as asking.

Thanks for reply

Daweed
Windows 10 / Linux Mint 20
AMD Ryzen 7 3700X |32 Go RAM GeForce RTX 3070 Ti 8 Go
FG Interface
Lyon Saint Exupery Scenery

ATC on LFLL on Friday 19:00 UTC => 22:00 UTC
daweed
 
Posts: 398
Joined: Thu Dec 11, 2014 11:45 am
Location: LFKP LFLL
Callsign: daweed
OS: Linux Mint 20


Return to Systems

Who is online

Users browsing this forum: No registered users and 1 guest