六轴传感器(数值输出部分)

2017-04-16  本文已影响0人  CHOCHII

<pre>网络资料学习与整合,并附加一些个人理解。
六轴传感器 = 三轴加速度 + 三轴陀螺仪
</pre>

1.加速度计

安卓端:

三轴方向

      加速度计用于测量加速度。借助一个三轴加速度计可以测得一个固定平台相对地球表面的运动方向。如果平台朝某个方向做加速度运动,各个轴向加速度值会含有重力产生的加速度值,使得无法获得真正的加速度值。

加速度计

Therefore, to measure the real acceleration of the device, the contribution of the force of gravity must be removed from the accelerometer data. This can be achieved by applying a high-pass filter. Conversely, a low-pass filter can be used to isolate the force of gravity. The following example shows how you can do this:
      因此,为了测量装置的实际加速度,必须从加速度计数据中去除重力所做的贡献。这可以通过应用high-pass filter 来实现。相反,可以使用a low-pass filter 来隔离重力。

public void onSensorChanged(SensorEvent event){
  // In this example, alpha is calculated as t / (t + dT),
  // where t is the low-pass filter's time-constant and
  // dT is the event delivery rate.

  final float alpha = 0.8;

  // Isolate the force of gravity with the low-pass filter.
  gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
  gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
  gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];

  // Remove the gravity contribution with the high-pass filter.
  linear_acceleration[0] = event.values[0] - gravity[0];
  linear_acceleration[1] = event.values[1] - gravity[1];
  linear_acceleration[2] = event.values[2] - gravity[2];
}

芯片端:

无重力状态

2. 三轴陀螺仪

上一篇 下一篇

猜你喜欢

热点阅读