etrobocon2019 feat.KatLab  ece30a9a007fff7d3ad48592c0d09a74643377bb
Navigator.h
[詳解]
1 
8 #ifndef NAVIGATOR_H
9 #define NAVIGATOR_H
10 
11 #include "Controller.h"
12 #include "Distance.h"
13 #include "Pid.h"
14 #include "SpeedControl.h"
15 #include "Rotation.h"
16 #include <cmath>
17 
18 class Navigator {
19  public:
29  explicit Navigator(Controller& controller_, double Kp_ = 0.60, double Ki_ = 0.0,
30  double Kd_ = 0.0);
31 
39  void setPidGain(double Kp, double Ki, double Kd);
40 
50  void move(double specifiedDistance, int pwm = 30, const double pGain = 0.0);
51 
60  void moveAtSpecifiedSpeed(double specifiedDistance, int specifiedSpeed);
61 
69  void moveToSpecifiedColor(Color specifiedColor, int pwm = 30);
70 
77  void spin(double angle, bool clockwise = true, int pwm = 10);
78 
79  private:
80  Distance distance;
81  Controller& controller;
82  PidGain pidForSpeed;
90  bool hasArrived(double goalDistance, bool isForward);
97  void setPwmValue(int pwm, double alpha = 0.0);
98 };
99 
100 #endif
自転(yawing)したときの角度を求めるクラス
走行距離を計算するクラス
void spin(double angle, bool clockwise=true, int pwm=10)
走行体を回頭させる(yawing)
Definition: Navigator.cpp:97
PID制御クラス
Navigator(Controller &controller_, double Kp_=0.60, double Ki_=0.0, double Kd_=0.0)
Navigatorクラスのコンストラクタ
Definition: Navigator.cpp:10
void moveToSpecifiedColor(Color specifiedColor, int pwm=30)
Definition: Navigator.cpp:74
void moveAtSpecifiedSpeed(double specifiedDistance, int specifiedSpeed)
specifiedDistanceとSpeedControl.calculateSpeedから戻ってきたPWMをmoveに渡す
Definition: Navigator.cpp:47
void move(double specifiedDistance, int pwm=30, const double pGain=0.0)
specifiedDistanceの値でbackwardかforwardを呼び出す。
Definition: Navigator.cpp:20
前進値制御クラス
Definition: Pid.h:10
void setPidGain(double Kp, double Ki, double Kd)
SpeedControl用のPidゲインのセッター
Definition: Navigator.cpp:15
Color
Definition: Controller.h:32