TR-mbed 1.0
Loading...
Searching...
No Matches
TinyEKF.h
Go to the documentation of this file.
1/*
2 * TinyEKF: Extended Kalman Filter for Arduino and TeensyBoard.
3 *
4 * Copyright (C) 2015 Simon D. Levy
5 *
6 * MIT License
7 */
8
9#include <stdio.h>
10#include <stdlib.h>
11#include "tiny_ekf_struct.h"
12
13void ekf_init(void *, int, int);
14int ekf_step(void *, double *);
15
20class TinyEKF {
21
22private:
23
24 ekf_t ekf;
25
26protected:
27
31 double * x;
32
37 ekf_init(&this->ekf, Nsta, Mobs);
38 this->x = this->ekf.x;
39 }
40
45
53 virtual void model(double fx[Nsta], double F[Nsta][Nsta], double hx[Mobs], double H[Mobs][Nsta]) = 0;
54
61 void setP(int i, int j, double value)
62 {
63 this->ekf.P[i][j] = value;
64 }
65
72 void setQ(int i, int j, double value)
73 {
74 this->ekf.Q[i][j] = value;
75 }
76
83 void setR(int i, int j, double value)
84 {
85 this->ekf.R[i][j] = value;
86 }
87
88public:
89
95 double getX(int i)
96 {
97 return this->ekf.x[i];
98 }
99
105 void setX(int i, double value)
106 {
107 this->ekf.x[i] = value;
108 }
109
115 bool step(double * z)
116 {
117 this->model(this->ekf.fx, this->ekf.F, this->ekf.hx, this->ekf.H);
118
119 return ekf_step(&this->ekf, z) ? false : true;
120 }
121};
int i
Definition BiCGSTAB_step_by_step.cpp:9
#define Nsta
Definition ChassisKalman.h:8
#define Mobs
Definition ChassisKalman.h:9
void ekf_init(void *, int, int)
Definition tiny_ekf.cpp:271
int ekf_step(void *, double *)
Definition tiny_ekf.cpp:292
Definition TinyEKF.h:20
void setQ(int i, int j, double value)
Definition TinyEKF.h:72
void setX(int i, double value)
Definition TinyEKF.h:105
double * x
Definition TinyEKF.h:31
void setR(int i, int j, double value)
Definition TinyEKF.h:83
bool step(double *z)
Definition TinyEKF.h:115
double getX(int i)
Definition TinyEKF.h:95
TinyEKF()
Definition TinyEKF.h:36
void setP(int i, int j, double value)
Definition TinyEKF.h:61
~TinyEKF()
Definition TinyEKF.h:44
virtual void model(double fx[Nsta], double F[Nsta][Nsta], double hx[Mobs], double H[Mobs][Nsta])=0
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
Definition gnuplot_common_settings.hh:74
Definition tiny_ekf.cpp:197
double * P
Definition tiny_ekf.cpp:201
double * fx
Definition tiny_ekf.cpp:214
double * Q
Definition tiny_ekf.cpp:202
double * R
Definition tiny_ekf.cpp:203
double * x
Definition tiny_ekf.cpp:199
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2