@@ -970,6 +970,15 @@ def exp(self, theta=1, unit='rad'):
970
970
- ``X.exp(θ) as above but with a rotation of ``θ`` about the twist axis,
971
971
:math:`e^{\t heta[S]}`
972
972
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
+
973
982
Example:
974
983
975
984
.. runblock:: pycon
@@ -987,9 +996,15 @@ def exp(self, theta=1, unit='rad'):
987
996
988
997
:seealso: :func:`spatialmath.base.trexp`
989
998
"""
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' )
991
1007
992
- return base .trexp (self .S * theta )
993
1008
994
1009
995
1010
# ------------------------- arithmetic -------------------------------#
@@ -1484,7 +1499,7 @@ def exp(self, theta=None, unit='rad'):
1484
1499
else :
1485
1500
theta = base .getunit (theta , unit )
1486
1501
1487
- return base .trexp2 (self .S * theta )
1502
+ return SE2 ( base .trexp2 (self .S * theta ) )
1488
1503
1489
1504
1490
1505
def unit (self ):
0 commit comments