def test_import_xsens(self): # Get data, with a specified input from an XSens system in_file = os.path.join(myPath, 'data', 'data_xsens.txt') sensor = XSens(in_file=in_file, q_type=None) rate = sensor.rate acc = sensor.acc omega = sensor.omega self.assertEqual(rate, 50.) self.assertAlmostEqual((omega[0, 2] - 0.050860000000000002), 0)
def test_import_manual(self): # Get data, with a specified input from an XSens system in_file = os.path.join(myPath, 'data', 'data_xsens.txt') sensor = XSens(in_file=in_file, q_type=None) transfer_data = { 'rate': sensor.rate, 'acc': sensor.acc, 'omega': sensor.omega, 'mag': sensor.mag } my_sensor = MyOwnSensor(in_file='My own 123 sensor.', in_data=transfer_data) self.assertEqual(my_sensor.rate, 50.) self.assertAlmostEqual((my_sensor.omega[0, 2] - 0.050860000000000002), 0)
analytical(omega = omega, accMeasured=acc) ''' from sensors.xsens import XSens in_file = r'tests/data/data_xsens.txt' initial_orientation = np.array([[1, 0, 0], [0, 0, -1], [0, 1, 0]]) #in_file = r'tests/data/data_xsens2.txt' #initial_orientation = np.array([[0,0,-1], #[1, 0, 0], #[0,-1,0]]) initial_position = np.r_[0, 0, 0] sensor = XSens(in_file=in_file, R_init=initial_orientation, pos_init=initial_position) # By default, the orientation quaternion gets automatically calculated, using "analytical" q_analytical = sensor.quat def show_result(imu_data): "Dummy function, to simplify the visualization" fig, axs = plt.subplots(3, 1) axs[0].plot(imu_data.omega) axs[0].set_ylabel('Omega') axs[0].set_title(imu_data.q_type) axs[1].plot(imu_data.acc) axs[1].set_ylabel('Acc') axs[2].plot(imu_data.quat[:, 1:])
dt = 1./rate num_rep = duration*rate omegas = np.tile(omega, [num_rep, 1]) q = quat.calc_quat(omegas, q0, rate, 'sf') #orientation(q) in_file = r'.\tests\data\data_xsens.txt' from skinematics.sensors.xsens import XSens data = XSens(in_file) out_file = 'demo_patch.mp4' title_text = 'Rotation Demo' orientation(data.quat, out_file=None, title_text='Well done!') # Test pygame-viewer phi = np.arange(360) q = quat.deg2quat(np.column_stack((phi, np.zeros((len(phi), 2))))) viewer = Orientation_Viewer_pygame(quat_in=q) viewer.run() ''' # Test OpenGL viewer: in_file = r'.\tests\data\data_xsens.txt' from sensors.xsens import XSens data = XSens(in_file) orientation(data.quat, deltaT=5) viewer = Orientation_OGL(quat_in=data.quat) viewer.run(looping=False, rate=100)
def test_IMU_xsens(self): # Get data, with a specified input from an XSens system in_file = os.path.join(myPath, 'data', 'data_xsens.txt') my_IMU = XSens(in_file=in_file) self.assertEqual(my_IMU.omega.size, 2859)
''' from sensors.xsens import XSens in_file = r'tests/data/data_xsens.txt' initial_orientation = np.array([ [1,0,0], [0,0,-1], [0,1,0]]) #in_file = r'tests/data/data_xsens2.txt' #initial_orientation = np.array([[0,0,-1], #[1, 0, 0], #[0,-1,0]]) initial_position = np.r_[0,0,0] sensor = XSens(in_file=in_file, R_init=initial_orientation, pos_init=initial_position) # By default, the orientation quaternion gets automatically calculated, using "analytical" q_analytical = sensor.quat def show_result(imu_data): "Dummy function, to simplify the visualization" fig, axs = plt.subplots(3,1) axs[0].plot(imu_data.omega) axs[0].set_ylabel('Omega') axs[0].set_title(imu_data.q_type) axs[1].plot(imu_data.acc) axs[1].set_ylabel('Acc') axs[2].plot(imu_data.quat[:,1:])
''' from sensors.xsens import XSens in_file = r'tests/data/data_xsens.txt' initial_orientation = np.array([ [1,0,0], [0,0,-1], [0,1,0]]) #in_file = r'tests/data/data_xsens2.txt' #initial_orientation = np.array([[0,0,-1], #[1, 0, 0], #[0,-1,0]]) initial_position = np.r_[0,0,0] sensor = XSens(in_file=in_file, R_init=initial_orientation, pos_init=initial_position) # By default, the orientation quaternion gets automatically calculated, using "analytical" q_analytical = sensor.quat def show_result(imu_data): fig, axs = plt.subplots(3,1) axs[0].plot(imu_data.omega) axs[0].set_ylabel('Omega') axs[0].set_title(imu_data.q_type) axs[1].plot(imu_data.acc) axs[1].set_ylabel('Acc') axs[2].plot(imu_data.quat[:,1:]) axs[2].set_ylabel('Quat') plt.show()