-
Notifications
You must be signed in to change notification settings - Fork 16
/
control_funcs.c
49 lines (44 loc) · 1.5 KB
/
control_funcs.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* @file control_funcs.c
* @author Danylo Malyuta <[email protected]>
* @version 1.0
*
* @brief Control functions source file.
*
* This file contains functions regarding the control algorithm.
*/
# include <math.h>
# include <string.h>
# include "master_header.h"
# include "control_header.h"
double VALVE__MAX_THRUST=0.36; ///< Maximum thrust of RCS solenoid valves (i.e. when fully opened)
/**
* @fn void Fpitch_loop_control_setup()
* This function setups up all control parameters relating to the pitch control.
*/
void Fpitch_loop_control_setup() {
Fpitch_loop.satur = 0; // We do not use a derivative term in roll rate control
Fpitch_loop.control_range = 0; // We do not use a derivative term in roll rate control
Fpitch_loop.K = 5;
Fpitch_loop.Td = 3;
}
/**
* @fn void Fyaw_loop_control_setup()
* This function sets up all control parameters relating to the yaw control.
*/
void Fyaw_loop_control_setup() {
Fyaw_loop.satur = 0; // We do not use a derivative term in roll rate control
Fyaw_loop.control_range = 0; // We do not use a derivative term in roll rate control
Fyaw_loop.K = 5;
Fyaw_loop.Td = 3;
}
/**
* @fn void Mroll_loop_control_setup()
* This function sets up all control parameters relating to the roll control.
*/
void Mroll_loop_control_setup() {
Mroll_loop.satur = 2*d*VALVE__MAX_THRUST;
Mroll_loop.control_range = 100*M_PI/180; // [rad/s]
Mroll_loop.K = Mroll_loop.satur/Mroll_loop.control_range;
Mroll_loop.Td = 0; // We do not use a derivative term in roll rate control
}