Skip to content

Commit 2c027ff

Browse files
committed
add se2
1 parent b7d35d0 commit 2c027ff

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

robot/transform.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@
1414
from numpy.linalg import norm
1515
import robot.Quaternion as Q
1616

17+
def se2(a, b=0, c=0, varargin="rad"):
18+
"""
19+
P 22
20+
which represents a translation of (a, b) and a rotation of c.
21+
"""
22+
if isinstance(a,(list,ndarray)) and len(a) == 3:
23+
x,y,th = a
24+
else:
25+
x,y,th = a,b,c
26+
27+
if varargin == "deg": th = deg2rad(th)
28+
cth = cos(th)
29+
sth = sin(th)
30+
R = mat([[cth,-sth],
31+
[sth,cth]])
32+
t = eye(3)
33+
t[:2,:2] = R
34+
t[:2,2] = [x, y]
35+
return t
36+
1737
def rotx(theta):
1838
"""
1939
Rotation about X-axis

0 commit comments

Comments
 (0)