Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ekf_range.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 EKF_RANGE_H
27 #define EKF_RANGE_H
28 
29 #include "std.h"
32 
33 #define EKF_RANGE_DIM 6
34 
43 struct EKFRange {
47  float R_dist;
48  float R_speed;
49  float dt;
50 };
51 
62 extern void ekf_range_init(struct EKFRange *ekf_range, float P0_pos, float P0_speed, float Q_sigma2, float R_dist, float R_speed, float dt);
63 
73 extern void ekf_range_set_state(struct EKFRange *ekf_range, struct EnuCoor_f pos, struct EnuCoor_f speed);
74 
81 extern void ekf_range_get_state(struct EKFRange *ekf_range, struct EnuCoor_f *pos, struct EnuCoor_f *speed);
82 
88 extern struct EnuCoor_f ekf_range_get_pos(struct EKFRange *ekf_range);
89 
95 extern struct EnuCoor_f ekf_range_get_speed(struct EKFRange *ekf_range);
96 
104 extern void ekf_range_update_noise(struct EKFRange *ekf_range, float Q_sigma2, float R_dist, float R_speed);
105 
110 extern void ekf_range_predict(struct EKFRange *ekf_range);
111 
118 extern void ekf_range_update_dist(struct EKFRange *ekf_range, float dist, struct EnuCoor_f anchor);
119 
126 extern void ekf_range_update_speed(struct EKFRange *ekf_range, float speed, uint8_t type);
127 
128 
129 #endif
130 
131 
void ekf_range_update_noise(struct EKFRange *ekf_range, float Q_sigma2, float R_dist, float R_speed)
Update process and measurement noises.
Definition: ekf_range.c:93
void ekf_range_set_state(struct EKFRange *ekf_range, struct EnuCoor_f pos, struct EnuCoor_f speed)
Set initial state vector.
Definition: ekf_range.c:55
float state[EKF_RANGE_DIM]
state vector
Definition: ekf_range.h:44
struct EnuCoor_f ekf_range_get_speed(struct EKFRange *ekf_range)
Get current speed.
Definition: ekf_range.c:84
#define EKF_RANGE_DIM
Definition: ekf_range.h:33
float R_dist
measurement noise on distances (assumed the same for all anchors)
Definition: ekf_range.h:47
void ekf_range_update_dist(struct EKFRange *ekf_range, float dist, struct EnuCoor_f anchor)
Update step based on each new distance data.
Definition: ekf_range.c:143
float P[EKF_RANGE_DIM][EKF_RANGE_DIM]
covariance matrix
Definition: ekf_range.h:45
void ekf_range_update_speed(struct EKFRange *ekf_range, float speed, uint8_t type)
Update step based on speed measure.
Definition: ekf_range.c:191
float R_speed
measurement noise on speed (assumed the same for all axis)
Definition: ekf_range.h:48
float Q[EKF_RANGE_DIM][EKF_RANGE_DIM]
process noise matrix
Definition: ekf_range.h:46
float dt
prediction step (in seconds)
Definition: ekf_range.h:49
void ekf_range_get_state(struct EKFRange *ekf_range, struct EnuCoor_f *pos, struct EnuCoor_f *speed)
Get current state.
Definition: ekf_range.c:65
struct EnuCoor_f ekf_range_get_pos(struct EKFRange *ekf_range)
Get current pos.
Definition: ekf_range.c:75
void ekf_range_init(struct EKFRange *ekf_range, float P0_pos, float P0_speed, float Q_sigma2, float R_dist, float R_speed, float dt)
Init EKF_range internal struct.
Definition: ekf_range.c:29
void ekf_range_predict(struct EKFRange *ekf_range)
Prediction step.
Definition: ekf_range.c:119
EKF_range structure.
Definition: ekf_range.h:43
Paparazzi floating point algebra.
Paparazzi floating point math for geodetic calculations.
vector in East North Up coordinates Units: meters
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98