JunyuanDeng/NeRF-LOAM

NaN Result in OptimizablePose Class with Orthogonal Matrix of Determinant -1

Closed this issue · 1 comments

Hi,
I encountered an issue with the OptimizablePose class in the se3pose.py file, where it returns a NaN result for the rotation matrix. This occurs even though the input matrix's first 3x3 upper-left part is orthogonal with a determinant of -1, which should be theoretically valid for rotation matrices.

Steps to Reproduce :
I used the following matrix as input with the code provided in se3pose.py file

before = torch.tensor([[-0.6376737, -0.07767385, -0.76638047, 2.1000],
[-0.2046487, -0.94206723, 0.26575975, 2.0000],
[ 0.74262451, -0.32630677, -0.58483565, 0.8900],
[ 0.0000, 0.0000, 0.0000, 1.0000]])

Upon passing this matrix to the OptimizablePose class, the output for the rotation matrix is NaN, which is unexpected given the input's properties.
Expected Behavior
The class should process an orthogonal 3x3 matrix with a determinant of -1 without resulting in NaN values, considering the mathematical properties of rotation and transformations.

Hi,

Yes, We also found this question before, which will result a failure when a loop occurs.

Indeed, this code cannot deal with a rotation angle approaching 2pi (360 degree) which is exactly the case you provided.

Back to this repo, we avoid to use the function from_matrix. If you want to obtain correct rotation vector, scipy is a better lib:
image