Robotics - [3D SLAM Lab Records - 5] Numerical Stability - Local-Frame vs. World-Frame Hessian

Point-to-Plane ICP Hessian, Determinant, Trace, Eigenvalues

Posted by Rico's Nerd Cluster on March 11, 2025

This builds on the point-to-plane ICP Jacobian in 3D SLAM - 1: Scan Matching.

One acute observation regarding the numerical stability of the Hessian matrix is that points expressed in world coordinates can quickly make the point-to-plane ICP Hessian become nearly singular, even though geometrically the two formulations should be equivalent.

1. Local-frame vs. world-frame Hessian

Using the left perturbation Jacobian:

\[J_i= \begin{bmatrix} \mathbf a_i^T & \mathbf n_i^T \end{bmatrix}\]

where

\[\mathbf a_i=\mathbf r_i\times\mathbf n_i.\]

The Hessian is

\[\begin{aligned} H_l &=\sum_i J_i^TJ_i\\ &=\sum_i \begin{bmatrix} \mathbf a_i\mathbf a_i^T& \mathbf a_i\mathbf n_i^T\\ \mathbf n_i\mathbf a_i^T& \mathbf n_i\mathbf n_i^T \end{bmatrix}. \end{aligned}\]

Assume now we express the points in the world frame. Let \(\mathbf p\) be the position of the local frame with respect to the world origin, with both coordinate frames having the same orientation. Now,

\[\mathbf a_{i,w} =(\mathbf p+\mathbf r_i)\times\mathbf n_i.\]

Therefore,

\[\begin{aligned} J_{i,w} &= \begin{bmatrix} [(\mathbf p+\mathbf r_i)\times\mathbf n_i]^T& \mathbf n_i^T \end{bmatrix}\\ &= \begin{bmatrix} (\mathbf r_i\times\mathbf n_i+ \mathbf p\times\mathbf n_i)^T& \mathbf n_i^T \end{bmatrix}. \end{aligned}\]

Since

\[\mathbf p\times\mathbf n_i =[\mathbf p]_\times\mathbf n_i\]

and

\[[\mathbf p]_\times^T=-[\mathbf p]_\times,\]

we have

\[J_{i,w}= \begin{bmatrix} \mathbf a_i^T-\mathbf n_i^T[\mathbf p]_\times& \mathbf n_i^T \end{bmatrix}.\]

We can express the world-frame Jacobian as

\[\boxed{J_{i,w}=J_iT}\]

where

\[T= \begin{bmatrix} I&0\\ -[\mathbf p]_\times&I \end{bmatrix}.\]

Then the world-frame Hessian is

\[\begin{aligned} H_w &=\sum_i J_{i,w}^TJ_{i,w}\\ &=\sum_i T^TJ_i^TJ_iT\\ &=T^T\left(\sum_i J_i^TJ_i\right)T. \end{aligned}\]

Therefore,

\[\boxed{H_w=T^TH_lT}.\]

2. Determinant of the Hessian

Recall that the trace and determinant of a matrix are related to its eigenvalues:

\[\operatorname{tr}(H)=\sum_{i=1}^{6}\lambda_i\] \[\det(H)=\prod_{i=1}^{6}\lambda_i.\]

Note that the determinant is only defined for square matrices. To see why \(\det(H)\) is the product of the eigenvalues, eigen-decompose the symmetric Hessian as \(H = Q\Lambda Q^T\), where \(Q\) is orthogonal (\(QQ^T = I\)) and \(\Lambda\) is diagonal. Since \(\det(I) = 1\):

\[\begin{aligned} \det(Q\Lambda Q^T) &= \det(Q)\det(\Lambda)\det(Q^T) \\ &= \det(\Lambda)\det(QQ^T) \\ &= \det(\Lambda) \end{aligned}\]

So \(\det(H) = \det(\Lambda) = \prod_i \lambda_i\).

Similarly for the trace, using the cyclic property \(\operatorname{tr}(AB) = \operatorname{tr}(BA)\):

\[\operatorname{tr}(H) = \operatorname{tr}(Q\Lambda Q^T) = \operatorname{tr}(\Lambda Q^TQ) = \operatorname{tr}(\Lambda) = \sum_i \lambda_i\]
  • The determinant has the same swap property for square \(A, B\): \(\det(AB) = \det(A)\det(B) = \det(BA)\).

So we first look at the determinant of \(H_w\).

\(T\) is a block triangular matrix \(\begin{bmatrix}A&0\\ C&D\end{bmatrix}\), so we can find its determinant by row elimination:

\[T= \begin{bmatrix} I_3&0\\ -[\mathbf p]_\times&I_3 \end{bmatrix}\]

We can identify:

\[A=I_3,\quad C=-[\mathbf p]_\times,\quad D=I_3\]

Since \(A^{-1}=I_3\), the elimination works immediately. Adding a combination of the top rows to the bottom rows does not change the determinant:

\[R_{\text{bottom}}\leftarrow R_{\text{bottom}}+[\mathbf p]_\times R_{\text{top}}\]

This gives:

\[T'= \begin{bmatrix} I_3&0\\ 0&I_3 \end{bmatrix} =I_6\]

Consequently:

\[\boxed{\det(T)=\det(I_6)=1}\]

Also,

\[\det(T^T)=\det(T)=1.\]

Therefore,

\[\begin{aligned} \det(H_w) &=\det(T^TH_lT)\\ &=\det(T^T)\det(H_l)\det(T)\\ &=\det(T)^2\det(H_l)\\ &=\det(H_l). \end{aligned}\] \[\boxed{\det(H_w)=\det(H_l)}\]

So regardless of how far the robot is from the world origin, the determinant of the Hessian remains unchanged, assuming the local geometry remains the same.

In other words, the product of the eigenvalues remains constant:

\[\boxed{ \prod_{i=1}^{6}\lambda_{i,w} = \prod_{i=1}^{6}\lambda_{i,l} }\]

3. Trace of the Hessian

Write the local Hessian as

\[H_l= \begin{bmatrix} A&B\\ B^T&C \end{bmatrix}, \qquad P=[\mathbf p]_\times.\]

Note that

\[T= \begin{bmatrix} I&0\\ -P&I \end{bmatrix}, \qquad T^T= \begin{bmatrix} I&P\\ 0&I \end{bmatrix}.\]

Expanding \(T^TH_lT\):

\[\boxed{ H_w= \begin{bmatrix} A-BP+PB^T-PCP&B+PC\\ B^T-CP&C \end{bmatrix} }\]

Therefore,

\[\begin{aligned} \operatorname{tr}(H_w) ={}&\operatorname{tr}(A)+\operatorname{tr}(C)\\ &+\operatorname{tr}(-BP+PB^T)\\ &+\operatorname{tr}(PCP^T). \end{aligned}\]

Since

\[\operatorname{tr}(H_l) =\operatorname{tr}(A)+\operatorname{tr}(C),\]

we have

\[\boxed{ \begin{aligned} \operatorname{tr}(H_w) ={}&\operatorname{tr}(H_l)\\ &+\underbrace{\operatorname{tr}(-BP+PB^T)}_{\text{linear in }\mathbf p}\\ &+\underbrace{\operatorname{tr}(PCP^T)}_{\text{quadratic in }\mathbf p}. \end{aligned} }\]

The last term is quadratic in \(\mathbf p\). To see this, recall that

\[P^TP=\|\mathbf p\|^2I-\mathbf p\mathbf p^T.\]

Using the cyclic property of the trace,

\[\begin{aligned} \operatorname{tr}(PCP^T) &=\operatorname{tr}(CP^TP)\\ &=\operatorname{tr} \left(C(\|\mathbf p\|^2I-\mathbf p\mathbf p^T)\right)\\ &=\|\mathbf p\|^2\operatorname{tr}(C) -\mathbf p^TC\mathbf p. \end{aligned}\]

Therefore,

\[\boxed{ \operatorname{tr}(PCP^T) = \|\mathbf p\|^2\operatorname{tr}(C) -\mathbf p^TC\mathbf p }\]

Recall that

\[C=\sum_i\mathbf n_i\mathbf n_i^T.\]

Assuming all surface normals are unit vectors,

\[\operatorname{tr}(C)=N,\]

and therefore,

\[\begin{aligned} \operatorname{tr}(PCP^T) &=N\|\mathbf p\|^2 -\sum_i(\mathbf p^T\mathbf n_i)^2\\ &=\|\mathbf p\|^2\sum_i\sin^2\theta_i, \end{aligned}\]

where \(\theta_i\) is the angle between \(\mathbf p\) and \(\mathbf n_i\).

So, as the robot moves further away from the world origin, the quadratic term eventually dominates the trace of the Hessian, provided that the surface normals are not all parallel to \(\mathbf p\).

\[\boxed{ \operatorname{tr}(H_w)=O(\|\mathbf p\|^2) }\]

4. What happens to the eigenvalues?

So far, we have established two properties:

\[\boxed{ \begin{aligned} \prod_{i=1}^{6}\lambda_{i,w} &=\det(H_l)=\text{constant}\\ \sum_{i=1}^{6}\lambda_{i,w} &=\operatorname{tr}(H_w)=O(\|\mathbf p\|^2). \end{aligned} }\]

In other words, the sum of the eigenvalues grows quadratically with the distance from the origin, while their product remains constant.

The largest eigen value would grow in O(r^2)!!