Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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_dist(struct EKFRange *ekf_range, float dist, struct EnuCoor_f anchor)
Update step based on each new distance data.
Definition: ekf_range.c:143
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
float R_dist
measurement noise on distances (assumed the same for all anchors)
Definition: ekf_range.h:47
vector in East North Up coordinates Units: meters
#define EKF_RANGE_DIM
Definition: ekf_range.h:33
Paparazzi floating point math for geodetic calculations.
float Q[EKF_RANGE_DIM][EKF_RANGE_DIM]
process noise matrix
Definition: ekf_range.h:46
void ekf_range_predict(struct EKFRange *ekf_range)
Prediction step.
Definition: ekf_range.c:119
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
Paparazzi floating point algebra.
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
struct EnuCoor_f ekf_range_get_speed(struct EKFRange *ekf_range)
Get current speed.
Definition: ekf_range.c:84
unsigned char uint8_t
Definition: types.h:14
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
float P[EKF_RANGE_DIM][EKF_RANGE_DIM]
covariance matrix
Definition: ekf_range.h:45
float dt
prediction step (in seconds)
Definition: ekf_range.h:49
float R_speed
measurement noise on speed (assumed the same for all axis)
Definition: ekf_range.h:48
EKF_range structure.
Definition: ekf_range.h:43
struct EnuCoor_f ekf_range_get_pos(struct EKFRange *ekf_range)
Get current pos.
Definition: ekf_range.c:75
float state[EKF_RANGE_DIM]
state vector
Definition: ekf_range.h:44
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