MCPcopy Create free account
hub / github.com/MotrixLab/FineMoGen / recover_root_rot_pos

Function recover_root_rot_pos

mogen/utils/plot_utils.py:69–88  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

67
68
69def recover_root_rot_pos(data):
70 rot_vel = data[..., 0]
71 r_rot_ang = torch.zeros_like(rot_vel).to(data.device)
72 '''Get Y-axis rotation from rotation velocity'''
73 r_rot_ang[..., 1:] = rot_vel[..., :-1]
74 r_rot_ang = torch.cumsum(r_rot_ang, dim=-1)
75
76 r_rot_quat = torch.zeros(data.shape[:-1] + (4, )).to(data.device)
77 r_rot_quat[..., 0] = torch.cos(r_rot_ang)
78 r_rot_quat[..., 2] = torch.sin(r_rot_ang)
79
80 r_pos = torch.zeros(data.shape[:-1] + (3, )).to(data.device)
81 r_pos[..., 1:, [0, 2]] = data[..., :-1, 1:3]
82 '''Add Y-axis rotation to root position'''
83 r_pos = qrot(qinv(r_rot_quat), r_pos)
84
85 r_pos = torch.cumsum(r_pos, dim=-2)
86
87 r_pos[..., 1] = data[..., 3]
88 return r_rot_quat, r_pos
89
90
91def recover_from_ric(data, joints_num):

Callers 1

recover_from_ricFunction · 0.85

Calls 2

qrotFunction · 0.70
qinvFunction · 0.70

Tested by

no test coverage detected