def testRefPointChangeNoMovement(self): """ Test for reference point moving, but "limb com" stationary with respect to ref point. """ coms = [[0, -1], [1, -1], [2, -1], [3, -1]] ref_point_data = [[0, 0], [1, 0], [2, 0], [3, 0]] ts = 0.2 ang_vels = moi_analysis.calc_ang_vel(coms, ts, ref_point_data) test_data = [0., 0., 0., 0.] for av, td in zip(ang_vels, test_data): self.assertAlmostEqual(av, td, places=6, msg=None, delta=None)
def testRefPointRotation(self): """ Make reference point move but leave the "limb com" stationary. """ coms = [[0, -1], [0, -1], [0, -1], [0, -1]] ref_point_data = [[0, 0], [1, 0], [2, 0], [3, 0]] ts = 0.2 ang_vels = moi_analysis.calc_ang_vel(coms, ts, ref_point_data) test_data = [ 0, -math.pi / 4. / ts, -math.radians(18.434) / ts, -math.radians(8.131) / ts ] for av, td in zip(ang_vels, test_data): self.assertAlmostEqual(av, td, places=2, msg=None, delta=None)
def testBackwardNoRefMovement(self): """ Test backward velocity without the reference point moving. Testing starting from 270 deg to 180 deg over four steps. 30 deg increments. """ coms = [[0, -1], [-0.5, -math.sqrt(3.) / 2.], [-math.sqrt(3.) / 2., -0.5], [-1, 0]] ref_point_data = [[0, 0], [0, 0], [0, 0], [0, 0]] ts = 0.2 ang_vels = moi_analysis.calc_ang_vel(coms, ts, ref_point_data) test_data = [ 0, -math.pi / 6. / ts, -math.pi / 6. / ts, -math.pi / 6. / ts ] for av, td in zip(ang_vels, test_data): self.assertAlmostEqual(av, td, places=6, msg=None, delta=None)