-
Notifications
You must be signed in to change notification settings - Fork 778
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
Add Pose2 Component Jacobians #1504
Add Pose2 Component Jacobians #1504
Conversation
Adds jacobians to translation() and rotation() for Pose2 to bring it into spec with Pose3's equilivent functions. Also adds tests.
gtsam/geometry/Pose2.h
Outdated
@@ -252,16 +252,16 @@ class Pose2: public LieGroup<Pose2, 3> { | |||
inline double theta() const { return r_.theta(); } | |||
|
|||
/// translation | |||
inline const Point2& t() const { return t_; } | |||
inline const Point2& t() const { return translation(); } |
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.
translation() should also be inline otherwise this makes no sense?
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.
Agreed, at the moment t()
and r()
are effectively macros to translation
and rotation
respectively. Regarding the design decision I can see an argument on each side of making these inline. I am happy to update to the preference of the maintainers!
The parallel Pose3 functions are note inline if that provides signal to the decision process.
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.
yeah make them inline :)
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.
Seems that this orthogonal to the aim of this PR. What's the problem with leaving these methods as is?
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.
No problem, just my own over-dedication to the one source of truth principle. Reverted!
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.
Very cool. If we can revert those "macro" methods (if you agree) then I'll merge. Happy to discuss more.
gtsam/geometry/Pose2.h
Outdated
@@ -252,16 +252,16 @@ class Pose2: public LieGroup<Pose2, 3> { | |||
inline double theta() const { return r_.theta(); } | |||
|
|||
/// translation | |||
inline const Point2& t() const { return t_; } | |||
inline const Point2& t() const { return translation(); } |
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.
Seems that this orthogonal to the aim of this PR. What's the problem with leaving these methods as is?
Merge in develop to re-run windows CI? |
Motivation
Pose3 component extraction functions (
rotation
andtranslation
) optionally allow for jacobians. However, Pose2 does not parallel this interface. This can cause issues when defining code templated to handle either dimension of pose.Implementation
This PR updates the Pose2 interface to parallel the Pose3 interface by adding
OptionalJacobians
to Pose2'stranslation
androtation
functions.The derivation of these Jacobians directly parallels that for Pose3, although we do have to account for the difference in tangent space parameter order between Pose2 and Pose3.
Jacobians are verified with comparison to numerical Jacobian in added tests.
The python interface is also extended to support these changes.
Effects
While these are interface level changes, they should not cause any backwards compatibility issues, as they are implemented with
OptionalJacobians
that default tonone
. Existing code should be agnostic to these changes.