-
Notifications
You must be signed in to change notification settings - Fork 767
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
Fixed issue with Coriolis acceleration #505
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So (following up from our earlier email conversation) now that I see the change more clearly, I am not convinced that this is right. In particular, I am not convinced dP and dV are in nav coordinates. I'd suggest you read the doc/ImuFactor.pdf where -I skimmed through it again- the tangent space quantities seem to be in body coordinates. Admittedly, the document is a bit of a slug to get through.
Regardless what the case might be, the fact that you can make this change without any unit test failing means this piece of code is not actually tested, and a test should be added that helps us decide on the truth.
I'm hoping you'll stick with me and we'll get to the bottom of it. This is important :-)
I am convinced that as written
These are the only vector terms in
I agree that it seems like this code is not unit tested in a rich enough scenario to reveal the bug. It is tested for self consistency, ensuring that the analytical and numerical Jacobians match. |
Aha, I think I might have had it backwards, indeed ! You are converting from nav to body, to agree with the convention in ImuFactor - that tangent space is in body coordinates. That sounds great, and especially the addition of a fail-first-then-succeed unit test provides a warm feeling :-) Will review again and merge on CI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! One nit left :-)
gtsam/navigation/NavState.cpp
Outdated
// NOTE(tim): position and velocity changes dP and dV are in nav frame; need | ||
// to put them into local frame for subsequent retract | ||
dP(xi) = bRn * dP(xi); | ||
dV(xi) = bRn * dV(xi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not loving this imperative code here now, so I propose you build n_xi above (you forgot one unrotate, BTW), and then here:
// Convert to body-coordinates:
Vector9 xi;
xi << bRn * dR(n_xi), bRn * dP(n_xi), bRn * dV(n_xi);
Makes it clearer overall as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I forgot one unrotate, since dR was already unrotated in your original code. My style was meant to minimize the changes to existing code. But since you asked, I have pushed a commit that I think makes it clearer what is going on, mostly as you suggest.
OK, this is awesome! Many thanks for this excellent contribution! I will merge now. |
The corrections for dP and dV are in the navigation frame, whereas xi is in the local frame. The easiest fix is just to rotate it into the local frame within the coriolis function. I have updated the Jacobians as well.