0

我有一个通过 SPI 接口与 Melopero LSM9DS1 惯性测量单元连接的 Raspberry PI 4。Raspberry 控制两个电机(左/右)的运动,我想获得集成 IMU 测量的姿态和速度信息。

IMU 驱动程序是一个 python 脚本,它重复:

read N IMU samplings
compute the average of accelerometer, gyroscope, magnetometer
send the result with a timestamp to the process which integrates them.

整合策略如下:

imu_m1 = NULL
yaw, pitch, roll = 0,0,0
vx, vy, vz, = 0,0,0
while (true)   ​
   ​imu_msg = receive(...)
   ​if (NULL == imu_m1)
      ​imu_m1 = imu_msg
   ​else
      ​dt = imu_msg.timestamp_sec - imu_m1.timestamp_sec
      ​imu_m1 = imu_msg
      ​vx += dt * 
      ​imu_m1.accelerometer_x
      ​vy = //... The same strategy for each value vx,vy,vz,pitch,roll,yaw

为了简化,我假设:

  1. 重力都沿 Z 轴指向,所以我只忽略 Z 轴的速度值;
  2. 残余测量噪声可以忽略不计。

这种策略适用于态度值,但至于速度,我在所有三个轴上都得到不可靠的值。在制定此策略时,我可能没有考虑到什么?它基本上是求解常微分方程的显式欧拉方法:

​y(n+1) = y(n) + dt*f(t-1, y-1)

在哪里

f(t-1, y-1) = imu_m1
4

0 回答 0