-
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
Update Simitary3 with Align feature #464
Conversation
Release version 4.0.1
Release version 4.0.2
Bump version to 4.0.2
Exported config files are preferred over modules, and easier to maintain.
…e_for_4.0.2 Fix GTSAM version detection for 4.0.2
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.
This is awesome. I've been meaning to update the Sim(3)
code for a while now so this makes life really good. Thanks @Alexma3312.
Please look at my comments and address them?
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! But I have a lot of advice :-)
@Alexma3312 please don't push to repo until you resolved all comments in my review. Every push triggers a long CI process. |
Please merge in develop before pushing, as well. We changed CI system. |
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.
Becoming beautiful! I'd just like to see one more big change, in addition to a few minor comments
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.
Confused. If my comment does not make sense maybe we should meet. But try to understand what I am suggesting first :-)
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.
Woohoo, so much clearer and faster. One more round which is mostly style but also some remaining performance improvements. Esp unpacking pairs is not needed in most cases, which will yield speed improvement and clarity (in case of centroids).
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.
Brilliant! This is high-quality code now!! super-factored :-)
There is one issue to be resolved before we can merge: the 2 checks with quaternion=ON are failing. Please compile with quaternions to see whether you can diagnose the issue?
I found that the issue occurs on the Rot3(1, 0, 0, 0, 1, 0, 0, 0, -1).
Output:
Moreover, I created a new test for the compose function in testRot3.cpp:
The error of expected_2 when the quaternions flag is on is:
The error still occurs and remains the same when I switch from
to
|
That matrix is a reflection, not a rotation, I think. I have no idea where you copied this line from, though. Is that in a test, or where?? |
That line is not in a test. I can create a test in testRot3, but yes, you are right the matrix is a reflection. And that causes the quaternions issue, I will fix the unittests for Similarity3. |
Congrats @Alexma3312 , and many thanks for your patience and diligence. I know I was demanding during the review :-) |
PS @Alexma3312 if you want to write a blog post about this (you have examples in the test) then I’ll post it on gtsam.org and tweet about it :-) |
Thank you @dellaert for spending your time helping me to improve my coding style. I will be happy to write a blog post about this. |
aCentroid += abPair.first; | ||
bCentroid += abPair.second; | ||
} | ||
const double f = 1.0 / n; |
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.
Throw an exception if n==0
?
PS: Sorry for the late comment... :-S
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.
@jlblancoc Thanks for the catch. I will create a new PR to fix it.
This PR adds four functions into the Similarity3 class.
The code format is based on Google format and GTSAM::Pose3::Align().
Visualization of unit tests for the Align functions:
Input:
r_point1 = Point3(0, 0, 0) g_point1 = Point3(6, 8, 10)
r_point2 = Point3(3, 0, 0) g_point2 = Point3(6, 2, 10)
r_point3 = Point3(3, 0, 4) g_point3 = Point3(6, 2, 18)
Output:
gRr = Rot3.Rz(math.radians(-90))
s = 2
gtr = Point3(6, 8, 10)
r_pose1 = Pose3(Rot3(1, 0, 0, 0, 1, 0, 0, 0, 1), Point3(0, 0, 0))
r_pose2 = Pose3(Rot3(-1, 0, 0, 0, 1, 0, 0, 0, 1), Point3(4, 0, 0))
g_pose1 = Pose3(Rot3(-1, 0, 0, 0, 1, 0, 0, 0, -1), Point3(4, 6, 10))
g_pose2 = Pose3(Rot3(1, 0, 0, 0, 1, 0, 0, 0, -1), Point3(-4, 6, 10))
Output:
gRr = Rot3.Ry(math.radians(180))
s = 2
gtr = Point3(4, 6, 10)