2 GTSAM Copyright 2010-2019, Georgia Tech Research Corporation, 3 Atlanta, Georgia 30332-0415 6 See LICENSE for the license information 9 Author: Frank Dellaert, Duy Nguyen Ta 18 from gtsam
import Point3, Pose3, Rot3
23 """Test selected Pose3 methods.""" 26 """Test between method.""" 27 T2 =
Pose3(Rot3.Rodrigues(0.3, 0.2, 0.1),
Point3(3.5, -8.2, 4.2))
28 T3 =
Pose3(Rot3.Rodrigues(-90, 0, 0),
Point3(1, 2, 3))
29 expected = T2.inverse().
compose(T3)
30 actual = T2.between(T3)
34 """Test transformTo method.""" 35 transform =
Pose3(Rot3.Rodrigues(0, 0, -1.570796),
Point3(2, 4, 0))
36 actual = transform.transformTo(
Point3(3, 2, 10))
37 expected =
Point3(2, 1, 10)
41 """Test range method.""" 46 xl1 =
Pose3(Rot3.Ypr(0.0, 0.0, 0.0),
Point3(1, 0, 0))
47 xl2 =
Pose3(Rot3.Ypr(0.0, 1.0, 0.0),
Point3(1, 1, 0))
50 self.assertEqual(1, x1.range(point=l1))
53 self.assertEqual(math.sqrt(2.0), x1.range(point=l2))
56 self.assertEqual(1, x1.range(pose=xl1))
59 self.assertEqual(math.sqrt(2.0), x1.range(pose=xl2))
62 """Test adjoint method.""" 63 xi = np.array([1, 2, 3, 4, 5, 6])
64 expected = np.dot(Pose3.adjointMap_(xi), xi)
65 actual = Pose3.adjoint_(xi, xi)
66 np.testing.assert_array_equal(actual, expected)
69 """Test if serialization is working normally""" 70 expected =
Pose3(Rot3.Ypr(0.0, 1.0, 0.0),
Point3(1, 1, 0))
72 serialized = expected.serialize()
73 actual.deserialize(serialized)
77 if __name__ ==
"__main__":
def gtsamAssertEquals(self, actual, expected, tol=1e-9)
def test_serialization(self)
def test_transform_to(self)
T compose(const T &t1, const T &t2)