diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp b/libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp index 51a0d505ca..4192859864 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor_LSM9DS0.cpp @@ -739,6 +739,8 @@ void AP_InertialSensor_LSM9DS0::_read_data_transaction_a() _accel_raw_data(&raw_data); Vector3f accel_data(raw_data.x, -raw_data.y, -raw_data.z); + accel_data *= _accel_scale; + _rotate_and_correct_accel(_accel_instance, accel_data); _accel_filtered = _accel_filter.apply(accel_data); _accel_sample_available = true; } @@ -752,23 +754,19 @@ void AP_InertialSensor_LSM9DS0::_read_data_transaction_g() _gyro_raw_data(&raw_data); Vector3f gyro_data(raw_data.x, -raw_data.y, -raw_data.z); + gyro_data *= _gyro_scale; + _rotate_and_correct_gyro(_gyro_instance, gyro_data); _gyro_filtered = _gyro_filter.apply(gyro_data); _gyro_sample_available = true; } bool AP_InertialSensor_LSM9DS0::update() { - Vector3f gyro = _gyro_filtered; - Vector3f accel = _accel_filtered; - _accel_sample_available = false; _gyro_sample_available = false; - accel *= _accel_scale; - gyro *= _gyro_scale; - - _publish_gyro(_gyro_instance, gyro); - _publish_accel(_accel_instance, accel); + _publish_gyro(_gyro_instance, _gyro_filtered, false); + _publish_accel(_accel_instance, _accel_filtered, false); if (_last_accel_filter_hz != _accel_filter_cutoff()) { _set_accel_filter(_accel_filter_cutoff());