(data)
| 360 | # local_velocity (B, seq_len, joint_num*3) |
| 361 | # foot contact (B, seq_len, 4) |
| 362 | def recover_root_rot_pos(data): |
| 363 | rot_vel = data[..., 0] |
| 364 | r_rot_ang = torch.zeros_like(rot_vel).to(data.device) |
| 365 | '''Get Y-axis rotation from rotation velocity''' |
| 366 | r_rot_ang[..., 1:] = rot_vel[..., :-1] |
| 367 | r_rot_ang = torch.cumsum(r_rot_ang, dim=-1) |
| 368 | |
| 369 | r_rot_quat = torch.zeros(data.shape[:-1] + (4,)).to(data.device) |
| 370 | r_rot_quat[..., 0] = torch.cos(r_rot_ang) |
| 371 | r_rot_quat[..., 2] = torch.sin(r_rot_ang) |
| 372 | |
| 373 | r_pos = torch.zeros(data.shape[:-1] + (3,)).to(data.device) |
| 374 | r_pos[..., 1:, [0, 2]] = data[..., :-1, 1:3] |
| 375 | '''Add Y-axis rotation to root position''' |
| 376 | r_pos = qrot(qinv(r_rot_quat), r_pos) |
| 377 | |
| 378 | r_pos = torch.cumsum(r_pos, dim=-2) |
| 379 | |
| 380 | r_pos[..., 1] = data[..., 3] |
| 381 | return r_rot_quat, r_pos |
| 382 | |
| 383 | |
| 384 | def recover_from_rot(data, joints_num, skeleton): |
no test coverage detected