-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathROVNunchukController.h
47 lines (37 loc) · 1.17 KB
/
ROVNunchukController.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
/*
* Class to manage a Wii Nunchuk as an ROV Control head
*/
#ifndef ROVNunchukContoller_H
#define ROVNunchukContoller_H
#include <ArduinoNunchuk.h>
#include "ROVMotorController.h"
/*
* Base class to encapsulate the algorithm that converts current Nunchuk settigns
* to ROVMotorSettings.
*/
class ROVControlAlgorithm {
public:
ROVControlAlgorithm() {};
virtual ROVMotorSettings motorSettings(ArduinoNunchuk &nunchuk) = 0;
};
/*
* Class to manage the conversion of the current Nunchuk state into ROVMotorSettings using the
* current ROVControlAlgorithm.
*/
class ROVNunchukController
{
public:
ROVNunchukController(ROVControlAlgorithm &algorithm);
/* Should be called once when the Nunchuk is at rest to get the center states */
void initialize();
/* Set the current Control Algorithm */
void setControlAlgorithm(ROVControlAlgorithm &algorithm);
/* Should be called in loop(). Returns the correct ROVMotorSettings for the current state of the
* Nunchuk and the current ROVControlAlgorithm
*/
ROVMotorSettings motorSettings();
private:
ArduinoNunchuk m_arduinoNunchuk;
ROVControlAlgorithm &m_rovControlAlgorithm;
};
#endif