File size: 1,916 Bytes
6a16e42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Revise only motion in the frozen demo; preserve room, speech and clip length."""
from __future__ import annotations
import argparse
import copy
from pathlib import Path

from .common import read, uid, write

REVISION = 'motion_2p6m_v2'
SHIFTS = {'H01': [-2.4, 0., 1.], 'H02': [2.6, 0., 0.],
          'R01': [-2., 0., -1.7], 'R02': [-2.6, 0., 0.]}


def revised_recipe(original):
    recipe = copy.deepcopy(original)
    recipe['motion_revision'] = REVISION
    recipe['motion_constraints'] = dict(minimum_moving_displacement_m=2.,
        maximum_human_speed_mps=.8, maximum_robot_speed_mps=.8,
        minimum_entity_clearance_m=.6, wall_and_furniture_clearance_m=.25)
    parent = recipe['parent_static_scene_id']
    for scene in recipe['scenes']:
        revisions=[REVISION]+([recipe['speech_revision']] if recipe.get('speech_revision') else [])
        scene['scene_id'] = uid(parent, scene['branch'], *revisions)
        scene['scene_group_id'] = uid(parent, 'paired_motion', *revisions)
        for entity in scene['humans'] + scene['robots']:
            entity['displacement_m'] = (list(SHIFTS[entity['entity_id']])
                if entity['entity_id'] in scene['moving_entity_ids'] else [0., 0., 0.])
            entity['motion_duration_s'] = 6.3
        for source in scene['playback_sources']:
            robot = next(r for r in scene['robots'] if r['entity_id'] == source['entity_id'])
            source['displacement_m'] = list(robot['displacement_m'])
            source['motion_duration_s'] = robot['motion_duration_s']
            source['yaw_deg'] = robot['yaw_deg']
    return recipe


if __name__ == '__main__':
    p = argparse.ArgumentParser(); p.add_argument('--root', type=Path, required=True)
    args = p.parse_args(); path = args.root / 'data/recipe.json'
    write(path, revised_recipe(read(path)))
    print('Updated motion only; regenerate FOA, export, then decode binaural.')