ARCS6 AR6-REV.24062600
読み取り中…
検索中…
一致する文字列を見つけられません
P-Dcontroller.hh
1
8//
9// Copyright (C) 2011-2022 Yokokura, Yuki
10// This program is free software;
11// you can redistribute it and/or modify it under the terms of the FreeBSD License.
12// For details, see the License.txt file.
13
14#ifndef P_DCONTROLLER
15#define P_DCONTROLLER
16
17#include <cassert>
19
20// ARCS組込み用マクロ
21#ifdef ARCS_IN
22 // ARCSに組み込まれる場合
23 #include "ARCSassert.hh"
24 #include "ARCSeventlog.hh"
25#else
26 // ARCSに組み込まれない場合
27 #define arcs_assert(a) (assert(a))
28 #define PassedLog()
29 #define EventLog(a)
30 #define EventLogVar(a)
31#endif
32
33namespace ARCS { // ARCS名前空間
36template <size_t W = 4>
38 public:
41 : Diff(), Kp(0), Kd(0)
42 {
43
44 }
45
49 P_Dcontroller(const double Pgain, const double Dgain)
50 : Diff(), Kp(Pgain), Kd(Dgain)
51 {
52 EventLogVar(Kp);
53 EventLogVar(Kd);
54 }
55
59 : Diff(r.Diff), Kp(r.Kp), Kd(r.Kd)
60 {
61
62 }
63
66
67 }
68
75 double GetSignal(const double ref, const double res, const double time){
76 return (ref - res)*Kp - Diff.GetSignal(res, time)*Kd;
77 }
78
81 void SetPgain(const double Pgain){
82 Kp = Pgain;
83 }
84
87 void SetDgain(const double Dgain){
88 Kd = Dgain;
89 }
90
94 void SetPDgain(const double Pgain, const double Dgain){
95 SetPgain(Pgain);
96 SetDgain(Dgain);
97 }
98
99 private:
100 P_Dcontroller(const P_Dcontroller&) = delete;
101 const P_Dcontroller& operator=(const P_Dcontroller&) = delete;
103 double Kp;
104 double Kd;
105};
106}
107
108#endif
109
ARCS イベントログクラス
#define EventLogVar(a)
変数用イベントログマクロ a : 表示する変数
Definition ARCSeventlog.hh:28
ARCS用ASSERTクラス
移動微分器
Definition MovingDifferentiator.hh:38
P-D制御器クラス(微分先行型)
Definition P-Dcontroller.hh:37
void SetDgain(const double Dgain)
Dゲインを設定する関数
Definition P-Dcontroller.hh:87
double GetSignal(const double ref, const double res, const double time)
P-D制御器の出力信号を取得する関数 y = (ref - res)*Kp - d(res)/d(time)*Kd
Definition P-Dcontroller.hh:75
void SetPDgain(const double Pgain, const double Dgain)
PゲインとDゲインを設定する関数
Definition P-Dcontroller.hh:94
P_Dcontroller(void)
空コンストラクタ
Definition P-Dcontroller.hh:40
P_Dcontroller(P_Dcontroller &&r)
ムーブコンストラクタ
Definition P-Dcontroller.hh:58
P_Dcontroller(const double Pgain, const double Dgain)
コンストラクタ
Definition P-Dcontroller.hh:49
~P_Dcontroller()
デストラクタ
Definition P-Dcontroller.hh:65
void SetPgain(const double Pgain)
Pゲインを設定する関数
Definition P-Dcontroller.hh:81