mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-05 06:01:36 +08:00
df_mpu9250_wrapper: reset calibration if no params
This commit is contained in:
@@ -289,7 +289,17 @@ void DfMpu9250Wrapper::_update_gyro_calibration()
|
|||||||
if (res != OK) {
|
if (res != OK) {
|
||||||
PX4_ERR("Could not access param %s", str);
|
PX4_ERR("Could not access param %s", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We got calibration values, let's exit.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_gyro_calibration.x_scale = 1.0f;
|
||||||
|
_gyro_calibration.y_scale = 1.0f;
|
||||||
|
_gyro_calibration.z_scale = 1.0f;
|
||||||
|
_gyro_calibration.x_offset = 0.0f;
|
||||||
|
_gyro_calibration.y_offset = 0.0f;
|
||||||
|
_gyro_calibration.z_offset = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DfMpu9250Wrapper::_update_accel_calibration()
|
void DfMpu9250Wrapper::_update_accel_calibration()
|
||||||
@@ -354,7 +364,18 @@ void DfMpu9250Wrapper::_update_accel_calibration()
|
|||||||
if (res != OK) {
|
if (res != OK) {
|
||||||
PX4_ERR("Could not access param %s", str);
|
PX4_ERR("Could not access param %s", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We got calibration values, let's exit.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set sane default calibration values
|
||||||
|
_accel_calibration.x_scale = 1.0f;
|
||||||
|
_accel_calibration.y_scale = 1.0f;
|
||||||
|
_accel_calibration.z_scale = 1.0f;
|
||||||
|
_accel_calibration.x_offset = 0.0f;
|
||||||
|
_accel_calibration.y_offset = 0.0f;
|
||||||
|
_accel_calibration.z_offset = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DfMpu9250Wrapper::_publish(struct imu_sensor_data &data)
|
int DfMpu9250Wrapper::_publish(struct imu_sensor_data &data)
|
||||||
|
|||||||
Reference in New Issue
Block a user