@@ -970,6 +970,15 @@ def exp(self, theta=1, unit='rad'):
970970 - ``X.exp(θ) as above but with a rotation of ``θ`` about the twist axis,
971971 :math:`e^{\t heta[S]}`
972972
973+ If ``len(X)==1`` and ``len(θ)==N`` then the resulting SE3 object has
974+ ``N`` values equivalent to the twist :math:`e^{\t heta_i[S]}`.
975+
976+ If ``len(X)==N`` and ``len(θ)==1`` then the resulting SE3 object has
977+ ``N`` values equivalent to the twist :math:`e^{\t heta[S_i]}`.
978+
979+ If ``len(X)==N`` and ``len(θ)==N`` then the resulting SE3 object has
980+ ``N`` values equivalent to the twist :math:`e^{\t heta_i[S_i]}`.
981+
973982 Example:
974983
975984 .. runblock:: pycon
@@ -987,9 +996,15 @@ def exp(self, theta=1, unit='rad'):
987996
988997 :seealso: :func:`spatialmath.base.trexp`
989998 """
990- theta = base .getunit (theta , unit )
999+ theta = np .r_ [base .getunit (theta , unit )]
1000+
1001+ if len (self ) == 1 :
1002+ return SE3 ([base .trexp (self .S * t ) for t in theta ], check = False )
1003+ elif len (self ) == len (theta ):
1004+ return SE3 ([base .trexp (s * t ) for s , t in zip (self .S , theta )], check = False )
1005+ else :
1006+ raise ValueError ('length mismatch' )
9911007
992- return base .trexp (self .S * theta )
9931008
9941009
9951010 # ------------------------- arithmetic -------------------------------#
@@ -1484,7 +1499,7 @@ def exp(self, theta=None, unit='rad'):
14841499 else :
14851500 theta = base .getunit (theta , unit )
14861501
1487- return base .trexp2 (self .S * theta )
1502+ return SE2 ( base .trexp2 (self .S * theta ) )
14881503
14891504
14901505 def unit (self ):
0 commit comments