2 GTSAM Copyright 2010-2019, Georgia Tech Research Corporation, 3 Atlanta, Georgia 30332-0415 6 See LICENSE for the license information 17 from gtsam
import Point3, Pose3, Pose3Pairs, Rot3, Similarity3
22 """Test selected Sim3 methods.""" 25 """Test Align Pose3Pairs method. 29 same scale (no gauge ambiguity) 30 world frame has poses rotated about x-axis (90 degree roll) 31 world and egovehicle frame translated by 15 meters w.r.t. each other 33 Rx90 = Rot3.Rx(np.deg2rad(90))
38 eTo1 =
Pose3(
Rot3(), np.array([10, 0, 0]))
39 eTo2 =
Pose3(
Rot3(), np.array([15, 0, 0]))
41 eToi_list = [eTo0, eTo1, eTo2]
45 wTo0 =
Pose3(Rx90, np.array([-10, 0, 0]))
46 wTo1 =
Pose3(Rx90, np.array([-5, 0, 0]))
47 wTo2 =
Pose3(Rx90, np.array([0, 0, 0]))
49 wToi_list = [wTo0, wTo1, wTo2]
54 wSe = Similarity3.Align(we_pairs)
56 for wToi, eToi
in zip(wToi_list, eToi_list):
60 """Test if Align Pose3Pairs method can account for gauge ambiguity. 64 with gauge ambiguity (2x scale) 65 world frame has poses rotated about z-axis (90 degree yaw) 66 world and egovehicle frame translated by 11 meters w.r.t. each other 68 Rz90 = Rot3.Rz(np.deg2rad(90))
76 eToi_list = [eTo0, eTo1, eTo2]
80 wTo0 =
Pose3(Rz90, np.array([0, 12, 0]))
81 wTo1 =
Pose3(Rz90, np.array([0, 14, 0]))
82 wTo2 =
Pose3(Rz90, np.array([0, 18, 0]))
84 wToi_list = [wTo0, wTo1, wTo2]
89 wSe = Similarity3.Align(we_pairs)
91 for wToi, eToi
in zip(wToi_list, eToi_list):
95 """Test if Align Pose3Pairs method can account for gauge ambiguity. 97 Make sure a big and small square can be aligned. 98 The u's represent a big square (10x10), and v's represents a small square (4x4). 102 with gauge ambiguity (2.5x scale) 105 R0 = Rot3.Rz(np.deg2rad(0))
106 R90 = Rot3.Rz(np.deg2rad(90))
107 R180 = Rot3.Rz(np.deg2rad(180))
108 R270 = Rot3.Rz(np.deg2rad(270))
110 aTi0 =
Pose3(R0, np.array([2, 3, 0]))
111 aTi1 =
Pose3(R90, np.array([12, 3, 0]))
112 aTi2 =
Pose3(R180, np.array([12, 13, 0]))
113 aTi3 =
Pose3(R270, np.array([2, 13, 0]))
115 aTi_list = [aTi0, aTi1, aTi2, aTi3]
117 bTi0 =
Pose3(R0, np.array([4, 3, 0]))
118 bTi1 =
Pose3(R90, np.array([8, 3, 0]))
119 bTi2 =
Pose3(R180, np.array([8, 7, 0]))
120 bTi3 =
Pose3(R270, np.array([4, 7, 0]))
122 bTi_list = [bTi0, bTi1, bTi2, bTi3]
127 aSb = Similarity3.Align(ab_pairs)
129 for aTi, bTi
in zip(aTi_list, bTi_list):
133 if __name__ ==
"__main__":
def gtsamAssertEquals(self, actual, expected, tol=1e-9)
def test_align_poses_along_straight_line_gauge(self)
std::vector< std::pair< Pose3, Pose3 > > Pose3Pairs
def test_align_poses_along_straight_line(self)
def test_align_poses_scaled_squares(self)