etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
公開メンバ関数 | 全メンバ一覧
TurnControl クラス

#include <TurnControl.h>

TurnControl の継承関係図
Inheritance graph
TurnControl 連携図
Collaboration graph

公開メンバ関数

 TurnControl ()
 
std::int8_t calculateTurnForPid (std::int8_t forward, std::int16_t light_value)
 
- 基底クラス Pid に属する継承公開メンバ関数
 Pid (double p_gain_, double i_gain_, double d_gain_, double target_)
 
 Pid (double p_gain_, double i_gain_, double d_gain_, double diff_, double integral_, double target_, double output_)
 
void setPid (double p_gain_, double i_gain_, double d_gain_, double target_)
 

その他の継承メンバ

- 基底クラス Pid に属する継承限定公開メンバ関数
void calculate (double light_value)
 
double get_output ()
 
double limitOutput (double pid_value)
 

詳解

PID制御によるターン制御クラス

TurnControl.h16 行目に定義があります。

構築子と解体子

TurnControl::TurnControl ( )

コンストラクタ

TurnControl.cpp9 行目に定義があります。

9 : Pid(0.8, 1.2, 0.012, 30.0), turn(0.0), filter() {}
Pid(double p_gain_, double i_gain_, double d_gain_, double target_)
Definition: Pid.cpp:4

関数詳解

std::int8_t TurnControl::calculateTurnForPid ( std::int8_t  forward,
std::int16_t  light_value 
)

ターン制御をするためのターン値(turn)を計算する

戻り値
ターン値(turn)

TurnControl.cpp11 行目に定義があります。

12 {
13  calculate(static_cast<double>(filter.sensor(light_value)));
14  double pid_value = get_output();
15  double forward_percent = ((double)forward) / 100.0;
16  pid_value *= forward_percent;
17  turn += (pid_value - pid_value_old) / 2;
18  pid_value_old = pid_value;
19  return static_cast<std::int8_t>(limitOutput(turn));
20 }
double get_output()
Definition: Pid.cpp:32
void calculate(double light_value)
Definition: Pid.cpp:19
float sensor(std::int32_t current_sensor)
現在のセンサ値にフィルタ処理を実行する
Definition: LPF.cpp:9
double limitOutput(double pid_value)
Definition: Pid.cpp:46

呼び出し関係図:

被呼び出し関係図:


このクラス詳解は次のファイルから抽出されました: