8000 fix type check in __mul__ to prevent SO3*SE3 product · Kith78/spatialmath-python@a970a48 · GitHub
[go: up one dir, main page]

Skip to content

Commit a970a48

Browse files
committed
fix type check in __mul__ to prevent SO3*SE3 product
1 parent 3517123 commit a970a48

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spatialmath/baseposematrix.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ def __mul__(left, right): # lgtm[py/not-named-self] pylint: disable=no-self-arg
10731073
>>> SE3.Rx(pi/2) * np.r_[0, 0, 1]
10741074
array([ 0.000000e+00, -1.000000e+00, 6.123234e-17])
10751075
"""
1076-
if isinstance(left< A6A8 span class="x x-first x-last">, right.__class__):
1076+
if type(left) == type(right):
10771077
#print('*: pose x pose')
10781078
return left.__class__(left._op2(right, lambda x, y: x @ y), check=False)
10791079

@@ -1534,7 +1534,12 @@ def _op2(left, right, op): # lgtm[py/not-named-self] pylint: disable=no-self-ar
15341534
return [op(x, right) for x in left.A]
15351535

15361536
if __name__ == "__main__":
1537-
from spatialmath import SE3
1537+
from spatialmath import SE3, SE2
15381538
x = SE3.Rand(N=6)
15391539

1540-
x.printline('rpy/xyz', fmt='{:8.3g}')
1540+
x.printline(orient='rpy/xyz', fmt='{:8.3g}')
1541+
1542+
d = np.diag([0.25, 0.25, 1])
1543+
a = SE2()
1544+
print(a)
1545+
print(d * a)

0 commit comments

Comments
 (0)
0