Chassis v2.1.1
Chassisはロボコンでの足回り制御を行うためのC++ライブラリである。
Loading...
Searching...
No Matches
rct::Pid< T > Struct Template Reference

T型のPID制御を行うクラス。 More...

#include <Pid.h>

Public Member Functions

 Pid (const PidGain &pid_gain, const T &init=T{}) noexcept(noexcept(T{}))
 コンストラクタ。ゲインをセットする。
 
T calc (const T &dst, const T &now, const std::chrono::microseconds &delta_time)
 目標値、現在値、経過時間からPID制御の計算を行う。
 
void refresh (const T &init=T{}) noexcept(noexcept(T{}))
 I値をリセットする。
 
void set_pid_gain (const PidGain &pid_gain) noexcept(noexcept(refresh()))
 ゲインをセットし、refreshを呼び出す。
 

Detailed Description

template<class T>
struct rct::Pid< T >

T型のPID制御を行うクラス。

Template Parameters
TPID制御可能な型であること。(T型同士の加減算とfloat型との乗除が定義されていること。)is_pidableで判定可能。

Definition at line 53 of file Pid.h.

Constructor & Destructor Documentation

◆ Pid()

template<class T >
rct::Pid< T >::Pid ( const PidGain pid_gain,
const T init = T{} 
)
noexcept

コンストラクタ。ゲインをセットする。

Parameters
pid_gainPID制御のゲイン
init初期値

Definition at line 59 of file Pid.h.

Member Function Documentation

◆ calc()

template<class T >
T rct::Pid< T >::calc ( const T dst,
const T now,
const std::chrono::microseconds &  delta_time 
)

目標値、現在値、経過時間からPID制御の計算を行う。

Parameters
dst目標値
now現在値
delta_time前回呼び出しからの経過時間
Returns
T型 PIDの結果を返す。

Definition at line 66 of file Pid.h.

◆ refresh()

template<class T >
void rct::Pid< T >::refresh ( const T init = T{})
noexcept

I値をリセットする。

Definition at line 76 of file Pid.h.

◆ set_pid_gain()

template<class T >
void rct::Pid< T >::set_pid_gain ( const PidGain pid_gain)
noexcept

ゲインをセットし、refreshを呼び出す。

Parameters
pid_gainPID制御のゲイン

Definition at line 83 of file Pid.h.


The documentation for this struct was generated from the following file: