R2R
PositionControl.h
Go to the documentation of this file.
1 
13 #ifndef POSITION_CONTROL_H_
14 #define POSITION_CONTROL_H_
15 
16 typedef struct {
17  int Enew;
18  int Eold;
19  int Eint;
20  int Edot;
21  int desired;
22  int actual;
23  int raw;
24  int u;
25 } control_error; // Define data structure containing control data
26 
33 extern void MotorTimerInit(void);
34 
41 extern void Timer1IntHandler(void);
42 
49 void set_position_gains(void);
50 
57 void get_position_gains(void);
58 
65 int get_desired_angle(int motor);
66 
73 void set_desired_angle(int angle, int motor);
74 
81 void reset_pos(void);
82 
89 void reset_controller_error(void);
90 
91 
98 void load_position_trajectory(int motor);
99 
108 void PID_Controller(int reference, int actual, int motor);
109 
125 int decog_motor(int x, int motor);
126 
134 void setDecogging(void);
135 
136 #endif /* POSITION_CONTROL_H_ */
void reset_controller_error(void)
Resets controller error on both controllers to be zero.
Definition: PositionControl.c:229
int get_desired_angle(int motor)
Gets desired angle for a given motor.
Definition: PositionControl.c:98
void set_position_gains(void)
Sets position gains on the Tiva microcontroller by reading from UART.
Definition: PositionControl.c:68
void get_position_gains(void)
Gets position gains on the Tiva microcontroller by reading to UART.
Definition: PositionControl.c:57
void MotorTimerInit(void)
This function sets up the timer interrupt for position control.
Definition: PositionControl.c:41
void PID_Controller(int reference, int actual, int motor)
Calculates pwm to send to the motor drivr.
Definition: PositionControl.c:192
Definition: PositionControl.h:16
void setDecogging(void)
Turn on/off decogging by setting global variable.
Definition: PositionControl.c:257
int actual
Definition: PositionControl.h:22
int u
Definition: PositionControl.h:24
int Edot
Definition: PositionControl.h:20
int desired
Definition: PositionControl.h:21
int decog_motor(int x, int motor)
Motor decogging to smooth output of motor.
Definition: PositionControl.c:242
int Eint
Definition: PositionControl.h:19
int Enew
Definition: PositionControl.h:17
void load_position_trajectory(int motor)
Loads position trajectory for a given motor over UART.
Definition: PositionControl.c:113
int raw
Definition: PositionControl.h:23
void reset_pos(void)
Resets desired position to 0 counts.
int Eold
Definition: PositionControl.h:18
void set_desired_angle(int angle, int motor)
Sets desired angle for a given motor.
Definition: PositionControl.c:84
void Timer1IntHandler(void)
The interrupt handler for position control.
Definition: PositionControl.c:128