bdaiinstitute/spatialmath-python

Consistency issues when multiplying SE3/2 by SO3/2

Closed this issue · 1 comments

btalb commented

I initially tried multiplying an SE3 by an SO3 when trying to apply an arbitrary rotation to an SE3 pose. This currently returns an identity SE3:

In [1]: from spatialmath import *

In [2]: a = SE3(1, 2, 3)

In [3]: a
Out[3]: 
   1         0         0         1         
   0         1         0         2         
   0         0         1         3         
   0         0         0         1         


In [4]: b = SO3.Rz(45, unit='deg')

In [5]: b
Out[5]: 
   0.7071   -0.7071    0         
   0.7071    0.7071    0         
   0         0         1         


In [6]: a * b
Out[6]: 
   1         0         0         0         
   0         1         0         0         
   0         0         1         0         
   0         0         0         1 

The behaviour seems incorrect, but I'm not sure what the correct resolution should be:

  • Throw an error if SE3 * SO3 is a pattern that shouldn't be used, or
  • Return the same result as the equivalent SE3 * SE3 operation

Same behaviour is also currently present with SE2s and SO2s.

Fixed this, bad type checking, I forgot instance() matches to a superclass. So now

>>> SO3() * SE3()                                                                                                                                      
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
.../robotics-toolbox-python/roboticstoolbox/bin/rtbtool in <module>
----> 1 SO3()*SE3()

TypeError: unsupported operand type(s) for *: 'SO3' and 'SE3'