]> git.mxchange.org Git - flightgear.git/blob - scripts/python/demo.py
Fix a typo breaking some takeoff-state logic.
[flightgear.git] / scripts / python / demo.py
1 from FlightGear import FlightGear
2 import time
3
4 def main():
5     fg = FlightGear('localhost', 5500)
6
7     # Wait five seconds for simulator to settle down
8     while 1:
9         if fg['/sim/time/elapsed-sec'] > 5:
10             break
11         time.sleep(1.0)
12         print fg['/sim/time/elapsed-sec']
13
14
15     # parking brake on
16     fg['/controls/parking-brake'] = 1
17
18     heading = fg['/orientation/heading-deg']
19
20     # Switch to external view for for 'walk around'.
21     fg.view_next()
22
23     fg['/sim/current-view/goal-heading-offset-deg'] = 180.0
24     #fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 180.0)
25
26     fg['/sim/current-view/goal-heading-offset-deg'] = 90.0
27     #fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 90.0)
28
29     fg['/sim/current-view/goal-heading-offset-deg'] = 0.0
30     #fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 0.0)
31
32     time.sleep(2.0)
33
34     # Switch back to cockpit view
35     fg.view_prev()
36
37     time.sleep(2.0)
38
39     # Flaps to take off position
40     fg['/controls/flaps'] = 0.34
41     #fg.wait_for_prop_eq('/surface-positions/flap-pos-norm', 0.34)
42
43     fg.quit()
44
45 if __name__ == '__main__':
46     main()