Skip to content

Commit 1943623

Browse files
committed
Add Rot method for pure SE2 rotation
1 parent 21eb29f commit 1943623

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

spatialmath/pose2d.py

+27
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,33 @@ def Exp(cls, S, check=True): # pylint: disable=arguments-differ
400400
else:
401401
return cls(base.trexp2(S), check=False)
402402

403+
@classmethod
404+
def Rot(cls, theta, unit="rad"):
405+
"""
406+
Create an SE(2) rotation
407+
408+
:param theta: rotation angle in radians
409+
:type theta: float
410+
:param unit: angular units: "rad" [default] or "deg"
411+
:type unit: str
412+
:return: SE(2) matrix
413+
:rtype: SE2 instance
414+
415+
`SE2.Rot(theta)` is an SE(2) rotation of ``theta``
416+
417+
Example:
418+
419+
.. runblock:: pycon
420+
421+
>>> SE2.Rot(0.3)
422+
>>> SE2.Rot([0.2, 0.3])
423+
424+
425+
:seealso: :func:`~spatialmath.base.transforms3d.transl`
426+
:SymPy: supported
427+
"""
428+
return cls([base.trot2(_th, unit=unit) for _th in base.getvector(theta)], check=False)
429+
403430
@classmethod
404431
def Tx(cls, x):
405432
"""

0 commit comments

Comments
 (0)