简体   繁体   English

如何使用磁力计为陀螺z轴添加辅助滤波器?

[英]How to add a complementary filter for the gyro z axis using a magnetometer?

I am using a complementary filter for my gyro X and gyro Y values: 我为陀螺仪X和陀螺仪Y值使用了互补滤波器:

float angle_x = alpha*gyro_angle_x + (1.0 - alpha)*accel_angle_x;

However, due to Gyro Z drift, I am using a magnetometer to try and eliminate it. 但是,由于陀螺仪Z漂移,我正在使用磁力计来尝试消除它。

I have my local inclination angle and the z-axis magnetometer reading but I am not sure how to implement this into the complementary filter. 我有我的局部倾斜角和z轴磁力计读数,但是我不确定如何将其应用于互补滤波器。

I've tried guessing (which I know doesn't help) to try this: 我尝试猜测(我知道这无济于事)来尝试以下操作:

float angle_z = alpha*gyro_angle_z + ((1.0 -alpha)*accel_angle_y*InclinationAngle)/magZ;

However, it just increases gyro z value when moving and then brings it back to 0 when stationary. 但是,它只是在移动时增加陀螺仪z值,然后在静止时将其恢复为0。

Using the Madgwick filter will work best. 使用Madgwick滤镜效果最佳。 The link can be found here . 链接可以在这里找到。 It is easy to implement (if using the correct library and the readings are pretty accurate. The only downside at the moment is that you will have to calibrate the magnetometer every time you want to use the device in a new direction). 这很容易实现(如果使用正确的库并且读数非常准确。目前唯一的缺点是每次您要在新方向上使用设备时都必须校准磁力计)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过使用磁力计,加速度计和陀螺仪读数的算法找到加速的基本方向 - Finding the cardinal direction accelerated with an Algorithm for using the magnetometer, accelerometer, and gyro readings 在外部加速度下在 IMU(陀螺仪、加速度计、磁力计)上获取重力矢量 - Obtaining gravity vector on an IMU (Gyro, Accelerometer, Magnetometer) under external acceleration 如何使用绕y轴旋转的深度(z)测试? - How to depth (z) test using rotation around the y axis? 如何计算z轴上的位置 - How to calculate positions on a z-axis 如何围绕Z轴绕3D运行 - How to orbit around the Z-axis in 3D 如何伪造在 Z 轴上移动的 2D 精灵? - How to fake a 2D sprite moving on the Z axis? 处理:使用四元数旋转3D对象适用于x轴,但不适用于y或z轴吗? - Processing: Rotating a 3D object using Quaternions works for x-axis, but not for y or z axis? 给定表面位置x,y和z以及距第一个点的距离,如何在z轴上定位点? - How to locate a point in z axis given surface location x,y and z and the distance from the first point? 正投影中的Z轴故障 - Trouble with the Z axis in Orthographic projection 归一化 z 轴上的所有向量 - Normalise all vectors on the z axis
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM