MCPcopy Create free account
hub / github.com/FlightGear/flightgear / main

Function main

scripts/python/video.py:17–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15import time
16
17def main():
18 fgfs = f'./build-walk/fgfs.exe-run.sh'
19
20 args = iter(sys.argv[1:])
21 while 1:
22 try:
23 arg = next(args)
24 except StopIteration:
25 break
26 if arg == '-f':
27 fgfs = next(args)
28 else:
29 raise Exception(f'Unrecognised arg: {arg}')
30
31 fg = recordreplay.Fg(
32 'harrier-gr3',
33 f'{fgfs}'
34 + f' --state=vto --airport=egtk'
35 + f' --prop:/sim/replay/record-main-view=1'
36 + f' --prop:bool:/sim/replay/record-main-window=0'
37 ,
38 )
39
40 fg.waitfor('/sim/fdm-initialized', 1, timeout=45)
41 fg.fg['/sim/current-view/view-number-raw'] = 1 # helicopter
42
43 # Rotation speed.
44 fg.fg['/controls/auto-hover/rotation-speed-target'] = 4
45 fg.fg['/controls/auto-hover/rotation-mode'] = 'speed'
46
47 # These will have been set by --state=vto
48 # Sideways speed.
49 fg.fg['/controls/auto-hover/x-speed-target'] = '0'
50 fg.fg['/controls/auto-hover/x-mode'] = 'speed'
51
52 # Vertical speed.
53 fg.fg['/controls/auto-hover/y-speed-target'] = '0'
54 fg.fg['/controls/auto-hover/y-mode'] = 'speed'
55
56 # Forwards speed.
57 fg.fg['/controls/auto-hover/z-speed-target'] = '0'
58 fg.fg['/controls/auto-hover/z-mode'] = 'speed'
59
60 results = []
61
62 def make_recording(codec, container, quality, speed, fixed_dt=None):
63 '''
64 Create recording using specified codec etc.
65 '''
66 fg.fg['/sim/video/container'] = container
67 fdm_time_begin = fg.fg['/sim/time/simple-time/fdm']
68 if fixed_dt:
69 fg.fg['/sim/time/simple-time/enabled'] = True
70 fg.fg['/sim/time/fixed-dt'] = fixed_dt
71 name = f'video-test-c={codec}-q={quality}-s={speed}.{container}'
72 frames_start = fg.fg['/sim/frame-number']
73 fg.run_command( f'run video-start name={name} quality={quality} speed={speed} codec={codec}')
74 dt = 10

Callers 1

video.pyFile · 0.70

Calls 7

waitforMethod · 0.95
run_commandMethod · 0.95
ExceptionClass · 0.85
printFunction · 0.85
timeMethod · 0.80
make_recordingFunction · 0.70
sleepMethod · 0.45

Tested by

no test coverage detected