Added one task
Dependencies: mbed
Robot/inc/pid.h@0:fb4269aa5fb4, 2017-05-26 (annotated)
- Committer:
- PicYusuke
- Date:
- Fri May 26 03:51:19 2017 +0000
- Revision:
- 0:fb4269aa5fb4
hoge
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
PicYusuke | 0:fb4269aa5fb4 | 1 | /* |
PicYusuke | 0:fb4269aa5fb4 | 2 | * File: pid.h |
PicYusuke | 0:fb4269aa5fb4 | 3 | * Author: Owner |
PicYusuke | 0:fb4269aa5fb4 | 4 | * |
PicYusuke | 0:fb4269aa5fb4 | 5 | * Created on 2016/02/29, 1:12 |
PicYusuke | 0:fb4269aa5fb4 | 6 | */ |
PicYusuke | 0:fb4269aa5fb4 | 7 | |
PicYusuke | 0:fb4269aa5fb4 | 8 | #ifndef PID_H |
PicYusuke | 0:fb4269aa5fb4 | 9 | #define PID_H |
PicYusuke | 0:fb4269aa5fb4 | 10 | |
PicYusuke | 0:fb4269aa5fb4 | 11 | #include <stdint.h> |
PicYusuke | 0:fb4269aa5fb4 | 12 | |
PicYusuke | 0:fb4269aa5fb4 | 13 | #define PID_CONTROL_ENABLE 1 |
PicYusuke | 0:fb4269aa5fb4 | 14 | #define PID_CONTROL_DISABLE 0 |
PicYusuke | 0:fb4269aa5fb4 | 15 | |
PicYusuke | 0:fb4269aa5fb4 | 16 | typedef struct{ |
PicYusuke | 0:fb4269aa5fb4 | 17 | |
PicYusuke | 0:fb4269aa5fb4 | 18 | float kp; |
PicYusuke | 0:fb4269aa5fb4 | 19 | float kd; |
PicYusuke | 0:fb4269aa5fb4 | 20 | float ki; |
PicYusuke | 0:fb4269aa5fb4 | 21 | float diff[2]; |
PicYusuke | 0:fb4269aa5fb4 | 22 | float i_term; |
PicYusuke | 0:fb4269aa5fb4 | 23 | |
PicYusuke | 0:fb4269aa5fb4 | 24 | uint32_t is_enabled; |
PicYusuke | 0:fb4269aa5fb4 | 25 | uint32_t is_initialized; |
PicYusuke | 0:fb4269aa5fb4 | 26 | |
PicYusuke | 0:fb4269aa5fb4 | 27 | } PID_Struct; |
PicYusuke | 0:fb4269aa5fb4 | 28 | |
PicYusuke | 0:fb4269aa5fb4 | 29 | void PID_Struct_Init(PID_Struct *, float, float, float); |
PicYusuke | 0:fb4269aa5fb4 | 30 | void PID_Enable_Control(PID_Struct *); |
PicYusuke | 0:fb4269aa5fb4 | 31 | void PID_Disable_Control(PID_Struct *); |
PicYusuke | 0:fb4269aa5fb4 | 32 | uint32_t PID_Check_Status(PID_Struct *); |
PicYusuke | 0:fb4269aa5fb4 | 33 | float PID_Control(PID_Struct *, float, float); |
PicYusuke | 0:fb4269aa5fb4 | 34 | float PD_Control(PID_Struct *, float, float); |
PicYusuke | 0:fb4269aa5fb4 | 35 | float PI_Control(PID_Struct *, float, float); |
PicYusuke | 0:fb4269aa5fb4 | 36 | |
PicYusuke | 0:fb4269aa5fb4 | 37 | #endif /* PID_H */ |
PicYusuke | 0:fb4269aa5fb4 | 38 |