Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sensors: vehicle_imu fix scaling for correction and back #15121

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/modules/sensors/vehicle_imu/VehicleIMU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,13 @@ void VehicleIMU::Run()

// delta angle: apply offsets, scale, and board rotation
_gyro_corrections.SensorCorrectionsUpdate();
const float gyro_dt = 1.e-6f * gyro_integral_dt;
const Vector3f delta_angle_corrected{_gyro_corrections.Correct(delta_angle * gyro_dt) / gyro_dt};
const float gyro_dt_inv = 1.e6f * gyro_integral_dt;
const Vector3f delta_angle_corrected{_gyro_corrections.Correct(delta_angle * gyro_dt_inv) / gyro_dt_inv};

// delta velocity: apply offsets, scale, and board rotation
_accel_corrections.SensorCorrectionsUpdate();
const float accel_dt = 1.e-6f * accel_integral_dt;
Vector3f delta_velocity_corrected{_accel_corrections.Correct(delta_velocity * accel_dt) / accel_dt};
const float accel_dt_inv = 1.e6f * accel_integral_dt;
Vector3f delta_velocity_corrected{_accel_corrections.Correct(delta_velocity * accel_dt_inv) / accel_dt_inv};

UpdateAccelVibrationMetrics(delta_velocity_corrected);
UpdateGyroVibrationMetrics(delta_angle_corrected);
Expand Down