%% IMU Sensor Fusion with Simulink
% This example shows how to generate and fuse IMU sensor data using
% Simulink(R). You can accurately model the behavior of an
% accelerometer, a gyroscope, and a magnetometer and fuse their outputs to
% compute orientation.
%
% Copyright 2019 The MathWorks, Inc.
%% Inertial Measurement Unit
% An inertial measurement unit (IMU) is a group of sensors consisting of an
% accelerometer measuring acceleration and a gyroscope measuring
% angular velocity. Frequently, a magnetometer is also included to measure
% the Earth's magnetic field. Each of these three sensors produces a 3-axis
% measurement, and these three measurements constitute a 9-axis
% measurement.
%% Attitude Heading and Reference System
% An Attitude Heading and Reference System (AHRS) takes the 9-axis sensor
% readings and computes the orientation of the device. This orientation is
% given relative to the NED frame, where N is the Magnetic North direction.
% The AHRS block in Simulink accomplishes this using an indirect Kalman
% filter structure.
%% Simulink System
% Open the Simulink model that fuses IMU sensor data
open_system('IMUFusionSimulinkModel');
%% Inputs and Configuration
% The inputs to the IMU block are the device's linear acceleration, angular
% velocity, and the orientation relative to the navigation frame. The
% orientation is of the form of a quaternion (a 4-by-1 vector in Simulink)
% or rotation matrix (a 3-by-3 matrix in Simulink) that rotates quantities
% in the navigation frame to the body frame. In this model, the angular
% velocity is simply integrated to create an orientation input. The angular
% velocity is in rad/s and the linear acceleration is in m/s^2. Because the
% AHRS has only one input related to translation (the accelerometer input),
% it cannot distinguish between gravity and linear acceleration. Therefore,
% the AHRS algorithm assumes that linear acceleration is a slowly varying
% white noise process. This is a common assumption for 9-axis fusion
% algorithms.
%% True North vs Magnetic North
% Magnetic field parameter on the IMU block dialog can be set to the local
% magnetic field value. Magnetic field values can be found on the
% <https://www.ngdc.noaa.gov/geomag/calculators/magcalc.shtml#igrfwmm NOAA
% website> or using the |wrldmagm| function in the Aerospace Toolbox(TM).
% The magnetic field values on the IMU block dialog correspond the readings
% of a perfect magnetometer that is orientated to True North. Therefore,
% the orientation input to the IMU block is relative to the NED frame,
% where N is the True North direction. However, the AHRS filter navigates
% towards Magnetic North, which is typical for this type of filter.
% Therefore, the orientation input to the IMU and the estimated orientation
% at the output of the AHRS differ by the declination angle between True
% North and Magnetic North.
%
% This simulation is setup for $0^\circ$ latitude and $0^\circ$ longitude.
% The magnetic field at this location is set as [27.5550, -2.4169,
% -16.0849] microtesla in the IMU block. The declination at this location
% is about $4.7^\circ$
%% Simulation
% Simulate the model. The IMU input
% orientation and the estimated output orientation of the AHRS
% are compared using quaternion distance. This is preferable compared to differencing
% the Euler angle equivalents, considering the Euler angle singularities.
sim('IMUFusionSimulinkModel');
%% Estimated Orientation
% The difference in estimated vs true orientation should be nearly
% $4.7\circ$, which is the declination at this latitude and longitude.
%% Gyroscope Bias
% The second output of the AHRS filter is the bias-corrected gyroscope
% reading. In the IMU block, the gyroscope was given a bias of 0.0545 rad/s
% or 3.125 deg/s, which should match the steady state value in the
% |Gyroscope Bias| scope block.
%% Further Exercises
% By varying the parameters on the IMU, you should see a corresponding
% change in orientation on the output of the AHRS. You can set the
% parameters on the IMU block to match a real IMU datasheet and
% tune the AHRS parameters to meet your requirements.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
此示例说明如何使用 Simulink生成和融合 IMU 传感器数据。可以准确地对加速度计、陀螺仪和磁力计的行为进行建模,并融合它们的输出以计算方向。 1.惯性测量单元 惯性测量单元 (IMU) 是一组传感器,由测量加速度的加速度计和测量角速度的陀螺仪组成。通常,还包括一个磁力计来测量地球的磁场。这三个传感器中的每一个都产生 3 轴测量,这三个测量构成 9 轴测量。 2.姿态航向和参考系统 姿态航向和参考系统 (AHRS) 获取 9 轴传感器读数并计算设备的方向。此方向是相对于NED框架给出的,其中N是磁北方向。Simulink 中的 AHRS 模块使用间接卡尔曼滤波器结构实现此目的。 3.同步系统 打开融合 IMU 传感器数据的 Simulink 模型
资源推荐
资源详情
资源评论
收起资源包目录
基于Simulink融合IMU传感器数据.rar (2个子文件)
基于Simulink融合IMU传感器数据
IMUFusionSimulinkModel.slx 53KB
IMUSensorFusionWithSimulinkExample.m 4KB
共 2 条
- 1
珞瑜·
- 粉丝: 10w+
- 资源: 500
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页