Exemple #1
0
 def test_max_diff(self):
     stamps_1 = helpers.fake_timestamps(10, 0.1, start_time=0.01)
     stamps_2 = helpers.fake_timestamps(500, 2e-3)
     # default max_diff: 0.01
     matches = sync.matching_time_indices(stamps_1, stamps_2)
     self.assertEqual(len(matches), 10)
     matches = sync.matching_time_indices(stamps_2, stamps_1, max_diff=1e-3)
     self.assertEqual(len(matches), 10)
Exemple #2
0
    def test_alignment_degenerate_case(self):
        length = 100
        poses = [lie.random_se3()] * length
        traj_1 = PoseTrajectory3D(poses_se3=poses,
                                  timestamps=helpers.fake_timestamps(
                                      length, 1, 0.0))
        traj_2 = copy.deepcopy(traj_1)
        traj_2.transform(lie.random_se3())
        traj_2.scale(1.234)
        self.assertNotEqual(traj_1, traj_2)

        with self.assertRaises(GeometryException):
            traj_1.align(traj_2)

        with self.assertRaises(GeometryException):
            traj_1.align(traj_2, correct_scale=True)
Exemple #3
0
 def test_no_matches_due_to_offset(self):
     stamps_1 = helpers.fake_timestamps(10, 0.1, start_time=0.)
     stamps_2 = helpers.fake_timestamps(10, 0.1, start_time=2.)
     matches = sync.matching_time_indices(stamps_1, stamps_2)
     self.assertEqual(len(matches[0]), 0)
     self.assertEqual(len(matches[1]), 0)
Exemple #4
0
 def test_correct_negative_offset(self):
     stamps_1 = helpers.fake_timestamps(10, 0.1, start_time=0.)
     stamps_2 = helpers.fake_timestamps(10, 0.1, start_time=-0.5)
     matches = sync.matching_time_indices(stamps_1, stamps_2, offset_2=0.5)
     self.assertEqual(len(matches[0]), 10)
     self.assertEqual(len(matches[1]), 10)