Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
linear_kalman_filter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3  *
4  * This file is part of paparazzi
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
26 #ifndef LINEAR_KALMAN_FILTER_H
27 #define LINEAR_KALMAN_FILTER_H
28 
29 #include "std.h"
30 
31 // maximum size for the state vector
32 #ifndef KF_MAX_STATE_SIZE
33 #define KF_MAX_STATE_SIZE 6
34 #endif
35 
36 // maximum size for the command vector
37 #ifndef KF_MAX_CMD_SIZE
38 #define KF_MAX_CMD_SIZE 2
39 #endif
40 
41 // maximum size for the measurement vector
42 #ifndef KF_MAX_MEAS_SIZE
43 #define KF_MAX_MEAS_SIZE 6
44 #endif
45 
47  // filled by user after calling init function
54 
56 
60 };
61 
70 extern bool linear_kalman_filter_init(struct linear_kalman_filter *filter, uint8_t n, uint8_t c, uint8_t m);
71 
80 extern void linear_kalman_filter_predict(struct linear_kalman_filter *filter, float *U);
81 
92 extern void linear_kalman_filter_update(struct linear_kalman_filter *filter, float *Y);
93 
94 #endif /* DISCRETE_EKF_H */
#define KF_MAX_STATE_SIZE
float C[KF_MAX_MEAS_SIZE][KF_MAX_STATE_SIZE]
observation matrix
#define KF_MAX_CMD_SIZE
uint8_t n
state vector size (<= KF_MAX_STATE_SIZE)
float R[KF_MAX_MEAS_SIZE][KF_MAX_MEAS_SIZE]
measurement covariance noise
bool linear_kalman_filter_init(struct linear_kalman_filter *filter, uint8_t n, uint8_t c, uint8_t m)
Init all matrix and vectors to zero.
uint8_t m
measurement vector size (<= KF_MAX_MEAS_SIZE)
#define KF_MAX_MEAS_SIZE
void linear_kalman_filter_predict(struct linear_kalman_filter *filter, float *U)
Prediction step.
float X[KF_MAX_STATE_SIZE]
estimated state X
uint8_t c
command vector size (<= KF_MAX_CMD_SIZE)
float P[KF_MAX_STATE_SIZE][KF_MAX_STATE_SIZE]
state covariance matrix
float A[KF_MAX_STATE_SIZE][KF_MAX_STATE_SIZE]
dynamic matrix
float B[KF_MAX_STATE_SIZE][KF_MAX_CMD_SIZE]
command matrix
void linear_kalman_filter_update(struct linear_kalman_filter *filter, float *Y)
Update step.
float Q[KF_MAX_STATE_SIZE][KF_MAX_STATE_SIZE]
proces covariance noise
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98