MicroMouse Control Module  v1.3.2-2-ge2c6882
クラス | 公開メンバ関数 | 静的公開メンバ関数 | 静的公開変数類 | 限定公開変数類 | 全メンバ一覧
ctrl::TrajectoryTracker クラス

独立2輪車の軌道追従フィードバック制御器 [詳解]

#include <trajectory_tracker.h>

ctrl::TrajectoryTracker 連携図
Collaboration graph
[凡例]

クラス

struct  Gain
 フィードバックゲインを格納する構造体 [詳解]
 
struct  Result
 計算結果を格納する構造体 [詳解]
 

公開メンバ関数

 TrajectoryTracker (const Gain &gain, const float xi_threshold=kXiThresholdDefault)
 コンストラクタ [詳解]
 
void reset (const float vs=0)
 状態の初期化 [詳解]
 
const Result update (const Pose &est_q, const Polar &est_v, const Polar &est_a, const State &ref_s, const float Ts=kIntegrationPeriodDefault)
 制御入力の計算 [詳解]
 
const Result update (const Pose &est_q, const Polar &est_v, const Polar &est_a, const Pose &ref_q, const Pose &ref_dq, const Pose &ref_ddq, const Pose &ref_dddq, const float Ts=kIntegrationPeriodDefault)
 制御入力の計算 [詳解]
 

静的公開メンバ関数

static constexpr float sinc (const float x)
 自作の sinc 関数 sinc(x) := sin(x) / x [詳解]
 

静的公開変数類

static constexpr const float kIntegrationPeriodDefault = 1e-3f
 制御周期(積分周期)のデフォルト値 [s] [詳解]
 
static constexpr const float kXiThresholdDefault = 150.0f
 制御則の切り替え閾値のデフォルト値 [mm/s] [詳解]
 

限定公開変数類

Gain gain
 フィードバックゲイン [詳解]
 
float xi
 補助状態変数 [詳解]
 
float xi_threshold
 制御則を切り替える閾値 [詳解]
 

詳解

独立2輪車の軌道追従フィードバック制御器

構築子と解体子

◆ TrajectoryTracker()

ctrl::TrajectoryTracker::TrajectoryTracker ( const Gain gain,
const float  xi_threshold = kXiThresholdDefault 
)
inline

コンストラクタ

引数
[in]gain軌道追従フィードバックゲイン
[in]xi_threshold制御則を切り替える閾値
float xi_threshold
制御則を切り替える閾値
Definition: trajectory_tracker.h:185
Gain gain
フィードバックゲイン
Definition: trajectory_tracker.h:183

関数詳解

◆ reset()

void ctrl::TrajectoryTracker::reset ( const float  vs = 0)
inline

状態の初期化

引数
[in]vs初期並進速度
79 { xi = vs; }
float xi
補助状態変数
Definition: trajectory_tracker.h:184

◆ sinc()

static constexpr float ctrl::TrajectoryTracker::sinc ( const float  x)
inlinestaticconstexpr

自作の sinc 関数 sinc(x) := sin(x) / x

引数
[in]x
戻り値
sinc(x)
58  {
59  const auto xx = x * x;
60  const auto xxxx = xx * xx;
61  return xxxx * xxxx / 362880 - xxxx * xx / 5040 + xxxx / 120 - xx / 6 + 1;
62  }

◆ update() [1/2]

const Result ctrl::TrajectoryTracker::update ( const Pose est_q,
const Polar est_v,
const Polar est_a,
const Pose ref_q,
const Pose ref_dq,
const Pose ref_ddq,
const Pose ref_dddq,
const float  Ts = kIntegrationPeriodDefault 
)
inline

制御入力の計算

引数
[in]est_q推定位置
[in]est_v推定速度
[in]est_a推定加速度
[in]ref_q目標位置
[in]ref_dq目標速度
[in]ref_ddq目標加速度
[in]ref_dddq目標躍度
[in]Ts制御周期
戻り値
u 制御入力
112  {
113  /* Prepare Variable */
114  const float x = est_q.x;
115  const float y = est_q.y;
116  const float theta = est_q.th;
117  const float cos_theta = std::cos(theta);
118  const float sin_theta = std::sin(theta);
119  const float dx = est_v.tra * cos_theta;
120  const float dy = est_v.tra * sin_theta;
121  const float ddx = est_a.tra * cos_theta;
122  const float ddy = est_a.tra * sin_theta;
123  /* Feedback Gain Design */
124  const float zeta = gain.zeta;
125  const float omega_n = gain.omega_n;
126  const float kx = omega_n * omega_n;
127  const float kdx = 2 * zeta * omega_n;
128  const float ky = kx;
129  const float kdy = kdx;
130  /* Determine Reference */
131  const float dddx_r = ref_dddq.x;
132  const float dddy_r = ref_dddq.y;
133  const float ddx_r = ref_ddq.x;
134  const float ddy_r = ref_ddq.y;
135  const float dx_r = ref_dq.x;
136  const float dy_r = ref_dq.y;
137  const float x_r = ref_q.x;
138  const float y_r = ref_q.y;
139  const float th_r = ref_q.th;
140  const float cos_th_r = std::cos(th_r);
141  const float sin_th_r = std::sin(th_r);
142  const float u1 = ddx_r + kdx * (dx_r - dx) + kx * (x_r - x);
143  const float u2 = ddy_r + kdy * (dy_r - dy) + ky * (y_r - y);
144  const float du1 = dddx_r + kdx * (ddx_r - ddx) + kx * (dx_r - dx);
145  const float du2 = dddy_r + kdy * (ddy_r - ddy) + ky * (dy_r - dy);
146  const float d_xi = u1 * cos_th_r + u2 * sin_th_r;
147  /* integral the state(s) */
148  xi += d_xi * Ts;
149  /* determine the output signal */
150  Result res;
151  if (std::abs(xi) < xi_threshold) {
152  const auto b = gain.low_b; //< b > 0
153  const auto zeta = gain.low_zeta; //< zeta \in [0,1]
154  const auto v_d = ref_dq.x * cos_th_r + ref_dq.y * sin_th_r;
155  const auto w_d = ref_dq.th;
156  const auto k1 = 2 * zeta * std::sqrt(w_d * w_d + b * v_d * v_d);
157  const auto k2 = b;
158  const auto k3 = k1;
159  const auto v = v_d * std::cos(th_r - theta) +
160  k1 * (cos_theta * (x_r - x) + sin_theta * (y_r - y));
161  const auto w = w_d +
162  k2 * v_d * sinc(th_r - theta) *
163  (-sin_theta * (x_r - x) + cos_theta * (y_r - y)) +
164  k3 * (th_r - theta);
165  res.v = v;
166  res.w = w;
167  res.dv = ref_ddq.x * cos_th_r + ref_ddq.y * sin_th_r;
168  res.dw = ref_ddq.th;
169  // res.v = ref_dq.x * cos_th_r + ref_dq.y * sin_th_r;
170  // res.w = red_dq.th;
171  // res.dv = ref_ddq.x * cos_th_r + ref_ddq.y * sin_th_r;
172  // res.dw = ref_ddq.th;
173  } else {
174  res.v = xi;
175  res.dv = d_xi;
176  res.w = (u2 * cos_th_r - u1 * sin_th_r) / xi;
177  res.dw = -(2 * d_xi * res.w + du1 * sin_th_r - du2 * cos_th_r) / xi;
178  }
179  return res;
180  }
static constexpr float sinc(const float x)
自作の sinc 関数 sinc(x) := sin(x) / x
Definition: trajectory_tracker.h:58
float low_b
Definition: trajectory_tracker.h:41
float low_zeta
Definition: trajectory_tracker.h:40
float omega_n
Definition: trajectory_tracker.h:39
float zeta
Definition: trajectory_tracker.h:38
呼び出し関係図:

◆ update() [2/2]

const Result ctrl::TrajectoryTracker::update ( const Pose est_q,
const Polar est_v,
const Polar est_a,
const State ref_s,
const float  Ts = kIntegrationPeriodDefault 
)
inline

制御入力の計算

引数
[in]est_q推定位置
[in]est_v推定速度
[in]est_a推定加速度
[in]ref_s目標状態
[in]Ts制御周期
戻り値
u 制御入力
92  {
93  return update(est_q, est_v, est_a, ref_s.q, ref_s.dq, ref_s.ddq, ref_s.dddq,
94  Ts);
95  }
const Result update(const Pose &est_q, const Polar &est_v, const Polar &est_a, const State &ref_s, const float Ts=kIntegrationPeriodDefault)
制御入力の計算
Definition: trajectory_tracker.h:90

メンバ詳解

◆ gain

Gain ctrl::TrajectoryTracker::gain
protected

フィードバックゲイン

◆ kIntegrationPeriodDefault

constexpr const float ctrl::TrajectoryTracker::kIntegrationPeriodDefault = 1e-3f
staticconstexpr

制御周期(積分周期)のデフォルト値 [s]

◆ kXiThresholdDefault

constexpr const float ctrl::TrajectoryTracker::kXiThresholdDefault = 150.0f
staticconstexpr

制御則の切り替え閾値のデフォルト値 [mm/s]

◆ xi

float ctrl::TrajectoryTracker::xi
protected

補助状態変数

◆ xi_threshold

float ctrl::TrajectoryTracker::xi_threshold
protected

制御則を切り替える閾値


このクラス詳解は次のファイルから抽出されました: