MarkSherstan / MPU-6050-9250-I2C-CompFilter

MPU6050/9250 I2C and SPI interface. Sensor fusion using a complementary filter yields sensor Euler angles and is implemented in five different languages.
GNU General Public License v3.0
94 stars 24 forks source link

madgwickFilter params #9

Closed Ongoza closed 4 years ago

Ongoza commented 4 years ago

Hi Mark!

You did a good job ;) but looks like something wrong with madgwickFilter in 9DOF/main.py mx = mpu.my and my = - mpu.mx Please add notes to your code - i thought it was mistake // Sensors x (y)-axis of the accelerometer is aligned with the y (x)-axis of the magnetometer;
// the magnetometer z-axis (+ down) is opposite to z-axis (+ up) of accelerometer and gyro!

You can also improve your code when read raw data:

  1. replace

    for ii in range(7): rawData.append(self.bus.read_byte_data(self.MPU9250_ADDRESS, self.EXT_SENS_DATA_00 + ii)) by "rawData = self.bus.read_i2c_block_data(self.MPU9250_ADDRESS, self.ACCEL_OUT, 14)"

  2. and add try/except block - sometime self.bus.read return error while try to read raw data
MarkSherstan commented 4 years ago

Thank you for the feedback! I tested and made the changes in commit 364fff7.