dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lqg.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 #ifndef LQG_H
31 #define LQG_H
32 
33 #include <pios.h>
34 #include <misc_math.h>
35 
36 #define LQG_SOLVER_FAILED -1
37 #define LQG_SOLVER_RUNNING 0
38 #define LQG_SOLVER_DONE 1
39 
40 typedef struct rtkf_state* rtkf_t;
41 typedef struct lqr_state* lqr_t;
42 
43 typedef struct lqg_state* lqg_t;
44 
45 extern rtkf_t rtkf_create(float beta, float tau, float Ts, float R, float Q1, float Q2, float Q3, float biaslim);
46 extern void rtkf_stabilize_covariance(rtkf_t rtkf, int iterations);
47 extern int rtkf_solver_status(rtkf_t rtkf);
48 
49 extern lqr_t lqr_create(float beta, float tau, float Ts, float q1, float q2, float r);
50 extern void lqr_stabilize_covariance(lqr_t lqr, int iterations);
51 extern int lqr_solver_status(lqr_t lqr);
52 
53 extern void lqr_update(lqr_t lqr, float q1, float q2, float r);
54 extern void lqr_get_gains(lqr_t lqg, float K[2]);
55 
56 extern lqg_t lqg_create(rtkf_t rtkf, lqr_t lqr);
57 extern int lqg_solver_status(lqg_t lqg);
58 extern lqr_t lqg_get_lqr(lqg_t lqg);
59 extern rtkf_t lqg_get_rtkf(lqg_t lqg);
60 
61 extern void lqg_run_covariance(lqg_t lqg, int iter);
62 
63 extern float lqg_controller(lqg_t lqg, float signal, float setpoint);
64 
65 extern void lqg_set_x0(lqg_t lqq, float x0);
66 void lqg_get_rtkf_state(lqg_t lqg, float *rate, float *torque, float *bias);
67 
68 #endif // LQG_H
69 
Main PiOS header to include all the compiled in PiOS options.
struct lqg_state * lqg_t
Definition: lqg.h:43
rtkf_t lqg_get_rtkf(lqg_t lqg)
Definition: lqg.c:571
void rtkf_stabilize_covariance(rtkf_t rtkf, int iterations)
Definition: lqg.c:195
float R[NUMV]
Definition: insgps14state.c:67
struct rtkf_state * rtkf_t
Definition: lqg.h:40
lqg_t lqg_create(rtkf_t rtkf, lqr_t lqr)
Definition: lqg.c:535
void lqr_get_gains(lqr_t lqr, float K[2])
Definition: lqg.c:487
struct lqr_state * lqr_t
Definition: lqg.h:41
lqr_t lqg_get_lqr(lqg_t lqg)
Definition: lqg.c:576
void lqg_set_x0(lqg_t lqg, float x0)
Definition: lqg.c:557
struct rtkf_state * rtkf
Definition: lqg.c:500
void lqr_update(lqr_t lqr, float q1, float q2, float r)
Definition: lqg.c:477
void lqr_stabilize_covariance(lqr_t lqr, int iterations)
Definition: lqg.c:405
Definition: lqg.c:495
struct lqr_state * lqr
Definition: lqg.c:499
int rtkf_solver_status(rtkf_t rtkf)
Definition: lqg.c:290
void lqg_run_covariance(lqg_t lqg, int iter)
Definition: lqg.c:581
void lqg_get_rtkf_state(lqg_t lqg, float *rate, float *torque, float *bias)
Definition: lqg.c:550
uint8_t rate
Definition: msp_messages.h:99
lqr_t lqr_create(float beta, float tau, float Ts, float q1, float q2, float r)
Definition: lqg.c:460
rtkf_t rtkf_create(float beta, float tau, float Ts, float R, float q1, float q2, float q3, float biaslim)
Definition: lqg.c:274
Definition: lqg.c:370
float lqg_controller(lqg_t lqg, float signal, float setpoint)
Definition: lqg.c:516
float K[NUMX][NUMV]
Definition: insgps14state.c:68
int lqr_solver_status(lqr_t lqr)
Definition: lqg.c:424
int lqg_solver_status(lqg_t lqg)
Definition: lqg.c:564