IMU 速度估计的代码示例

发布于 2025-01-10 12:59:27 字数 157 浏览 4 评论 0原文

您是否知道在哪里可以找到根据 IMU(惯性测量单元、加速度计 + 陀螺仪 + 磁力计)数据进行速度估计的代码/示例?
我根据 IMU 静止的数据计算了偏差。我想用某种滤波器(卡尔曼/互补)实现速度估计,到目前为止找不到任何滤波器。
我还有相机速度估计,也许它可以作为某种融合提供帮助?

Do you maybe know where I can find code/example for velocity estimation from IMU (Inertial Measurement Unit, accelerometer + gyro + magnetometer) data?
I calculated biases from data where IMU stands still. I want to implement velocity estimation with some kind of filter (Kalman/Complementary), so far couldn't find any.
I also have camera velocity estimation, maybe it can help as some kind of fusion?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静若繁花 2025-01-17 12:59:27

我没有完全适合您的情况的示例代码。但这种方法可以帮助(基于过去的经验),

卡尔曼滤波器:

  1. 决定并制定状态X,控制输入U,输出,预测和观测方程。
  2. 实现/重用卡尔曼滤波器的一些实现。这是一个基于 Simulink 的实现供参考。
  3. 设置测量噪声和预测误差方差。稍后可能需要一些微调。
  4. 验证 KF 是否针对某些参考工作。如果您有其他方法来测量速度,请对照它检查 KF 速度。

状态和控制输入:

数组

  1. 状态可以是包含线速度 [Vx、Vy、Vz]
  2. 角速度 [omega_x、omega_y、omega_z]
  3. 陀螺仪偏差的 。这种偏差基本上是恒定的,但会随着温度和其他因素而变化。 KF 将使用加速度计测量来校正陀螺仪偏差。
  4. 加速度计的偏差。这种偏差基本上是恒定的,但会随着温度和其他因素而变化。 KF 将使用摄像机速度来校正加速度偏差。
  5. 方向(欧拉角或四元数)

控制输入不必是发送到执行器的实际命令。
在这种情况下,控制输入可以是净力或净加速度,即

加速度计数据(即比力)+重力加速度

预测方程:

预测方程根据当前状态和控制输入预测下一个时间步的状态。

MathWorks 文档为与 IMU 相关的预测方程提供了很好的参考。

观察/测量模型:

将测量与状态联系起来。

Accel 数据已用于预测。这里忽略它。

陀螺仪数据为 [gx, gy, gz] = [omega_x + gyro_bias_x, ....] + 错误

处理磁力计的一种方法是从中获取偏航角 - arctan(y/x),然后使用 yaw_mag 作为测量值。

相机数据为 [vx_cam, vy_cam, vz_cam] = [Vx, Vy, Vx] + 错误

最后追加所有行并将其转换为 Y=C*X + 噪声形式。

Y 表示来自不同传感器的测量值,X 表示状态。

在这种情况下,Y 将为 [gx, gy, gz, yaw_mag, vx,cam, vy_cam, vz_cam]。

免责声明:我是 MathWorks 员工,链接来自 MathWorks 文档。

I don't have an example code that exactly works for your case. But this approach can help (based on past experience),

Kalman filter:

  1. Decide and formulate the states X, control inputs U, outputs, prediction and observation equations.
  2. Implement/ reuse some implementation of Kalman Filter. Here is a Simulink based implementation for reference.
  3. Set the measurement noise and prediction error variances. It may require some fine tuning later.
  4. Verify that the KF works against some reference. If you have another way to measure velocity, check the KF velocity against it.

States and Control inputs:

States could be a array containing

  1. Linear velocities [Vx, Vy, Vz]
  2. Angular velocities [omega_x, omega_y, omega_z]
  3. Bias in gyroscope. This bias is largely constant but can change with temperature and other factors. Accelerometer measurements will be used by KF to correct for gyro bias.
  4. Bias in Accelerometer. This bias is largely constant but can change with temperature and other factors. Camera velocity will be used by KF to correct for accel bias.
  5. Orientation (Euler angles or quaternion)

Control inputs need not be the actual commands that are being sent to your actuators.
In this case, control inputs can be the net force or net acceleration which is,

Accelerometer data (Which is specific force) + Acceleration due to gravity

Prediction equations:

Prediction equations predict the states for next time step based on current states and control inputs.

This MathWorks documentation has a good reference for prediction equations relevant to IMU.

Observation/measurement model:

Relates measurements with states.

Accel data is already used in prediction. Ignore it here.

Gyro data is [gx, gy, gz] = [omega_x + gyro_bias_x, ....] + errors

One way to handle magnetometer is to obtain yaw angle from it - arctan(y/x) and then use the yaw_mag as measurement.

Camera data is [vx_cam, vy_cam, vz_cam] = [Vx, Vy, Vx] + errors

Finally append all the rows and bring it to Y=C*X + noise form.

Y denotes the measurements from different sensors and X represents the states.

Y would be [gx, gy, gz, yaw_mag, vx,cam, vy_cam, vz_cam] in this case.

Disclaimer: I am a MathWorks employee and links are shared from MathWorks documentation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文