【发布时间】:2023-03-13 22:00:02
【问题描述】:
我有来自 3 轴 IMU 的加速度 (x,y,z) 和滚动、俯仰、航向数据。我想根据陀螺仪测量的角度(r,p,h)来补偿加速度数据。例如,当 IMU 平坦且静止(z 轴向上)时,加速度读数为 [ax,ay,az]=[0,0,-1]。当 IMU 平坦且静止(x 轴向上)时,加速度读数为 [ax,ay,az]=[-1,0,0]。最后,当 IMU 平坦且静止(y 轴向上)时,加速度读数为 [ax,ay,az]=[0,-1,0]。
由于在 IMU不是完全平坦和水平的情况下收集数据,我需要从我的加速度数据中删除 g 分量。
下面是我第一次删除 g 组件。我可以使用的另一种方法是什么,因为我已经知道随着数据文件大小的增加,这是计算密集型的。
%% Remove gravity from X, Y, Z components
refPlane = [r0 p0 h0]; % [2deg 4deg 60deg] IMU was not level during data collection.
for i = 1:length(time)
deltaAngleX = roll(i) - refPlane(1); %degrees
deltaAngleY = pitch(i) - refPlane(2); %degrees
if ( deltaAngleX > 0) % roll ++, ay --, az ++
cX_X = 0;
cY_X = -sind ( deltaAngleX ) ;
cZ_X = cosd ( deltaAngleX ) ;
elseif ( deltaAngleX < 0 )
cX_X = 0;
cY_X = sind ( deltaAngleX ) ;
cZ_X = cosd ( deltaAngleX ) ;
end
if ( deltaAngleY > 0 ) % roll ++, ay --, az ++
cX_Y = sind ( deltaAngleY ) ;
cY_Y = 0 ;
cZ_Y = sind ( deltaAngleY ) ;
elseif ( deltaAngleY < 0 )
cX_Y = -sind ( deltaAngleY ) ;
cY_Y = 0 ;
cZ_Y = sind ( deltaAngleY ) ;
end
ax(i) = ax(i) + cX_X + cX_Y;
ay(i) = ay(i) + cY_X + cY_Y;
az(i) = az(i) + cZ_X + cZ_Y;
end
【问题讨论】:
标签: matlab accelerometer gyroscope imu