简体   繁体   English

我可以只用陀螺仪和磁力计抵消重力吗?

[英]Can I cancel out gravity only with gyro and magnetometer?

On a device I want to detect a range of forces: small forces (Minimum around 0.01g) but also stronger forces like 0.1g - 0.15g.在设备上,我想检测一系列力:小力(最小约 0.01g)但也有更强的力,如 0.1g - 0.15g。

This device will have different positions in 3d space so in order to detect the small forces I have to know its angle in order to be able to subtract 1g.该设备将在 3d 空间中具有不同的位置,因此为了检测小力,我必须知道它的角度以便能够减去 1g。 Because the device can have a random position (angle position).因为设备可以有一个随机位置(角度位置)。

What I did so far: I used the MPU6050 and used a complementary filter with accel.到目前为止我所做的:我使用了 MPU6050 并使用了带有加速的互补滤波器。 and gyro.和陀螺仪。 It's something like:它是这样的:

agnleX_k+1 = 0.98*(angle_k + deltaT * gyro_k+1) + 0.02*angle_acc_k+1;

angle_acc is the angle calculated from the accel. angle_acc是从加速度计算的角度。 sensor.传感器。 Something like:类似的东西:

arctan(accelX / sqrt(accelX^2 + accelY^2 + accelZ^2 + ))

So I am interested in:所以我感兴趣的是:

forceX_k+1 = accelX_k+1 - 1g*sin(agnleX_k+1)

The problem is:问题是:

If I want to detect a small force coming in very fast, let's say on accelX_k+1 I would want to detect a Change from 0g to 0.01g or more but in a very small time range.如果我想检测到一个非常快的小力,假设在accelX_k+1我想检测从 0g 到 0.01g 或更多但在非常小的时间范围内的变化。 The problem is that my calculated angle would then also be influenced by this small and fast change of the accel.问题是我计算出的角度也会受到加速度的这种微小而快速的变化的影响。 sensor although the angle haven't really changed.传感器虽然角度没有真正改变。

I think I would have to do the angle calculation independent of the accel.我想我必须独立于加速度进行角度计算。 sensor.传感器。 Can I do something like a complementary filter with gyro and magnetometer?我可以用陀螺仪和磁力计做类似互补滤波器的事情吗? Would that work the same as my filter described above but just with the mag.这会和我上面描述的过滤器一样工作,但只是使用 mag。 sensor instead?传感器代替? Or how would you do that?或者你会怎么做? I was thinking about using MPU9250.我在考虑使用 MPU9250。

You stated using MPU6050, which contains both an accelerometer and a gyrosocpe.你说使用 MPU6050,它包含一个加速度计和一个陀螺仪。 You could use them independantly - get acceleration from the accelerometer and get angles from the gyroscope, and then use the angles to compensate for rotation.您可以独立使用它们 - 从加速度计获取加速度并从陀螺仪获取角度,然后使用这些角度来补偿旋转。 There is no need for the angle to depend on your accelerometer.角度不需要取决于您的加速度计。

Using DMP library fromJeff Rowberg will do the work for you.使用来自Jeff Rowberg 的DMP 库将为您完成这项工作。 it can compensate gravity acceleration internally way faster that Arduino code.它可以比Arduino代码更快地在内部补偿重力加速度。

Link to github 链接到github

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM