Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
simple_kinematic_kalman.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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  */
20 
28 #ifndef SIMPLE_KINEMATIC_KALMAN_H
29 #define SIMPLE_KINEMATIC_KALMAN_H
30 
31 #include "std.h"
33 
34 #define SIMPLE_KINEMATIC_KALMAN_DIM 6
35 
36 // Speed update types
37 #define SIMPLE_KINEMATIC_KALMAN_SPEED_HORIZONTAL 1
38 #define SIMPLE_KINEMATIC_KALMAN_SPEED_VERTICAL 2
39 #define SIMPLE_KINEMATIC_KALMAN_SPEED_3D 3
40 
56  float r;
57  float dt;
58 };
59 
69 extern void simple_kinematic_kalman_init(struct SimpleKinematicKalman *kalman, float P0_pos, float P0_speed,
70  float Q_sigma2, float r, float dt);
71 
82  struct FloatVect3 speed);
83 
91  struct FloatVect3 *speed);
92 
99 
106 
113 extern void simple_kinematic_kalman_update_noise(struct SimpleKinematicKalman *kalman, float Q_sigma2, float r);
114 
120 
127 
135 
136 #endif
Paparazzi floating point algebra.
#define SIMPLE_KINEMATIC_KALMAN_DIM
float Hp[SIMPLE_KINEMATIC_KALMAN_DIM/2][SIMPLE_KINEMATIC_KALMAN_DIM]
observation matrix for position
struct FloatVect3 simple_kinematic_kalman_get_pos(struct SimpleKinematicKalman *kalman)
Get current pos.
float r
measurement noise (assumed the same for all anchors)
float state[SIMPLE_KINEMATIC_KALMAN_DIM]
state vector
float Q[SIMPLE_KINEMATIC_KALMAN_DIM][SIMPLE_KINEMATIC_KALMAN_DIM]
process noise matrix
void simple_kinematic_kalman_get_state(struct SimpleKinematicKalman *kalman, struct FloatVect3 *pos, struct FloatVect3 *speed)
Get current state.
float P[SIMPLE_KINEMATIC_KALMAN_DIM][SIMPLE_KINEMATIC_KALMAN_DIM]
covariance matrix
void simple_kinematic_kalman_update_noise(struct SimpleKinematicKalman *kalman, float Q_sigma2, float r)
Update process and measurement noises.
void simple_kinematic_kalman_predict(struct SimpleKinematicKalman *kalman)
Prediction step.
float F[SIMPLE_KINEMATIC_KALMAN_DIM][SIMPLE_KINEMATIC_KALMAN_DIM]
dynamic matrix
float dt
prediction step (in seconds)
void simple_kinematic_kalman_set_state(struct SimpleKinematicKalman *kalman, struct FloatVect3 pos, struct FloatVect3 speed)
Set initial state vector.
void simple_kinematic_kalman_update_pos(struct SimpleKinematicKalman *kalman, struct FloatVect3 pos)
Update step based on each new distance data.
float Hs[SIMPLE_KINEMATIC_KALMAN_DIM/2][SIMPLE_KINEMATIC_KALMAN_DIM]
observation matrix for speed
void simple_kinematic_kalman_init(struct SimpleKinematicKalman *kalman, float P0_pos, float P0_speed, float Q_sigma2, float r, float dt)
Init SimpleKinematicKalman internal struct.
void simple_kinematic_kalman_update_speed(struct SimpleKinematicKalman *kalman, struct FloatVect3 speed, uint8_t type)
Update step based on speed measure.
struct FloatVect3 simple_kinematic_kalman_get_speed(struct SimpleKinematicKalman *kalman)
Get current speed.
static struct SimpleKinematicKalman kalman
Definition: tag_tracking.c:170
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98