|
GKD.RoboCtrl
RoboMaster Linux 电控:异步 IO、设备驱动与机器人控制
|
PID 控制器基础模板。 更多...
PID 控制器基础模板。
| T | 计算类型 |
| error_measurer | 误差测度函数 |
#include <pid.h>

类 | |
| struct | params_type |
| 统一的参数封装,方便序列化。 更多... | |
Public 类型 | |
| using | input_type = T |
| using | state_type = T |
Public 成员函数 | |
| pid_base (const params_type ¶ms) | |
| void | set_target (T target) |
| 设置期望目标。 | |
| T | target () const |
| void | update (T current, T dt) |
| 根据当前值和采样周期更新 PID 输出。 | |
| void | update (T current) |
| void | update (T target, T current, T dt) |
| 同时设置目标并根据当前值更新输出。 | |
| void | clean () |
| 清空积分项、误差缓存与输出。 | |
| T | state () const |
| 获取最新的控制输出。 | |
Public 属性 | |
| T | kp = 0 |
| T | ki = 0 |
| T | kd = 0 |
| T | max_out {} |
| T | max_iout {} |
| using roboctrl::utils::pid_base< T, error_measurer >::input_type = T |
| using roboctrl::utils::pid_base< T, error_measurer >::state_type = T |
|
inline |
|
inline |
清空积分项、误差缓存与输出。
被这些函数引用 roboctrl::device::dji_motor::disable(), roboctrl::device::m9025::disable(), roboctrl::device::dji_motor::set(), roboctrl::device::dji_motor::set_angle_speed(), roboctrl::device::m9025::set_angle_speed(), roboctrl::device::dji_motor::set_current(), roboctrl::device::m9025::set_current() , 以及 roboctrl::device::dji_motor::set_enabled().
|
inline |
|
inline |
|
inline |
|
inline |
Legacy update preserving the historical per-call PID behavior.
引用了 roboctrl::utils::pid_base< T, error_measurer >::update().
被这些函数引用 roboctrl::utils::pid_base< T, error_measurer >::update().
|
inline |
根据当前值和采样周期更新 PID 输出。
与传统 RM 风格 PID(error[0]/error[1] 差分)保持兼容:
被这些函数引用 roboctrl::device::gkd_sentry_gimbal::update() , 以及 roboctrl::utils::pid_base< T, error_measurer >::update().
|
inline |
同时设置目标并根据当前值更新输出。
| target | 本次控制的目标值 |
| current | 当前反馈值 |
| dt | 采样周期,单位为秒 |
引用了 roboctrl::utils::pid_base< T, error_measurer >::set_target() , 以及 roboctrl::utils::pid_base< T, error_measurer >::update().
| T roboctrl::utils::pid_base< T, error_measurer >::kd = 0 |
| T roboctrl::utils::pid_base< T, error_measurer >::ki = 0 |
| T roboctrl::utils::pid_base< T, error_measurer >::kp = 0 |
| T roboctrl::utils::pid_base< T, error_measurer >::max_iout {} |
| T roboctrl::utils::pid_base< T, error_measurer >::max_out {} |