In wave we got velocity estimates from WaveKalman filter so we can compensate for
centripetal acceleration in Kalman AHRS step.
import numpy as np
def estimate_centripetal_acceleration(velocity, gyro_data):
"""
Estimate centripetal acceleration using velocity and gyroscope data.
:param velocity: Velocity of the aircraft (m/s).
:param gyro_data: Gyroscope data (angular velocity in rad/s) [wx, wy, wz].
:return: Centripetal acceleration vector [ax, ay, az].
"""
# Angular velocity magnitude (assuming turn is around the z-axis)
omega = np.linalg.norm(gyro_data) # Total angular velocity
omega_z = gyro_data[2] # Angular velocity around the z-axis
# Turn radius
turn_radius = velocity / omega_z if omega_z != 0 else 0
# Centripetal acceleration magnitude
a_c_magnitude = velocity * omega_z
# Centripetal acceleration direction (assumed to be in the x-direction for simplicity)
a_c = np.array([a_c_magnitude, 0, 0]) # Adjust direction based on turn axis
return a_c
def compensate_centripetal_acceleration(accel_data, velocity, gyro_data):
"""
Compensate for centripetal acceleration in accelerometer data.
:param accel_data: Accelerometer data (m/s²) [ax, ay, az].
:param velocity: Velocity of the aircraft (m/s).
:param gyro_data: Gyroscope data (angular velocity in rad/s) [wx, wy, wz].
:return: Compensated accelerometer data [ax, ay, az].
"""
# Estimate centripetal acceleration
a_c = estimate_centripetal_acceleration(velocity, gyro_data)
# Subtract centripetal acceleration from accelerometer data
accel_compensated = accel_data - a_c
return accel_compensated
# Example usage
velocity = 50 # Velocity in m/s
gyro_data = np.array([0, 0, 0.1]) # Gyroscope data (rad/s)
accel_data = np.array([2.0, 0.1, 9.81]) # Accelerometer data (m/s²)
# Compensate for centripetal acceleration
accel_compensated = compensate_centripetal_acceleration(accel_data, velocity, gyro_data)
print("Original accelerometer data:", accel_data)
print("Compensated accelerometer data:", accel_compensated)
In wave we got velocity estimates from WaveKalman filter so we can compensate for
centripetal acceleration in Kalman AHRS step.
Rough idea: