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

Function examine_values

scripts/python/recordreplay.py:516–548  ·  view source on GitHub ↗

Looks at /sim/replay/log-raw-speed{infix}-values/value[], which will contain measured speed of user/MP UFO. We check that the values are all as expected - constant speed.

(infix='')

Source from the content-addressed store, hash-verified

514
515 errors = []
516 def examine_values(infix=''):
517 '''
518 Looks at /sim/replay/log-raw-speed{infix}-values/value[], which will
519 contain measured speed of user/MP UFO. We check that the values are all
520 as expected - constant speed.
521 '''
522 log(f'== Looking at /sim/replay/log-raw-speed{infix}-values/value[]')
523 items0 = fg.fg.ls( f'/sim/replay/log-raw-speed{infix}-values')
524 log(f'{infix} len(items0)={len(items0)}')
525 assert items0, f'Failed to read items in /sim/replay/log-raw-speed{infix}-values/'
526 items = []
527 descriptions = []
528 for item in items0:
529 if item.name == 'value':
530 #log(f'have read item: {item}')
531 items.append(item)
532 elif item.name == 'description':
533 descriptions.append(item)
534 num_errors = 0
535 for i in range(len(items)-1): # Ignore last item because replay at end interpolates.
536 item = items[i]
537 description = ''
538 if i < len(descriptions):
539 description = descriptions[i].value
540 speed = float(item.value)
541 prefix = ' '
542 if abs(speed - fixed_speed) > 0.1:
543 num_errors += 1
544 prefix = '*'
545 log( f' {infix} {prefix} speed={speed:12.4} details: {item}: {description}')
546 if num_errors != 0:
547 log( f'*** Replay showed uneven speed')
548 errors.append('1')
549
550 def show_values(paths):
551 if isinstance(paths, str):

Callers 1

test_motionFunction · 0.85

Calls 4

absFunction · 0.85
logFunction · 0.70
lsMethod · 0.45
appendMethod · 0.45

Tested by 1

test_motionFunction · 0.68