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

Adds Pose equivalency functions #130

Merged
merged 11 commits into from
Jul 25, 2023
Merged

Adds Pose equivalency functions #130

merged 11 commits into from
Jul 25, 2023

Conversation

JoshuaFutcher
Copy link
Contributor

Fixes #127 - Weird issue with rel_tol=1e-09 being Pose instead of float?

Copy link
Owner

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

Looks good! Have another batch of comments.

Also, once this in place, you could consider going through some of the code/unit tests that are checking pose equality the old way and making the updates. Not necessary, though, only if you want to!

pyrobosim/pyrobosim/utils/pose.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Outdated Show resolved Hide resolved
pyrobosim/pyrobosim/utils/pose.py Outdated Show resolved Hide resolved
JoshuaFutcher and others added 4 commits July 25, 2023 18:45
Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
@sea-bass sea-bass changed the title Adds equivalency function Adds Pose equivalency functions Jul 25, 2023
@sea-bass sea-bass merged commit ec3d81e into sea-bass:main Jul 25, 2023
6 checks passed
Copy link
Owner

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

@JoshuaFutcher I found 2 bugs and fixed them on main.

This would have been caught if we'd had #97 implemented -- sorry!

Just sharing them here for your reference.

@@ -199,6 +208,44 @@ def __repr__(self):
)
return f"Pose: [{pos_str}, {quat_str}]"

def is_approx(self, other, rel_tol=1e-09, abs_tol=0.0):
Copy link
Owner

Choose a reason for hiding this comment

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

If the default abs_tol=0, then is_approx() will always return False for non-identical poses with default values. I changed these both to default to 1e-6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, I misunderstood how the abs_tol works then : ) thanks

raise TypeError("Expected a Pose")

return np.allclose(
self.get_translation, other.get_translation, rel_tol, abs_tol
Copy link
Owner

Choose a reason for hiding this comment

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

we're supposed to actually call the function

Suggested change
self.get_translation, other.get_translation, rel_tol, abs_tol
self.get_translation(), other.get_translation(), rel_tol, abs_tol

if not (isinstance(other, Pose)):
raise TypeError("Expected a Pose")

return np.all(self.get_translation == other.get_translation) and np.all(
Copy link
Owner

Choose a reason for hiding this comment

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

and same here

Suggested change
return np.all(self.get_translation == other.get_translation) and np.all(
return np.all(self.get_translation() == other.get_translation()) and np.all(

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.

Implement equality checkers for Pose class
3 participants