-
Notifications
You must be signed in to change notification settings - Fork 803
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
ISAM2: Add variables before computing delta #1707
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.
Touching the internals of iSAM2 needs a bit more explanation. So, two requests:
- Outline the changes you made in iSAM2, and say why they were needed for the Dogleg path, and why the don't disturb the LM path. Just a matter of providing your understanding in the MR for tracking and reviewing purposes.
- if the test was grabbed from an external contributor, you might want to add comments in the code to that effect and also a link to the issue.
@dellaert I updated the PR comment to reflect the understanding behind the fix. About the unit test, @kvmanohar22 was kind enough to create a script illustrating the problem, but I came up with the unit test for it based on my understanding of his script and debugging the issue. His script is instead based on the SFM SmartFactor example you wrote, so I am a bit tangled up about the credit assignment here. |
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.
Awesome, thanks both!
Fixes #301
A
gtsam::ValuesKeyDoesNotExist
error is thrown from the functionnonlinearFactors_.error(theta_)
.The issue is that
nonlinearFactors_.error(theta_)
is computed as an argument toDoglegOptimizerImpl::Iterate
, where a factor with the new key exists buttheta_
has not been updated with the new key-value pairs yet.It is a simple quirk that Dogleg requires the updated Values since it needs them to compute the delta update via the dogleg point.
The issue in
ISAM2::update
is that the delta update is computed first to check for relinearization before the new factors and Values are added. The delta update calls the abovenonlinearFactors_.error(theta_)
method with missing keys intheta_
leading to the exception.Thus the fix is to add in the new variables
newTheta
withaddVariable(newTheta)
before the call toupdateDelta(updateParams.forceFullSolve);
. AFAIAA this step is to do with fluid relinearization and shouldn't affect the LM path since we calladdVariable(newTheta)
before the actual update step in both the LM and Dogleg cases.Update: Piggybacking on this PR to also fix #1672.