Beispiel #1
0
 def test_stereo_closest_extrapolation(self):
     time = 0.175
     imu = Imu(self.sequence, [time, 0, 0, -1, 0, 0, 0])
     stereo = imu.stereo('rolling', extrapolation='closest')
     delta = abs(stereo.stamp - time)
     for image in self.sequence.cameras('rolling'):
         if abs(image.stamp - time) < delta:
             self.fail("Found an image %s, which is closer to %s than %s" % (image, imu, stereo))
Beispiel #2
0
 def test_stereo_next_extrapolation(self):
     time = 0.16
     imu = Imu(self.sequence, [time, 0, 0, -1, 0, 0, 0])
     stereo = imu.stereo('rolling', extrapolation='next')
     for image in self.sequence.cameras('rolling'):
         if image.stamp < time: continue
         self.assertEqual(image.ID, stereo.ID)
         return
     self.fail("Unknown reason")
Beispiel #3
0
    def test_stereo_prev_extrapolation(self):
        time = 0.19
        imu = Imu(self.sequence, [time, 0, 0, -1, 0, 0, 0])
        stereo = imu.stereo('rolling', extrapolation='prev')
        previous = None
        images = list(self.sequence.cameras('rolling'))
        for image in reversed(images):
            if image.stamp > time: continue
            previous = image
            break

        if previous is None: self.fail("No previous image to %s found" % imu)
        self.assertEqual(previous.ID, stereo.ID)
Beispiel #4
0
    def test_imuvalue_created_correctly(self):
        imu = Imu(self.sequence, [0, 0, 0, -1, 0, 0, 0])
        self.assertIsInstance(imu.acceleration, np.ndarray)
        self.assertIsInstance(imu.angular_velocity, np.ndarray)

        self.assertTrue(np.allclose(imu.acceleration, np.array((0,0,-1))))
        self.assertTrue(np.allclose(imu.angular_velocity, np.array((0,0,0))))
Beispiel #5
0
    def test_imu_extrapolation_skips_frame_drop_sync(self):
        frame1 = self.sequence.cameras('rolling')[1]
        imu = Imu.extrapolate(frame1)

        expected = self.sequence.cameras('rolling')[4]
        actual = imu.stereo('rolling', extrapolation='next')

        self.assertEqual(expected.stamp, actual.stamp)
        self.assertEqual(expected.ID, actual.ID)
Beispiel #6
0
    def test_imu_extrapolation_skips_frame_drop_unsync(self):
        self.sequence.stereosync = False

        frame2 = self.sequence.cameras('global')[2]
        imu = Imu.extrapolate(frame2)
        expected = self.sequence.cameras('global')[3]
        actual = imu.stereo('global', extrapolation='next')

        self.assertEqual(expected.stamp, actual.stamp)
        self.assertEqual(expected.ID, actual.ID)
        self.assertIsNone(actual.L)
Beispiel #7
0
 def test_stereo_prev_extrapolation_returns_none_if_no_earier_frames_exist(self):
     time = 0
     imu = Imu(self.sequence, [time, 0, 0, -1, 0, 0, 0])
     stereo = imu.stereo('rolling', extrapolation='prev')
     self.assertIsNone(stereo)
Beispiel #8
0
 def test_stereo_next_extrapolation_returns_none_if_no_more_frames_exist(self):
     time = 200
     imu = Imu(self.sequence, [time, 0, 0, -1, 0, 0, 0])
     stereo = imu.stereo('rolling', extrapolation='next')
     self.assertIsNone(stereo)
Beispiel #9
0
 def test_imu_next_extrapolation(self):
     time = 0.01
     imu = Imu(self.sequence, [time, 0, 0, -1, 0, 0, 0])
     expected = Imu(self.sequence, self.sequence.raw.imu[1,:])
     actual = Imu.extrapolate(imu, 'next')
     self.assertEqual(expected.stamp, actual.stamp)
Beispiel #10
0
 def test_dt_is_correct(self):
     imu1 = Imu(self.sequence, self.sequence.raw.imu[0, :])
     imu2 = Imu(self.sequence, self.sequence.raw.imu[1, :])
     self.assertEqual(imu2.dt(), imu2.stamp - imu1.stamp)