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

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

问题描述

给定一个具有 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.

在伪代码中,类似这样

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.

要计算由 q 旋转时矢量 v 的图像,应应用以下公式: vrotated = qvq-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天全站免登陆