资源简介
Kalman滤波算法C代码实现,包括一维Klaman滤波算法和二维Kalman滤波算法

代码片段和文件信息
/*
* FileName : kalman_filter.c
* Author : xiahouzuoxin @163.com
* Version : v1.0
* Date : 2014/9/24 20:36:51
* Brief :
*
* Copyright (C) MICLUSTB
*/
#include “kalman_filter.h“
/*
* @brief
* Init fields of structure @kalman1_state.
* I make some defaults in this init function:
* A = 1;
* H = 1;
* and @q@r are valued after prior tests.
*
* NOTES: Please change AHqr according to your application.
*
* @inputs
* state - Klaman filter structure
* init_x - initial x state value
* init_p - initial estimated error convariance
* @outputs
* @retval
*/
void kalman1_init(kalman1_state *state float init_x float init_p)
{
state->x = init_x;
state->p = init_p;
state->A = 1;
state->H = 1;
state->q = 2e2;//10e-6; /* predict noise convariance */
state->r = 5e2;//10e-5; /* measure error convariance */
}
/*
* @brief
* 1 Dimension Kalman filter
* @inputs
* state - Klaman filter structure
* z_measure - Measure value
* @outputs
* @retval
* Estimated result
*/
float kalman1_filter(kalman1_state *state float z_measure)
{
/* Predict */
state->x = state->A * state->x;
state->p = state->A * state->A * state->p + state->q; /* p(n|n-1)=A^2*p(n-1|n-1)+q */
/* Measurement */
state->gain = state->p * state->H / (state->p * state->H * state->H + state->r);
state->x = state->x + state->gain * (z_measure - state->H * state->x);
state->p = (1 - state->gain * state->H) * state->p;
return state->x;
}
/*
* @brief
* Init fields of structure @kalman1_state.
* I make some defaults in this init function:
* A = {{1 0.1} {0 1}};
* H = {10};
* and @q@r are valued after prior tests.
*
* NOTES: Please change AHqr according to your application.
*
* @inputs
* @outputs
* @retval
*/
void kalman2_init(kalman2_state *state float *init_x float (*init_p)[2])
{
state->x[0] = init_x[0];
state->x[1] = init_x[1];
state->p[0][0] = init_p[0][0];
state->p[0][1] = init_p[0][1];
state->p[1][0] = init_p[1][0];
state->p[1][1] = init_p[1][1];
//state->A = {{1 0.1} {0 1}};
state->A[0][0] = 1;
state->A[0][1] = 0.1;
state->A[1][0] = 0;
state->A[1][1] = 1;
//state->H = {10};
state->H[0] = 1;
state->H[1] = 0;
//state->q = {{10e-60} {010e-6}}; /* measure noise convariance */
state->q[0] = 10e-7;
state->q[1] = 10e-7;
state->r = 10e-7; /* estimated error convariance */
}
/*
* @brief
* 2 Dimension kalman filter
* @inputs
* state - Klaman filter structure
* z_measure - Measure value
* @outputs
* state->x[0] - Updated state value Such as anglevelocity
* state->x[1] - Updated state value Such as diffrence angle acceleration
* state->p - Updated estima
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4928 2017-05-02 17:23 卡尔曼滤波C代码\KalmanFilter.c
文件 1540 2017-05-02 17:26 卡尔曼滤波C代码\KalmanFilter.h
目录 0 2017-05-02 17:27 卡尔曼滤波C代码
----------- --------- ---------- ----- ----
6468 3
- 上一篇:数据库仪器仪表课程设计
- 下一篇:GPRS模块初始化流程
相关资源
- Tracking and Kalman Filtering Made Easy
- 容积卡尔曼滤波(CKF)和嵌入式容积
- 使用kalman滤波实现动态行人检测与跟
- 行人跟踪OPENCV代码
- Fundamentals of Kalman Filtering: A Practical
- Fundamentals of Kalman Filtering A Practical A
- kalman滤波实现视频目标跟踪
- kalman滤波理论及其在导航系统中的应
- 卡尔曼滤波与组合导航原理.pdf
- 《kalman滤波理论及其在导航系统中的
- SLAM经典入门教程
- 神经网络算法在自适应卡尔曼滤波器
- 一种基于改进Kalman滤波的视觉_惯性组
- 二维Kalman滤波
- 基于ViBe+Kalman的目标跟踪
- meanshift+kalman
- Kalman.rar
- meanshift+kalman目标跟踪
- 基于卡尔曼滤波的GPS数据处理研究
- Kalman滤波理论及其在导航系统中的应
- 最优状态估计 Dan Simon
- 基于 Kalman 滤波的 MEMS 陀螺仪滤波算法
- camshift与kalman结合实现视频序列中目标
- 卡尔曼滤波用于单目标定位的程序
- Kalman滤波原理及程序手册.doc282116
- 最优估计大作业:基于kalman滤波的组
- 卡尔曼率波kalman_intro_chinese_V1.2.pdf
- Kalman 滤波经典论文
- kalman filtering in R(R语言实现卡尔曼滤
- 基于扩展Kalman滤波的双基地声呐目标
评论
共有 条评论