Skip to content
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

Merged
merged 5 commits into from
Jun 9, 2023

Conversation

DanMcGann
Copy link
Contributor

Motivation

Pose3 component extraction functions (rotation and translation) 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's translation and rotation 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 to none. Existing code should be agnostic to these changes.

Adds jacobians to translation() and rotation() for Pose2 to bring it
into spec with Pose3's equilivent functions. Also adds tests.
@@ -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(); }
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah make them inline :)

Copy link
Member

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?

Copy link
Contributor Author

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!

Copy link
Member

@dellaert dellaert left a 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.

@@ -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(); }
Copy link
Member

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?

@dellaert
Copy link
Member

Merge in develop to re-run windows CI?

@varunagrawal varunagrawal merged commit 107f541 into borglab:develop Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants