BangBangControllerによるバンバン制御

バンバン制御 アルゴリズムとは、オン(測定値が設定値以下の場合)とオフ(それ以外の場合)の2つの状態のみを使用する制御戦略です。これは無限ゲインを持つ比例動作のループとほぼ同じです。

PIDループはゲインが大きくなるにつれて不安定になることが知られており、実際、高慣性メカニズムの速度制御以外にバンバンコントローラーを使うのは 最悪の考えです

しかし、(シューターのフライホイールのように)負荷が変化する高慣性メカニズムの速度を制御する場合、バンバンコントローラは比例コントローラよりも回復時間が速く、その結果、より良い/より一貫したパフォーマンスを得ることができます。 通常のPループとは異なり、バンバンコントローラは*非対称*です。つまり、プロセス変数が設定値を下回ったときにコントローラがオンになり、それ以外は何もしません。 これにより、制御ループが結果として生じるオーバーシュートを修正しようとするため、破壊的な振動のリスクを冒すことなく、順方向の制御努力を可能な限り大きくすることができます。

Asymmetric bang-bang control is provided in WPILib by the BangBangController class (Java, C++, Python).

BangBangControllerの作成

バンバンコントローラーはゲインを持たないので、コンストラクタの引数は不要です (atSetpoint が使用するコントローラーの許容誤差をオプションで指定できますが、必須ではないです)。

// Creates a BangBangController
BangBangController controller = new BangBangController();
// Creates a BangBangController
frc::BangBangController controller;
from wpimath.controller import BangBangController
  # Creates a BangBangController
controller = BangBangController()

BangBangControllerの使用

警告

バンバンコントロールは、安定性を維持するために応答の非対称性に依存する極めてアグレッシブなアルゴリズムです。 バンバンコントローラーでモーターを制御しようとする前に、モーターコントローラーが "coast mode" に設定されていることを 絶対に 確認してください。

バンバンコントローラーを使うのは簡単です:

// Controls a motor with the output of the BangBang controller
motor.set(controller.calculate(encoder.getRate(), setpoint));
// Controls a motor with the output of the BangBang controller
motor.Set(controller.Calculate(encoder.GetRate(), setpoint));
# Controls a motor with the output of the BangBang controller
motor.set(controller.calculate(encoder.getRate(), setpoint))

バンバン制御とフィードフォワードの組み合わせ

PIDコントローラと同様に、システム出力を所望の速度で維持するために必要な電圧を供給する フィードフォワード コントローラーと組み合わせることで、最良の結果が得られます。しかし、バンバンコントローラーは 前進方向にしか修正できない ので、シューターがオーバースピードにならないようにするためには、少し控えめなフィードフォワード推定を使う方が望ましいかもしれません。

// Controls a motor with the output of the BangBang controller and a feedforward
// Shrinks the feedforward slightly to avoid overspeeding the shooter
motor.setVoltage(controller.calculate(encoder.getRate(), setpoint) * 12.0 + 0.9 * feedforward.calculate(setpoint));
// Controls a motor with the output of the BangBang controller and a feedforward
// Shrinks the feedforward slightly to avoid overspeeding the shooter
motor.SetVoltage(controller.Calculate(encoder.GetRate(), setpoint) * 12.0 + 0.9 * feedforward.Calculate(setpoint));
# Controls a motor with the output of the BangBang controller and a feedforward
motor.setVoltage(controller.calculate(encoder.getRate(), setpoint) * 12.0 + 0.9 * feedforward.calculate(setpoint))