|
|
|
@ -547,6 +547,8 @@ bool VehicleIMU::Publish()
@@ -547,6 +547,8 @@ bool VehicleIMU::Publish()
|
|
|
|
|
Vector3f delta_angle; |
|
|
|
|
Vector3f delta_velocity; |
|
|
|
|
|
|
|
|
|
const Vector3f accumulated_coning_corrections = _gyro_integrator.accumulated_coning_corrections(); |
|
|
|
|
|
|
|
|
|
if (_accel_integrator.reset(delta_velocity, imu.delta_velocity_dt) |
|
|
|
|
&& _gyro_integrator.reset(delta_angle, imu.delta_angle_dt)) { |
|
|
|
|
|
|
|
|
@ -554,17 +556,22 @@ bool VehicleIMU::Publish()
@@ -554,17 +556,22 @@ bool VehicleIMU::Publish()
|
|
|
|
|
|
|
|
|
|
// delta angle: apply offsets, scale, and board rotation
|
|
|
|
|
_gyro_calibration.SensorCorrectionsUpdate(); |
|
|
|
|
const float gyro_dt_inv = 1.e6f / imu.delta_angle_dt; |
|
|
|
|
const Vector3f angular_velocity{_gyro_calibration.Correct(delta_angle * gyro_dt_inv)}; |
|
|
|
|
const float gyro_dt_s = 1.e-6f * imu.delta_angle_dt; |
|
|
|
|
const Vector3f angular_velocity{_gyro_calibration.Correct(delta_angle / gyro_dt_s)}; |
|
|
|
|
UpdateGyroVibrationMetrics(angular_velocity); |
|
|
|
|
const Vector3f delta_angle_corrected{angular_velocity / gyro_dt_inv}; |
|
|
|
|
const Vector3f delta_angle_corrected{angular_velocity * gyro_dt_s}; |
|
|
|
|
|
|
|
|
|
// accumulate delta angle coning corrections
|
|
|
|
|
_coning_norm_accum += accumulated_coning_corrections.norm() * gyro_dt_s; |
|
|
|
|
_coning_norm_accum_total_time_s += gyro_dt_s; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delta velocity: apply offsets, scale, and board rotation
|
|
|
|
|
_accel_calibration.SensorCorrectionsUpdate(); |
|
|
|
|
const float accel_dt_inv = 1.e6f / imu.delta_velocity_dt; |
|
|
|
|
const Vector3f acceleration{_accel_calibration.Correct(delta_velocity * accel_dt_inv)}; |
|
|
|
|
const float accel_dt_s = 1.e-6f * imu.delta_velocity_dt; |
|
|
|
|
const Vector3f acceleration{_accel_calibration.Correct(delta_velocity / accel_dt_s)}; |
|
|
|
|
UpdateAccelVibrationMetrics(acceleration); |
|
|
|
|
const Vector3f delta_velocity_corrected{acceleration / accel_dt_inv}; |
|
|
|
|
const Vector3f delta_velocity_corrected{acceleration * accel_dt_s}; |
|
|
|
|
|
|
|
|
|
// vehicle_imu_status
|
|
|
|
|
// publish before vehicle_imu so that error counts are available synchronously if needed
|
|
|
|
@ -591,6 +598,11 @@ bool VehicleIMU::Publish()
@@ -591,6 +598,11 @@ bool VehicleIMU::Publish()
|
|
|
|
|
Vector3f(_gyro_calibration.rotation() * _raw_gyro_mean.variance()).copyTo(_status.var_gyro); |
|
|
|
|
_raw_gyro_mean.reset(); |
|
|
|
|
|
|
|
|
|
// Gyro delta angle coning metric = length of coning corrections averaged since last status publication
|
|
|
|
|
_status.delta_angle_coning_metric = _coning_norm_accum / _coning_norm_accum_total_time_s; |
|
|
|
|
_coning_norm_accum = 0; |
|
|
|
|
_coning_norm_accum_total_time_s = 0; |
|
|
|
|
|
|
|
|
|
// gyro temperature
|
|
|
|
|
_status.temperature_gyro = _gyro_temperature_sum / _gyro_temperature_sum_count; |
|
|
|
|
_gyro_temperature_sum = NAN; |
|
|
|
@ -692,10 +704,6 @@ void VehicleIMU::UpdateGyroVibrationMetrics(const Vector3f &angular_velocity)
@@ -692,10 +704,6 @@ void VehicleIMU::UpdateGyroVibrationMetrics(const Vector3f &angular_velocity)
|
|
|
|
|
_status.gyro_vibration_metric = 0.99f * _status.gyro_vibration_metric |
|
|
|
|
+ 0.01f * Vector3f(angular_velocity - _angular_velocity_prev).norm(); |
|
|
|
|
|
|
|
|
|
// Gyro delta angle coning metric = filtered length of (angular_velocity x angular_velocity_prev)
|
|
|
|
|
const Vector3f coning_metric{angular_velocity % _angular_velocity_prev}; |
|
|
|
|
_status.gyro_coning_vibration = 0.99f * _status.gyro_coning_vibration + 0.01f * coning_metric.norm(); |
|
|
|
|
|
|
|
|
|
_angular_velocity_prev = angular_velocity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|