Very impressive and elegant theory to push this field forward!
But I notice there may exist a bug.
|
axis, theta = normalize_vector(rod, return_mag=True) |
|
|
|
sin = torch.sin(theta) |
|
|
|
|
|
qw = torch.cos(theta) |
|
qx = axis[:,0]*sin |
|
qy = axis[:,1]*sin |
|
qz = axis[:,2]*sin |
|
theta = torch.tanh(axisAngle[:,0])*np.pi #[-180, 180] |
|
sin = torch.sin(theta) |
|
axis = normalize_vector(axisAngle[:,1:4]) #batch*3 |
|
qw = torch.cos(theta) |
|
qx = axis[:,0]*sin |
|
qy = axis[:,1]*sin |
|
qz = axis[:,2]*sin |
Code above are the function converting axisangle/rodrigues to rotation matrix.
The θ passed to
torch.sin and
torch.cos is the identity but should be θ/2 instead, referring to
Maths - AxisAngle to Quaternion
I've hand-written a toy case (rotate y axis by 90 degrees around x axis) and only θ/2 is correct.
I wonder if it is a bug, and if so, does it influence other conversion functions and further influence result of experiments?
Very impressive and elegant theory to push this field forward!
But I notice there may exist a bug.
RotationContinuity/sanity_test/code/tools.py
Lines 172 to 180 in aee1e34
RotationContinuity/sanity_test/code/tools.py
Lines 141 to 147 in aee1e34
Code above are the function converting axisangle/rodrigues to rotation matrix.
The θ passed to
torch.sinandtorch.cosis the identity but should be θ/2 instead, referring to Maths - AxisAngle to QuaternionI've hand-written a toy case (rotate y axis by 90 degrees around x axis) and only θ/2 is correct.
I wonder if it is a bug, and if so, does it influence other conversion functions and further influence result of experiments?