@@ -1483,8 +1483,8 @@ def pole(self):
14831483 .. runblock:: pycon
14841484
14851485 >>> from spatialmath import SE3, Twist3
1486- >>> T = SE3 (1, 2, 3) * SE3.Rx( 0.3)
1487- >>> S = Twist3 (T)
1486+ >>> T = SE2 (1, 2, 0.3)
1487+ >>> S = Twist2 (T)
14881488 >>> S.pole()
14891489 """
14901490 p = np .cross (np .r_ [0 , 0 , self .w ], np .r_ [self .v , 0 ]) / self .theta ()
@@ -1495,8 +1495,17 @@ def unit(self):
14951495 """
14961496 Unit twist
14971497
1498- - ``S.unit()`` is a Twist3 object representing a unit twist aligned with the
1499- Twist ``S``.
1498+ - ``S.unit()`` is a Twist2 object representing a unit twist aligned with the
1499+ Twist ``S``.
1500+
1501+ Example:
1502+
1503+ .. runblock:: pycon
1504+
1505+ >>> from spatialmath import SE3, Twist3
1506+ >>> T = SE2(1, 2, 0.3)
1507+ >>> S = Twist2(T)
1508+ >>> S.unit()
15001509 """
15011510 if base .iszerovec (self .w ):
15021511 # rotational twist
@@ -1508,14 +1517,77 @@ def unit(self):
15081517 @property
15091518 def ad (self ):
15101519 """
1511- Twist3 .ad Logarithm of adjoint
1520+ Twist2 .ad Logarithm of adjoint
15121521
15131522 - ``S.ad()`` is the logarithm of the adjoint matrix of the corresponding
1514- homogeneous transformation.
1523+ homogeneous transformation.
1524+
1525+ Example:
1526+
1527+ .. runblock:: pycon
1528+
1529+ >>> from spatialmath import SE3, Twist3
1530+ >>> T = SE2(1, 2, 0.3)
1531+ >>> S = Twist2(T)
1532+ >>> S.unit()
15151533
15161534 :seealso: SE3.Ad.
15171535 """
1518- return np .array ([base .skew (self .w ), base .skew (self .v ), [np .zeros ((3 , 3 )), base .skew (self .w )]])
1536+ return np .array ([
1537+ [base .skew (self .w ), base .skew (self .v )],
1538+ [np .zeros ((3 , 3 )), base .skew (self .w )]
1539+ ])
1540+
1541+ @classmethod
1542+ def Tx (cls , x ):
1543+ """
1544+ Create a new 2D twist for pure translation along the X-axis
1545+
1546+ :param x: translation distance along the X-axis
1547+ :type x: float
1548+ :return: 2D twist vector
1549+ :rtype: Twist2 instance
1550+
1551+ `Twist2.Tx(x)` is an se(2) translation of ``x`` along the x-axis
1552+
1553+ Example:
1554+
1555+ .. runblock:: pycon
1556+
1557+ >>> Twist2.Tx(2)
1558+ >>> Twist2.Tx([2,3])
1559+
1560+
1561+ :seealso: :func:`~spatialmath.base.transforms2d.transl2`
1562+ :SymPy: supported
1563+ """
1564+ return cls ([np .r_ [_x ,0 ,0 ] for _x in base .getvector (x )], check = False )
1565+
1566+
1567+ @classmethod
1568+ def Ty (cls , y ):
1569+ """
1570+ Create a new 2D twist for pure translation along the Y-axis
1571+
1572+ :param y: translation distance along the Y-axis
1573+ :type y: float
1574+ :return: 2D twist vector
1575+ :rtype: Twist2 instance
1576+
1577+ `Twist2.Ty(y) is an se(2) translation of ``y`` along the y-axis
1578+
1579+ Example:
1580+
1581+ .. runblock:: pycon
1582+
1583+ >>> Twist2.Ty(2)
1584+ >>> Twist2.Ty([2, 3])
1585+
1586+
1587+ :seealso: :func:`~spatialmath.base.transforms2d.transl2`
1588+ :SymPy: supported
1589+ """
1590+ return cls ([np .r_ [0 ,_y ,0 ] for _y in base .getvector (y )], check = False )
15191591
15201592 def __mul__ (left , right ): # lgtm[py/not-named-self] pylint: disable=no-self-argument
15211593 """
0 commit comments