Fixed fall through error in binary operation#117
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #117 +/- ##
==========================================
+ Coverage 77.41% 77.76% +0.35%
==========================================
Files 24 24
Lines 5136 5137 +1
==========================================
+ Hits 3976 3995 +19
+ Misses 1160 1142 -18 ☔ View full report in Codecov by Sentry. |
jcao-bdai
left a comment
There was a problem hiding this comment.
LGTM. thanks for identifying the issue.
myeatman-bdai
left a comment
There was a problem hiding this comment.
Maybe take my suggested change?
|
|
||
| """ | ||
| if isinstance(right, left.__class__): | ||
| if right.__class__ is left.__class__: |
There was a problem hiding this comment.
I'm pretty sure isinstance is better?
There was a problem hiding this comment.
i made this change because, given the inheritance structure,
- SO3 is not an instance of SE3, but
- SE3 is an instance of SO3.
This PR seems to intend to disallow both se3.angdist(so3) and so3.angdist(se3).
Please feel free to make any change as necessary @bokorn-bdaii
There was a problem hiding this comment.
We could allow angdist between those too, but I am not sure if all binary operations will work here, translation based operations being computed between SO3 and SE3. That being said, it's currently only used by angdist. Depends if you want to allow cross type binary operations and put the validity checks up to future implementers.
There was a problem hiding this comment.
This is an option if we want to be able to look at angular distances between SO3 and SE3, or visa versa
| if right.__class__ is left.__class__: | |
| if isinstance(right, left.__class__) or isinstance(left, right.__class__): |
Fixes fall through error in the binary operator for BasePoseMatrix described in #116:
https://github.com/bdaiinstitute/spatialmath-python/blob/1b89c49395a21b5241e2f0a233e69394f3bc27b1/spatialmath/baseposematrix.py#L1632C7-L1632C7
If you want to compare the rotation of an SE3 to an SO3, it returns
Noneas opposed to throwing an error or returning a valid value.Modified
BasePoseMatrix._op2to throw an error if the types don't match.All tests still pass.