Skip to content

Commit 67e5da8

Browse files
committed
support API changes
.exp() returns NumPy array Revolute/Prismatic are now UnitRevolute/UnitPrismatic
1 parent bc9339d commit 67e5da8

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

tests/test_twist.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ def test_list_constuctor(self):
102102
self.assertEqual(len(a), 4)
103103

104104
def test_predicate(self):
105-
x = Twist3.Revolute([1, 2, 3], [0, 0, 0])
105+
x = Twist3.UnitRevolute([1, 2, 3], [0, 0, 0])
106106
self.assertFalse(x.isprismatic)
107107

108108
# check prismatic twist
109-
x = Twist3.Prismatic([1, 2, 3])
109+
x = Twist3.UnitPrismatic([1, 2, 3])
110110
self.assertTrue(x.isprismatic)
111111

112112
self.assertTrue(Twist3.isvalid(x.se3()))
@@ -131,11 +131,11 @@ def test_str(self):
131131
def test_variant_constructors(self):
132132

133133
# check rotational twist
134-
x = Twist3.Revolute([1, 2, 3], [0, 0, 0])
134+
x = Twist3.UnitRevolute([1, 2, 3], [0, 0, 0])
135135
array_compare(x, np.r_[0, 0, 0, unitvec([1, 2, 3])])
136136

137137
# check prismatic twist
138-
x = Twist3.Prismatic([1, 2, 3])
138+
x = Twist3.UnitPrismatic([1, 2, 3])
139139
array_compare(x, np.r_[unitvec([1, 2, 3]), 0, 0, 0, ])
140140

141141
def test_SE3_twists(self):
@@ -158,13 +158,13 @@ def test_SE3_twists(self):
158158
array_compare(tw, np.r_[-pi / 2, 2, pi, 0, pi / 2, 0])
159159

160160
def test_exp(self):
161-
tw = Twist3.Revolute([1, 0, 0], [0, 0, 0])
161+
tw = Twist3.UnitRevolute([1, 0, 0], [0, 0, 0])
162162
array_compare(tw.exp(pi/2), SE3.Rx(pi/2))
163163

164-
tw = Twist3.Revolute([0, 1, 0], [0, 0, 0])
164+
tw = Twist3.UnitRevolute([0, 1, 0], [0, 0, 0])
165165
array_compare(tw.exp(pi/2), SE3.Ry(pi/2))
166166

167-
tw = Twist3.Revolute([0, 0, 1], [0, 0, 0])
167+
tw = Twist3.UnitRevolute([0, 0, 1], [0, 0, 0])
168168
array_compare(tw.exp(pi/2), SE3.Rz(pi / 2))
169169

170170
def test_arith(self):
@@ -239,11 +239,11 @@ def test_list(self):
239239
def test_variant_constructors(self):
240240

241241
# check rotational twist
242-
x = Twist2.Revolute([1, 2])
242+
x = Twist2.UnitRevolute([1, 2])
243243
array_compare(x, np.r_[2, -1, 1])
244244

245245
# check prismatic twist
246-
x = Twist2.Prismatic([1, 2])
246+
x = Twist2.UnitPrismatic([1, 2])
247247
array_compare(x, np.r_[unitvec([1, 2]), 0])
248248

249249
def test_conversion_SE2(self):
@@ -282,11 +282,11 @@ def test_list_constuctor(self):
282282
self.assertEqual(len(a), 4)
283283

284284
def test_predicate(self):
285-
x = Twist2.Revolute([1, 2])
285+
x = Twist2.UnitRevolute([1, 2])
286286
self.assertFalse(x.isprismatic)
287287

288288
# check prismatic twist
289-
x = Twist2.Prismatic([1, 2])
289+
x = Twist2.UnitPrismatic([1, 2])
290290
self.assertTrue(x.isprismatic)
291291

292292
self.assertTrue(Twist2.isvalid(x.se2()))
@@ -324,13 +324,13 @@ def test_SE2_twists(self):
324324
array_compare(tw, np.r_[ 3 * pi / 4, pi / 4, pi / 2])
325325

326326
def test_exp(self):
327-
x = Twist2.Revolute([0, 0])
327+
x = Twist2.UnitRevolute([0, 0])
328328
array_compare(x.exp(pi/2), SE2(0, 0, pi/2))
329329

330-
x = Twist2.Revolute([1, 0])
330+
x = Twist2.UnitRevolute([1, 0])
331331
array_compare(x.exp(pi/2), SE2(1, -1, pi/2))
332332

333-
x = Twist2.Revolute([1, 2])
333+
x = Twist2.UnitRevolute([1, 2])
334334
array_compare(x.exp(pi/2), SE2(3, 1, pi/2))
335335

336336

@@ -344,8 +344,11 @@ def test_arith(self):
344344
x1 = Twist2(T1)
345345
x2 = Twist2(T2)
346346

347-
array_compare( (x1 * x2).exp(), T1 * T2)
348-
array_compare( (x2 * x1).exp(), T2 * T1)
347+
array_compare( (x1 * x2).exp(), (T1 * T2).A)
348+
array_compare( (x2 * x1).exp(), (T2 * T1).A)
349+
350+
array_compare( (x1 * x2).SE2(), (T1 * T2).A)
351+
array_compare( (x2 * x1).SE2(), (T2 * T1))
349352

350353
def test_prod(self):
351354
# check prod

0 commit comments

Comments
 (0)