Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems in root_rot_velocity calculation #156

Open
pridy999 opened this issue Oct 13, 2024 · 1 comment
Open

Problems in root_rot_velocity calculation #156

pridy999 opened this issue Oct 13, 2024 · 1 comment

Comments

@pridy999
Copy link

Thanks for your great work!
There might be a small error in the calculation of root_rot_velocity.

In the original version, it is calculated through qmul function:
r_velocity = qmul_np(r_rot[1:], qinv_np(r_rot[:-1]))
This step is fine, however, there is an inconsistency when using this result to calculate the corresponding angle:
r_velocity = np.arcsin(r_velocity[:, 2:3])

This is because qmul can generate the quaternion with the first component negative. But when we use arcsin to calculate the angles, the angle can only be in the range of [-pi, pi], which means that the first component in the quaternion can not be negative.
So it is inaccurate to use arcsin directly to get the corresponding angle along the Y-axis.

To resolve this issue, we need to ensure that any negative w components are converted to positive before calculating the angles.

def q_regulate(q):
    w_negative = q[..., 0] < 0
    q[w_negative] *= -1
    return q
r_velocity = qmul_np(r_rot[1:], qinv_np(r_rot[:-1]))
r_velocity = q_regulate(r_velocity)
r_velocity = np.arcsin(r_velocity[:, 2:3])

By regulating the quaternions this way, we can recover the correct rot_vel from new_joints.npy.

@XingliangJin
Copy link

I'm using HumanML3D and noticed that in some motions, the root joint's angular velocity along the Y-axis exhibits sudden single-frame sign changes. Could these abrupt sign changes be due to the issue you mentioned with the root_rot_velocity calculation? Below is a plot of the angular velocity curve (for 000021.npy) with the observed sign jumps:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants