Board index FlightGear Development

xml state-machine

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

xml state-machine

Postby rleibner » Thu Dec 27, 2018 9:21 pm

Hi,
With the desire to learn, I've included into my preferences.xml the following lines:
Code: Select all
 <sim>
 . . . .
   <systems>
            <silly>
       <path>/home/rodolfo/.fgfs/silly.xml</path>
            </silly>
   </systems>
 . . . .
</sim>

and my silly.xml file reads:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>

<PropertyList>
    <state-machine>
        <branch>/satc</branch>

        <!-- States -->
        <state>
            <name>initial</name>
        </state>
        <state>
            <name>climbing</name>
       <enter>
                <command>property-assign</command>
                <property>/sim/sound/voices/atc</property>
                <value type="string">You are on climbing.</value>
       </enter>
        </state>
        <state>
            <name>descending</name>
       <enter>
                <command>property-assign</command>
                <property>/sim/sound/voices/atc</property>
                <value type="string">You are descending !</value>
       </enter>
        </state>

        <!-- Transitions -->
        <transition>
            <name>init</name>
            <target>initial</target>
            <condition>
         <less-than>
           <property>/velocities/vertical-speed-fps</property>
           <value>10</value>
         </less-than>
         <greater-than>
           <property>/velocities/vertical-speed-fps</property>
           <value>-10</value>
         </greater-than>
            </condition>
        </transition>

        <transition>
            <name>to climbing</name>
            <source>initial</source>
            <target>climbing</target>
            <condition>
         <greater-than>
           <property>/velocities/vertical-speed-fps</property>
           <value>20</value>
         </greater-than>
            </condition>
        </transition>

        <transition>
            <name>to descending</name>
            <source>initial</source>
            <target>descending</target>
            <condition>
         <less-than>
           <property>/velocities/vertical-speed-fps</property>
           <value>-20</value>
         </less-than>
            </condition>
        </transition>

</state-machine>
</PropertyList>


I launch the FGFS session (including --config=/home/rodolfo/.fgfs/preferences.xml) and takeoff... Nothing happens, no ATC voice at all. :x

What am I missing?
Rodolfo
*************************
Non-shared knowledge is lost knowledge
User avatar
rleibner
 
Posts: 246
Joined: Fri May 19, 2017 7:17 pm
Location: Uruguay - SUMU
Callsign: CX-BEX
Version: 2180.4.0
OS: Ubuntu 18.04

Re: xml state-machine

Postby Thorsten » Fri Dec 28, 2018 7:45 am

The correct designation of the file as property rule system - 'silly' is not a name that is recognized by the parser. See

http://wiki.flightgear.org/Autopilot_co ... _reference
Thorsten
 
Posts: 10819
Joined: Mon Nov 02, 2009 8:33 am

Re: xml state-machine

Postby Hooray » Sat Dec 29, 2018 7:47 pm

BTW: Unless I am terribly mistaken here, you shouldn't have to explicitly specify $FG_HOME/defaults.xml
For details, please refer to the wiki page documenting $FG_HOME and defaults.xml (preferences.xml).

Also, I don't think that you have to use absolute paths. For testing purposes, it is usually best to try $FG_ROOT directly, and then (once your modifications work) move things into $FG_HOME, possibly using a dedicated directory.

Obviously, with your track record in addon development, you could also just use any of your add-ons to test such things.
Again, --config started basically out as the way for --addon
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11324
Joined: Tue Mar 25, 2008 8:40 am


Return to Development

Who is online

Users browsing this forum: No registered users and 0 guests