George PATTERSON:
"Flightgear.py - Added the procedures view_next and view_prev demo.py - altered the wait five seconds to the new property path and allowed for the script to be started after five seconds of simulation file (/sim/time/elapsed-sec). - the section of code was changed to a pythonism as python does not support do-while loops, instead you break out of a continuous loop. - Commented out the fg.wait_for_prop_eq() method as I haven't rewritten that part of the code yet. Not sure of the best way to do that. Those lines may not be necessary any more." mf: removed trailing spaces; I updated the pyc, too, but I really think it shouldn't be in CVS at all.(?)
This commit is contained in:
parent
cf86ca67f8
commit
1d15a9272b
3 changed files with 24 additions and 11 deletions
|
@ -140,3 +140,12 @@ class FlightGear:
|
|||
if self.telnet:
|
||||
self.telnet.quit()
|
||||
self.telnet = None
|
||||
|
||||
def view_next(self):
|
||||
#move to next view
|
||||
self.telnet.set( "/command/view/next", "true")
|
||||
|
||||
def view_prev(self):
|
||||
#move to next view
|
||||
self.telnet.set( "/command/view/prev", "true")
|
||||
|
||||
|
|
Binary file not shown.
|
@ -5,8 +5,12 @@ def main():
|
|||
fg = FlightGear('localhost', 5500)
|
||||
|
||||
# Wait five seconds for simulator to settle down
|
||||
while fg['/sim/time/elapsed-ms'] < 5000:
|
||||
while 1:
|
||||
if fg['/sim/time/elapsed-sec'] > 5:
|
||||
break
|
||||
time.sleep(1.0)
|
||||
print fg['/sim/time/elapsed-sec']
|
||||
|
||||
|
||||
# parking brake on
|
||||
fg['/controls/parking-brake'] = 1
|
||||
|
@ -17,13 +21,13 @@ def main():
|
|||
fg.view_next()
|
||||
|
||||
fg['/sim/current-view/goal-heading-offset-deg'] = 180.0
|
||||
fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 180.0)
|
||||
#fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 180.0)
|
||||
|
||||
fg['/sim/current-view/goal-heading-offset-deg'] = 90.0
|
||||
fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 90.0)
|
||||
#fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 90.0)
|
||||
|
||||
fg['/sim/current-view/goal-heading-offset-deg'] = 0.0
|
||||
fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 0.0)
|
||||
#fg.wait_for_prop_eq('/sim/current-view/heading-offset-deg', 0.0)
|
||||
|
||||
time.sleep(2.0)
|
||||
|
||||
|
@ -34,7 +38,7 @@ def main():
|
|||
|
||||
# Flaps to take off position
|
||||
fg['/controls/flaps'] = 0.34
|
||||
fg.wait_for_prop_eq('/surface-positions/flap-pos-norm', 0.34)
|
||||
#fg.wait_for_prop_eq('/surface-positions/flap-pos-norm', 0.34)
|
||||
|
||||
fg.quit()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue