Last active
August 14, 2018 11:48
-
-
Save bofh/c4898c3e3634848c4d38d66988e4a07e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dps = 250.0 # Based on chip settings | |
d2r = 3.14159265359 / 180.0 | |
gyro_scale = dps / 32767.5 * d2r | |
gyro_x = np.array(gyro_x) * gyro_scale | |
gyro_y = np.array(gyro_y) * gyro_scale | |
gyro_z = np.array(gyro_z) * gyro_scale | |
ar = 2.0 # Based on chip settings | |
acc_scale = 9.807 * ar / 32767.5 | |
acc_x = np.array(acc_x) * acc_scale | |
acc_y = np.array(acc_y) * acc_scale | |
acc_z = np.array(acc_z) * acc_scale | |
mag_factory_x = 177 | |
mag_factory_y = 179 | |
mag_factory_z = 167 | |
mag_scale_x = ((float(mag_factory_x) - 128.0) / 256.0 + 1.0) * 4912.0 / 32760.0 | |
mag_scale_y = ((float(mag_factory_y) - 128.0) / 256.0 + 1.0) * 4912.0 / 32760.0 | |
mag_scale_z = ((float(mag_factory_z) - 128.0) / 256.0 + 1.0) * 4912.0 / 32760.0 | |
mag_x = np.array(mag_x) * mag_scale_x | |
mag_y = np.array(mag_y) * mag_scale_y | |
mag_z = np.array(mag_z) * mag_scale_z |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment