MicroMouse Control Module  v1.3.2-2-ge2c6882
公開メンバ関数 | 静的公開メンバ関数 | 公開変数類 | フレンド | 全メンバ一覧
ctrl::slalom::Shape 構造体

slalom::Shape スラロームの形状を表す構造体 [詳解]

#include <slalom.h>

ctrl::slalom::Shape 連携図
Collaboration graph
[凡例]

公開メンバ関数

 Shape (const Pose &total, const float y_curve_end, const float x_adv=0, const float dddth_max=dddth_max_default, const float ddth_max=ddth_max_default, const float dth_max=dth_max_default)
 拘束条件からスラローム形状を生成するコンストラクタ [詳解]
 
 Shape (const Pose &total, const Pose &curve, float straight_prev, const float straight_post, const float v_ref, const float dddth_max, const float ddth_max, const float dth_max)
 生成済みスラローム形状を単に代入するコンストラクタ [詳解]
 

静的公開メンバ関数

static void integrate (const AccelDesigner &ad, State &s, const float v, const float t, const float Ts, const float k_slip=0)
 軌道の積分を行う関数。ルンゲクッタ法を使用して数値積分を行う。 [詳解]
 

公開変数類

Pose total
 前後の直線を含めた移動位置姿勢 [詳解]
 
Pose curve
 カーブ部分の移動位置姿勢 [詳解]
 
float straight_prev
 カーブ前の直線の距離 [m] [詳解]
 
float straight_post
 カーブ後の直線の距離 [m] [詳解]
 
float v_ref
 カーブ部分の基準速度 [m/s] [詳解]
 
float dddth_max
 最大角躍度の大きさ [rad/s/s/s] [詳解]
 
float ddth_max
 最大角加速度の大きさ [rad/s/s] [詳解]
 
float dth_max
 最大角速度の大きさ [rad/s] [詳解]
 

フレンド

std::ostream & operator<< (std::ostream &os, const Shape &obj)
 情報の表示 [詳解]
 

詳解

slalom::Shape スラロームの形状を表す構造体

メンバー変数は互いに依存して決定されているので、 個別に数値を変更することは許されない。 スラローム軌道を得るには slalom::Trajectory を用いる。

構築子と解体子

◆ Shape() [1/2]

ctrl::slalom::Shape::Shape ( const Pose total,
const float  y_curve_end,
const float  x_adv = 0,
const float  dddth_max = dddth_max_default,
const float  ddth_max = ddth_max_default,
const float  dth_max = dth_max_default 
)
inline

拘束条件からスラローム形状を生成するコンストラクタ

引数
[in]total前後の直線を含めた移動位置姿勢 [m, m, rad]
[in]y_curve_endy軸方向(進行方向に垂直な方向)の移動距離 [m]。 カーブの大きさを決めるもので、形状の設計パラメータとなる
[in]x_advx軸方向(進行方向)の前後の直線の長さ [m]。 180度ターンの場合のみで使用。
[in]dddth_max最大角躍度の大きさ [rad/s/s/s]
[in]ddth_max最大角加速度の大きさ [rad/s/s]
[in]dth_max最大角速度の大きさ [rad/s]
75  : total(total),
78  dth_max(dth_max) {
79  /* 生成準備 */
80  const float Ts = 1.5e-3f; //< シミュレーションの積分周期
81  float v = 600.0f; //< 初期値
82  State s; //< シミュレーションの状態
83  AccelDesigner ad;
84  ad.reset(dddth_max, ddth_max, dth_max, 0, 0, total.th);
85  /* 複数回行って精度を高める */
86  for (int i = 0; i < 3; ++i) {
87  s.q.x = s.q.y = 0;
88  /* シミュレーション */
89  float t = 0;
90  while (t + Ts < ad.t_end()) integrate(ad, s, v, t, Ts), t += Ts;
91  integrate(ad, s, v, t, ad.t_end() - t); //< 残りの半端分を積分
92  /* 結果を用いて更新 */
93  v *= y_curve_end / s.q.y;
94  }
95  curve = s.q;
96  v_ref = v;
97  const float sin_th = std::sin(total.th);
98  const float cos_th = std::cos(total.th);
99  /* 前後の直線の長さを決定 */
100  if (std::abs(sin_th) < 1e-3f) {
101  /* 180度ターン */
102  straight_prev = x_adv;
103  straight_post = x_adv;
104  curve = total;
105  } else {
106  /* 180度ターン以外 */
107  straight_prev = total.x - s.q.x - cos_th / sin_th * (total.y - s.q.y);
108  straight_post = 1 / sin_th * (total.y - s.q.y);
109  }
110  }
float y
y 成分 [m]
Definition: pose.h:20
float x
x 成分 [m]
Definition: pose.h:19
float th
theta 成分 [rad]
Definition: pose.h:21
float v_ref
カーブ部分の基準速度 [m/s]
Definition: slalom.h:53
Pose total
前後の直線を含めた移動位置姿勢
Definition: slalom.h:49
Pose curve
カーブ部分の移動位置姿勢
Definition: slalom.h:50
static void integrate(const AccelDesigner &ad, State &s, const float v, const float t, const float Ts, const float k_slip=0)
軌道の積分を行う関数。ルンゲクッタ法を使用して数値積分を行う。
Definition: slalom.h:144
float dddth_max
最大角躍度の大きさ [rad/s/s/s]
Definition: slalom.h:54
float ddth_max
最大角加速度の大きさ [rad/s/s]
Definition: slalom.h:55
float straight_prev
カーブ前の直線の距離 [m]
Definition: slalom.h:51
float straight_post
カーブ後の直線の距離 [m]
Definition: slalom.h:52
float dth_max
最大角速度の大きさ [rad/s]
Definition: slalom.h:56
呼び出し関係図:

◆ Shape() [2/2]

ctrl::slalom::Shape::Shape ( const Pose total,
const Pose curve,
float  straight_prev,
const float  straight_post,
const float  v_ref,
const float  dddth_max,
const float  ddth_max,
const float  dth_max 
)
inline

生成済みスラローム形状を単に代入するコンストラクタ

引数
[in]total前後の直線を含めた移動位置姿勢 [m, m, rad]
[in]curve曲線部分の変位 [m, m, rad]
[in]straight_prev曲線前の直線の長さ [m]
[in]straight_post曲線後の直線の長さ [m]
[in]v_ref基準並進速度 [m/s]
[in]dddth_max最大角躍度の大きさ [rad/s/s/s]
[in]ddth_max最大角加速度の大きさ [rad/s/s]
[in]dth_max最大角速度の大きさ [rad/s]

関数詳解

◆ integrate()

static void ctrl::slalom::Shape::integrate ( const AccelDesigner ad,
State s,
const float  v,
const float  t,
const float  Ts,
const float  k_slip = 0 
)
inlinestatic

軌道の積分を行う関数。ルンゲクッタ法を使用して数値積分を行う。

引数
[in]ad角速度分布
[in,out]s状態変数
[in]v並進速度 [m/s]
[in]t時刻 [s]
[in]Ts積分時間 [s]
[in]k_slipスリップ角定数
145  {
146  /* Calculation */
147  const std::array<float, 3> th{{ad.x(t), ad.x(t + Ts / 2), ad.x(t + Ts)}};
148  const std::array<float, 3> w{{ad.v(t), ad.v(t + Ts / 2), ad.v(t + Ts)}};
149  std::array<float, 3> cos_th;
150  std::array<float, 3> sin_th;
151  for (int i = 0; i < 3; ++i) {
152  const auto th_slip = std::atan(-k_slip * v * w[i]);
153  cos_th[i] = std::cos(th[i] + th_slip);
154  sin_th[i] = std::sin(th[i] + th_slip);
155  }
156  /* Runge-Kutta Integral */
157  s.q.x += v * Ts * (cos_th[0] + 4 * cos_th[1] + cos_th[2]) / 6;
158  s.q.y += v * Ts * (sin_th[0] + 4 * sin_th[1] + sin_th[2]) / 6;
159  /* Result */
160  s.dq.x = v * cos_th[2];
161  s.dq.y = v * sin_th[2];
162  s.q.th = ad.x(t + Ts);
163  s.dq.th = ad.v(t + Ts);
164  s.ddq.th = ad.a(t + Ts);
165  s.dddq.th = ad.j(t + Ts);
166  s.ddq.x = -s.dq.y * s.dq.th;
167  s.ddq.y = +s.dq.x * s.dq.th;
168  s.dddq.x = -s.ddq.y * s.dq.th - s.dq.y * s.ddq.th;
169  s.dddq.y = +s.ddq.x * s.dq.th + s.dq.x * s.ddq.th;
170  }
呼び出し関係図:

フレンドと関連関数の詳解

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Shape obj 
)
friend

情報の表示

174  {
175  os << "Slalom Shape" << std::endl;
176  os << "\ttotal:\t" << obj.total << std::endl;
177  os << "\tcurve:\t" << obj.curve << std::endl;
178  os << "\tv_ref:\t" << obj.v_ref << std::endl;
179  os << "\tstraight_prev:\t" << obj.straight_prev << std::endl;
180  os << "\tstraight_post:\t" << obj.straight_post << std::endl;
181  auto end = Pose(obj.straight_prev) + obj.curve +
182  Pose(obj.straight_post).rotate(obj.curve.th);
183  os << "\tintegral error:\t" << obj.total - end << std::endl;
184  return os;
185  }

メンバ詳解

◆ curve

Pose ctrl::slalom::Shape::curve

カーブ部分の移動位置姿勢

◆ dddth_max

float ctrl::slalom::Shape::dddth_max

最大角躍度の大きさ [rad/s/s/s]

◆ ddth_max

float ctrl::slalom::Shape::ddth_max

最大角加速度の大きさ [rad/s/s]

◆ dth_max

float ctrl::slalom::Shape::dth_max

最大角速度の大きさ [rad/s]

◆ straight_post

float ctrl::slalom::Shape::straight_post

カーブ後の直線の距離 [m]

◆ straight_prev

float ctrl::slalom::Shape::straight_prev

カーブ前の直線の距離 [m]

◆ total

Pose ctrl::slalom::Shape::total

前後の直線を含めた移動位置姿勢

◆ v_ref

float ctrl::slalom::Shape::v_ref

カーブ部分の基準速度 [m/s]


この構造体詳解は次のファイルから抽出されました: