-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathROVMotorController.h
57 lines (45 loc) · 1.19 KB
/
ROVMotorController.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
/*
* Classes for motor controller code
*/
#ifndef ROVMotorController_H
#define ROVMotorController_H
/*
* Class to encapsulate derivied motor settings. Values are floats between -1.0 and 1.0. Sign indicates
* direction.
*/
class ROVMotorSettings
{
public:
const float portMotor;
const float starboardMotor;
const float depthMotor;
ROVMotorSettings(float port, float starboard, float depth) :
portMotor(port), starboardMotor(starboard),depthMotor(depth) {}
};
/*
* Base class for all Motor Controllers
*/
class ROVMotorController {
public:
ROVMotorController() {};
virtual void setMotors(const ROVMotorSettings &settings) = 0;
};
/*
* Simple controller class that simply logs it's settings
*/
class ROVLoggingMotorController : public ROVMotorController {
public:
ROVLoggingMotorController();
virtual void setMotors(const ROVMotorSettings &settings);
};
/*
* Motor controller that uses a TB6612FNG Breakout board
*/
class ROVTB6612FNGMotorController : public ROVMotorController {
public:
ROVTB6612FNGMotorController();
virtual void setMotors(const ROVMotorSettings &settings);
private:
void moveMotor(int motor, float speed);
};
#endif