Skip to content

Use doublecross instead of cross(Cross(a, b)) in NavState#2287

Merged
dellaert merged 4 commits intoborglab:developfrom
scottiyio:centripetal
Nov 18, 2025
Merged

Use doublecross instead of cross(Cross(a, b)) in NavState#2287
dellaert merged 4 commits intoborglab:developfrom
scottiyio:centripetal

Conversation

@scottiyio
Copy link
Copy Markdown
Contributor

Change cross(cross(a, b)) to doubleCross(a, b) and add documentation

Add a no rotation coriolis test to NavState

Change cross(cross(a, b)) to doubleCross(a, b)
Vector9 n_xi, xi;
Matrix3 D_dR_R, D_dP_R, D_dV_R, D_body_nav;
dR(n_xi) << ((-dt) * omega);
dP(n_xi) << ((-dt2) * omega_cross_vel); // NOTE(luca): we got rid of the 2 wrt INS paper
dV(n_xi) << ((-2.0 * dt) * omega_cross_vel);
if (secondOrder) {
const Vector3 omega_cross2_t = omega.cross(omega.cross(n_t));
const Vector3 omega_cross2_t = doubleCross(omega, n_t);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think switching to doubleCross is most beneficial if we also grab its Jacobians and use them below to replace some complexity in the Jacobian chaining...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I did a bit of tests and had one term not matching (probably because I didn't check myself and just trusted copilot) so I will look again tonight

There's also some doublecrosses elsewhere I believe

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of this code was rearranged. I wanted to only create doubleCross() once which might be the wrong approach. So H2_wrt_t is created even if we don't use it. Not sure.

Change cross(cross(a, b)) to doubleCross(a, b)
- Remove excess white space
@scottiyio scottiyio changed the title Add notes to NavState::coriolis Use doublecross instead of cross(Cross(a, b)) in NavState Oct 22, 2025
@scottiyio scottiyio requested a review from dellaert October 22, 2025 02:32
// Get perturbations in nav frame
Vector9 n_xi, xi;
Matrix3 D_dR_R, D_dP_R, D_dV_R, D_body_nav;
// Because our navigation frames are placed on a spinning Earth, we experience two apparent forces on our inertials
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this up before sig

dR(n_xi) << ((-dt) * omega);
dP(n_xi) << ((-dt2) * omega_cross_vel); // NOTE(luca): we got rid of the 2 wrt INS paper
dV(n_xi) << ((-2.0 * dt) * omega_cross_vel);

// Centrifugal (second order) acceleration corrections
Matrix3 H2_wrt_t; // To store Jacobian (if needed/desired)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D_c2_nt

nRb.unrotate(dV(n_xi), H ? &D_dV_R : 0);
// Transform correction from navigation frame -> body frame and get Jacobians
Vector9 xi;
Matrix3 D_dR_R, D_dP_R, D_dV_R, D_body_nav;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D_body_nav -> Rt, and remark that second derivative is the same for all three.

const Matrix3 D_cross2_state = Omega * D_cross_state;
D_t_t(H) -= D_body_nav * (0.5 * dt2) * D_cross2_state;
D_v_t(H) -= D_body_nav * dt * D_cross2_state;
D_t_t(H) -= (0.5 * dt2) * D_body_nav * (H2_wrt_t * R());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D_p_p(H) -= (0.5 * dt2) * D_c2_np; ???

D_t_t(H) -= D_body_nav * (0.5 * dt2) * D_cross2_state;
D_v_t(H) -= D_body_nav * dt * D_cross2_state;
D_t_t(H) -= (0.5 * dt2) * D_body_nav * (H2_wrt_t * R());
D_v_t(H) -= dt * D_body_nav * (H2_wrt_t * R());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dt * D_c2_np; ????

I'd add a unit test with non-identity R before - make sure it fails - then apply fix, should succeed.

@dellaert
Copy link
Copy Markdown
Member

Would love to merge this!

…larations.

Rotated omega (earth angular rate, not IMU angular velocities) to the body frame for simplification

Cannot rename "D_t_t" to say "D_p_p" or "D_v_t" to "D_v_p" because of NavState derivatives?
@scottiyio scottiyio requested a review from dellaert November 18, 2025 06:48
@dellaert dellaert marked this pull request as ready for review November 18, 2025 20:35
@dellaert dellaert merged commit d08c72a into borglab:develop Nov 18, 2025
34 checks passed
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

Successfully merging this pull request may close these issues.

2 participants