]> git.mxchange.org Git - flightgear.git/blob - scripts/python/demo.py
Updated to document the new 3d positional tags that are available for
[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 fg['/sim/time/elapsed-ms'] < 5000:
9         time.sleep(1.0)
10
11     # parking brake on
12     fg['/controls/parking-brake'] = 1
13
14     heading = fg['/orientation/heading-deg']
15
16     # Switch to external view for for 'walk around'.
17     fg.view_next()
18
19     fg['/sim/current-view/goal-heading-offset-deg'] = 180.0
20     fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 180.0)
21         
22     fg['/sim/current-view/goal-heading-offset-deg'] = 90.0
23     fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 90.0)
24         
25     fg['/sim/current-view/goal-heading-offset-deg'] = 0.0
26     fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 0.0)
27     
28     time.sleep(2.0)
29
30     # Switch back to cockpit view
31     fg.view_prev()
32
33     time.sleep(2.0)
34
35     # Flaps to take off position
36     fg['/controls/flaps'] = 0.34
37     fg.wait_for_prop_eq('/surface-positions/flap-pos-norm', 0.34)
38
39     fg.quit()
40     
41 if __name__ == '__main__':
42     main()