NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
anglerate.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Copyright: collective.
5  * Cleanup: Martin Schröder <mkschreder.uk@gmail.com>
6  * Original source from Cleanflight.
7  *
8  * Ninjaflight is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Ninjaflight is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 
23 #pragma once
24 
35 #define PID_MAX_I 256
36 #define PID_MAX_D 512
37 #define PID_MAX_TOTAL_PID 1000
38 
39 #define GYRO_I_MAX 256 // Gyro I limiter
40 #define YAW_P_LIMIT_MIN 100 // Maximum value for yaw P limiter
41 #define YAW_P_LIMIT_MAX 500 // Maximum value for yaw P limiter
42 
43 #define DTERM_AVERAGE_COUNT 4
44 
45 typedef enum {
57 } pid_index_t;
58 
59 typedef enum {
65 
66 struct pid_config {
67  uint8_t P8[PID_ITEM_COUNT];
68  uint8_t I8[PID_ITEM_COUNT];
69  uint8_t D8[PID_ITEM_COUNT];
70  uint8_t pidController;
71  uint16_t yaw_p_limit;
72  uint16_t dterm_cut_hz;
73 } __attribute__((packed));
74 
Definition: anglerate.h:56
Definition: anglerate.h:61
uint16_t yaw_p_limit
set P term limit (fixed value was 300)
Definition: anglerate.h:71
Definition: anglerate.h:53
uint8_t D8[PID_ITEM_COUNT]
D gains.
Definition: anglerate.h:69
typedef __attribute__
Definition: cli.c:2271
uint16_t dterm_cut_hz
dterm filtering
Definition: anglerate.h:72
Definition: anglerate.h:48
Definition: anglerate.h:60
Definition: anglerate.h:66
Definition: anglerate.h:52
Definition: anglerate.h:63
Definition: anglerate.h:50
Definition: anglerate.h:55
uint8_t pidController
Definition: anglerate.h:70
Definition: anglerate.h:51
pid_controller_type_t
Definition: anglerate.h:59
Definition: anglerate.h:49
Definition: anglerate.h:54
Definition: anglerate.h:62
Definition: anglerate.h:47
Definition: anglerate.h:46
uint8_t I8[PID_ITEM_COUNT]
I gains.
Definition: anglerate.h:68
pid_index_t
Definition: anglerate.h:45
uint8_t P8[PID_ITEM_COUNT]
P gains.
Definition: anglerate.h:67