-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.h
More file actions
134 lines (112 loc) · 2.91 KB
/
Controller.h
File metadata and controls
134 lines (112 loc) · 2.91 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**
* @file Controller.h
* @brief モーター制御に用いる関数をまとめたラッパークラス
* @author nishijima515
*/
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include "Motor.h"
class Controller {
public:
/** Power値の上限 */
static constexpr int MOTOR_POWER_MAX = 100;
/** Power値の下限 */
static constexpr int MOTOR_POWER_MIN = -100;
/**
* コンストラクタ
*/
Controller();
/**
* @brief タイヤのモータにPower値をセット
* @param power Power値
*/
void setRightMotorPower(const int power);
void setLeftMotorPower(const int power);
/**
* @brief タイヤのモータのpower値をリセット
*/
void resetRightMotorPower();
void resetLeftMotorPower();
void resetWheelsMotorPower();
/**
* @brief タイヤのモータに回転速度をセット
* @param speed 回転速度
*/
void setRightMotorSpeed(const int speed);
void setLeftMotorSpeed(const int speed);
/**
* @brief タイヤのモータを停止する
*/
void stopWheelsMotor();
/**
* @brief ブレーキをかけてタイヤのモータを停止する
*/
void brakeWheelsMotor();
/**
* @brief アームのモータにpower値をセット
* @param power power値
*/
void setArmMotorPower(const int power);
/**
* @brief アームのモータのpower値をリセット
*/
void resetArmMotorPower();
/**
* @brief アームのモータを停止する
*/
void stopArmMotor();
/**
* アームモータを止めて角度を維持する
* @return -
*/
void holdArmMotor();
/**
* @brief 右モータの角位置を取得する
* @return 右モータの角位置
*/
int32_t getRightCount();
/**
* @brief 左モータの角位置を取得する
* @return 左モータの角位置
*/
int32_t getLeftCount();
/**
* @brief アームモータの角位置を取得する
* @return アームモータの角位置
*/
int32_t getArmMotorCount();
/**
* @brief 右タイヤのpower値を取得する
* @return 右タイヤのpower値
*/
int getRightMotorPower();
/**
* @brief 左タイヤのpower値を取得する
* @return 左タイヤのpower値
*/
int getLeftMotorPower();
/**
* @brief 右タイヤの回転速度を取得する
* @return 右タイヤの回転速度
*/
int getRightMotorSpeed();
/**
* @brief 左タイヤの回転速度を取得する
* @return 左タイヤの回転速度
*/
int getLeftMotorSpeed();
private:
Motor rightWheel;
Motor leftWheel;
Motor armMotor;
static int powerOfRightWheel; // 右タイヤpower
static int powerOfLeftWheel; // 左タイヤpower
static int powerOfArm; // アームpower
/**
* @brief モータに設定するpower値の制限
* @param inputpower 入力されたpower値
* @return 制限されたpower値
*/
int limitPowerValue(const int inputPower);
};
#endif