-
Notifications
You must be signed in to change notification settings - Fork 0
/
motorcontrol.h
62 lines (44 loc) · 1.18 KB
/
motorcontrol.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "driver.h"
#include "encoder.h"
#ifndef motorcontrol_h
#define motorcontrol_h
class motorController{
private:
driver d;
encoder e;
float Vcc;
float maxRPM;
float maxAngle;
float current_0;
float current_1;
float velocity_0;
float velocity_1;
float position_0;
float position_1;
float filtered_curr_1;
float filtered_curr_0;
float filtered_vel_1;
float filtered_vel_0;
float filtered_pos_1;
float filtered_pos_0;
float Kp_curr;
float Ki_curr;
float Kp_vel;
float Ki_vel;
float Kd_vel;
float Kp_pos;
float Ki_pos;
float Kd_pos;
public:
motorController(int p1, int p2, int p3, int p4, int p5);
void filter_current();
void filter_velocity();
void filter_position();
void refresh();
void init();
void updateState();
void seek_current(float curr_ref, char dir);
void seek_velocity(float vel_ref);
void seek_position(float pos_ref, int max_duty_cycle, bool& exit_variable);
};
#endif