Chassis v2.1.1
Chassisはロボコンでの足回り制御を行うためのC++ライブラリである。
Loading...
Searching...
No Matches
ChassisPid.h
Go to the documentation of this file.
1#ifndef RCT_CHASSIS_PID_H_
2#define RCT_CHASSIS_PID_H_
7#include <CoordinateUnit.h>
8#include <Pid.h>
9
10#include <chrono>
11#include <cmath>
12#include <cstdint>
13#include <utility>
14
15namespace rct {
16
19
22template<class T>
23struct ChassisPid {
28 template<class F>
29 ChassisPid(F&& f, const PidGain& vel_gain) : t_{std::forward<F>(f)}, vel_pid_{vel_gain} {}
30
32 void pid_move(const Velocity& tag_vel, const Velocity& now_vel, const std::chrono::microseconds& delta_time,
33 const float offset_rad = {}) {
34 const auto out_vel = vel_pid_.calc(tag_vel, now_vel, delta_time);
36 }
37
38 auto move(const Velocity& vel, const float offset_rad = {}) {
39 t_.move(vel, offset_rad);
40 }
41
42 auto refresh() {
43 return vel_pid_.refresh();
44 }
45
46 private:
47 T t_;
48 Pid<Velocity> vel_pid_;
49};
50
52
53} // namespace rct
54
55#endif // RCT_CHASSIS_PID_H_
座標、速度を表す構造体 CoordinateUnit を提供する。
PID制御を行う Pid クラスを提供する。
CoordinateUnit<-1 > Velocity
速度を示す構造体
robot control library
Definition Chassis.h:16
足回りの速度のPID制御を行う。
Definition ChassisPid.h:23
void pid_move(const Velocity &tag_vel, const Velocity &now_vel, const std::chrono::microseconds &delta_time, const float offset_rad={})
手動操縦用。速度のPID制御を行い、出力をT型のcalcに渡す
Definition ChassisPid.h:32
ChassisPid(F &&f, const PidGain &vel_gain)
コンストラクタ。T型をfで初期化し、変位と速度のPIDゲインをセットする。
Definition ChassisPid.h:29
N輪オムニの制御を行うクラス。
Definition Omni.h:25
void move(const Velocity &vel, const float offset_rad=0.0)
モータへのPWM出力を計算する。その後callback関数にPWM出力を渡す。
Definition Omni.h:43
PID制御のゲイン
Definition Pid.h:21