-
Notifications
You must be signed in to change notification settings - Fork 802
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
Regression in Logmap (v4.2a7) #1233
Comments
Thanks! Judging from this data it seems 1e-8 is a better choice, however this may reduce the precision when detR is slightly off 1. The unit test for this case is also in #887, so if 1e-8 can pass that test I would say it's safe to change. @lpea |
HI @ProfFan, I've been quite busy these last days but will try to have a look at the test you mentioned soon with a threshold value of 1e-8. Speaking of tests, it could be worth adding one to check this error introduced by applying Logmap-Expmap near the singularity and spot this kind of discrepancy if the approximation ever changes in the future. Edit: had the time to run the |
Yeah, we may need to think about this more closely... Numeric behavior is VERY tricky. One of the ways I can think of for doing this is introducing a slow path where we just do the full SVD when detecting a rotation that is not detA = 1. However this will give extra computation burden. Actually, I wonder if it is solvable by just adding more Taylor terms. @lpea thoughts? |
Yep, I tried with // const double mag = M_PI - (2 * sgn_w * W) / norm;
const double mag = M_PI - (2 * sgn_w * W) / norm + 0.5 * M_PI * W*W / (norm*norm) - 4 * sgn_w * W*W*W / (3 * norm*norm*norm); and also replace // const double Qx = 2.0 + 2.0 * Rxx;
const double Qx = 1 + 2 * Rxx - tr; but it did not seem to change much... Could you double check that the maths is correct? BTW, could you share an updated version of the paper you mentioned in #892? |
Sorry for the late response! Was busy for other stuff. I think one can try to cross-check the approximated quaternion with the actual quaternion. I currently do not have bandwidth for re-checking the math, but I will be able to answer your questions against what I've written in the document. |
@lpea wonder if it is numerically negatively impacting your application? |
I can take a few hours to look at it immediately if that is the case |
@ProfFan It does not seem to be troublesome as far as I'm concerned. |
Thanks @lpea , I'll take a look later then |
@ProfFan re-visiting this so we can close. Introducing a strong discontinuity where there was none before definitely needs re-checking the math :-) |
Is there a patch planed on this? would |
Hi all,
As discussed in https://groups.google.com/g/gtsam-users/c/7dEKY53G4Jk:
According to @ProfFan, this is a side-effect of #887.
Description
There is a precision error in Logmap for rotation angles close to PI. Furthermore, the conversion error exhibits a strong discontinuity.
Steps to reproduce
C++ code:
Python script to generate the graphs:
Results
Expected behavior
The conversion error should remain reasonably low, i.e. not dramatically higher than in version 4.0.3. In the worst case it jumped by 7 orders of magnitude, from 1e-12 to 1e-5.
Environment
GTSAM 4.2a7, C++, Linux Fedora 36.
Additional information
Reducing the threshold value on the trace of the rotation matrix used to switch between the generic formula and the Taylor series reduces the high discontinuity in the conversion error and brings it down to a level similar to that of GTSAM 4.0.3.
gtsam/gtsam/geometry/SO3.cpp
Line 264 in 30412b8
Results for various threshold values (cf. graph title):
The text was updated successfully, but these errors were encountered: