IMU数据仿真公式推导及代码实现

文章目录

  • IMU测量模型(离散时间)
  • 代码实现

IMU测量模型(离散时间)

IMU测量模型:

ω m = ω + b g d + n g d a m = a + b a d + n a d \begin{aligned} {\omega}_m &= \omega + b_{gd} + n_{gd} \\ a_m &= a + b_{ad} + n_{ad} \end{aligned} ωmam=ω+bgd+ngd=a+bad+nad

其中,

离散时间的 Bias:

b g d [ k ] = b g d [ k − 1 ] + σ b g d ⋅ w [ k ] = b g d [ k − 1 ] + σ b g Δ t ⋅ w [ k ] b a d [ k ] = b a d [ k − 1 ] + σ b a d ⋅ w [ k ] = b a d [ k − 1 ] + σ b a Δ t ⋅ w [ k ] \begin{aligned} b_{gd}[k] &= b_{gd}[k-1] + \sigma_{bgd} \cdot w[k] \\ &= b_{gd}[k-1] + \sigma_{bg} \sqrt{\Delta t} \cdot w[k] \\ b_{ad}[k] &= b_{ad}[k-1] + \sigma_{bad} \cdot w[k] \\ &= b_{ad}[k-1] + \sigma_{ba} \sqrt{\Delta t} \cdot w[k] \end{aligned} bgd[k]bad[k]=bgd[k1]+σbgdw[k]=bgd[k1]+σbgΔt w[k]=bad[k1]+σbadw[k]=bad[k1]+σbaΔt w[k]

离散时间的 White Noise:

n g d = σ g d ⋅ w [ k ] = σ g 1 Δ t ⋅ w [ k ] n a d = σ a d ⋅ w [ k ] = σ a 1 Δ t ⋅ w [ k ] \begin{aligned} n_{gd} &= \sigma_{gd} \cdot w[k] \\ &= \sigma_{g} \frac{1}{\sqrt{\Delta t}} \cdot w[k] \\ n_{ad} &= \sigma_{ad} \cdot w[k] \\ &= \sigma_{a} \frac{1}{\sqrt{\Delta t}} \cdot w[k] \end{aligned} ngdnad=σgdw[k]=σgΔt 1w[k]=σadw[k]=σaΔt 1w[k]

其中, w [ k ] ∼ N ( 0 , 1 ) w[k] \sim \mathcal{N}(0,1) w[k]N(0,1) Δ t \Delta t Δt 为采样时间。

代码实现

参考贺一家博士的代码(HeYijia/vio_data_simulation)

std::random_device rd;
std::default_random_engine generator_(rd());
std::normal_distribution noise(0.0, 1.0);

Eigen::Vector3d noise_gyro(noise(generator_),noise(generator_),noise(generator_));
Eigen::Matrix3d gyro_sqrt_cov = param_.gyro_noise_sigma * Eigen::Matrix3d::Identity();
data.imu_gyro = data.imu_gyro + gyro_sqrt_cov * noise_gyro / sqrt( param_.imu_timestep ) + gyro_bias_;

Eigen::Vector3d noise_acc(noise(generator_),noise(generator_),noise(generator_));
Eigen::Matrix3d acc_sqrt_cov = param_.acc_noise_sigma * Eigen::Matrix3d::Identity();
data.imu_acc = data.imu_acc + acc_sqrt_cov * noise_acc / sqrt( param_.imu_timestep ) + acc_bias_;

// gyro_bias update
Eigen::Vector3d noise_gyro_bias(noise(generator_),noise(generator_),noise(generator_));
gyro_bias_ += param_.gyro_bias_sigma * sqrt(param_.imu_timestep ) * noise_gyro_bias;
data.imu_gyro_bias = gyro_bias_;

// acc_bias update
Eigen::Vector3d noise_acc_bias(noise(generator_),noise(generator_),noise(generator_));
acc_bias_ += param_.acc_bias_sigma * sqrt(param_.imu_timestep ) * noise_acc_bias;
data.imu_acc_bias = acc_bias_;

你可能感兴趣的:(INS)