加速度计数据中的重力补偿 [英] Gravity Compensation in Accelerometer Data

查看:355
本文介绍了加速度计数据中的重力补偿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出一个具有9 DOF的加速度计(加速度计,陀螺仪和磁力计)我想消除/补偿重力对加​​速度计读数的影响(加速度计可以自由旋转).传感器以四元数表示形式给出相对于(磁性)北,西和上参考系的方向.

Given an Accelerometer with 9 DOF (Accelerometer, Gyroscope and Magnetometer) I want to remove/compensate the effect of the gravity in accelerometer reading (Accelerometer can rotate freely). The sensor gives the orientation in quaternion representation relative to a (magnetic)north, west and up reference frame.

我找到了这个 http://www.varesano .net/blog/fabio/simple-gravity-compensation-9-dom-imus 但无法理解给定方程式的基础.

I found this http://www.varesano.net/blog/fabio/simple-gravity-compensation-9-dom-imus but couldn't understand the basis for the given equation.

如何通过上述信息实现这一目标?

How could I achieve this given above information?

推荐答案

您需要将四元数的加速度计读数旋转到地球参考系中(如果愿意,请旋转到房间的坐标系中),然后减去重力.剩余的加速度是传感器在地球参考系中的加速度,通常称为线性加速度或用户加速度.

You need to rotate the accelerometer reading by the quaternion into the Earth frame of reference (into the coordinate system of the room if you like), then subtract gravity. The remaining acceleration is the acceleration of the sensor in the Earth frame of reference often referred to as linear acceleration or user acceleration.

在伪代码中,类似这样的

In pseudo-code, something like this

acceleration = [ax, ay, ay]  // accelerometer reading

q                            // quaternion corresponding to the orientation

gravity = [0, 0, -9.81]      // gravity on Earth in m/s^2

a_rotated = rotate(acceleration, q) // rotate the measured acceleration into
                                    // the Earth frame of reference

user_acceleration = a_rotated - gravity

您说可以通过API获得q.唯一简单的步骤是实现rotate()函数.

You say that you can get q through the API. The only nontrivial step is to implement the rotate() function.

要计算矢量v旋转q时的图像,应使用以下公式:v rotated = q v q -1 .要使用浮点数进行计算,您需要自己计算公式.可以在使用四元数旋转中获得.

To compute the image of a vector v when rotated by q, the following formula should be applied: vrotated = qvq-1. To compute it with floating point numbers, you need to work out the formulas yourself; they are available at Using quaternion rotations.

据我所知,您提供的链接正是这样做的,您可以在其中看到展开的公式,现在您知道它们的来源.而且,链接的内容似乎以g为单位来测量重力,即重力为[0,0,-1].

As far as I can tell, the link you provided does exactly this, you see the expanded formulas there and now you know where they came from. Also, the linked content seems to measure gravity in g, that is, gravity is [0,0,-1].

当心符号约定(是否考虑重力[0,0,-1]或[0,0,1])和您的坐标系的惯性

Watch out for sign conventions (whether you consider gravity [0,0,-1] or [0,0,1]) and handedness of your coordinate systems!

这篇关于加速度计数据中的重力补偿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆