slalom::Shape スラロームの形状を表す構造体
[詳解]
#include <slalom.h>
|
| 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) |
| 軌道の積分を行う関数。ルンゲクッタ法を使用して数値積分を行う。 [詳解]
|
|
slalom::Shape スラロームの形状を表す構造体
メンバー変数は互いに依存して決定されているので、 個別に数値を変更することは許されない。 スラローム軌道を得るには slalom::Trajectory を用いる。
◆ Shape() [1/2]
拘束条件からスラローム形状を生成するコンストラクタ
- 引数
-
[in] | total | 前後の直線を含めた移動位置姿勢 [m, m, rad] |
[in] | y_curve_end | y軸方向(進行方向に垂直な方向)の移動距離 [m]。 カーブの大きさを決めるもので、形状の設計パラメータとなる |
[in] | x_adv | x軸方向(進行方向)の前後の直線の長さ [m]。 180度ターンの場合のみで使用。 |
[in] | dddth_max | 最大角躍度の大きさ [rad/s/s/s] |
[in] | ddth_max | 最大角加速度の大きさ [rad/s/s] |
[in] | dth_max | 最大角速度の大きさ [rad/s] |
80 const float Ts = 1.5e-3f;
86 for (
int i = 0; i < 3; ++i) {
90 while (t + Ts < ad.t_end())
integrate(ad, s, v, t, Ts), t += Ts;
93 v *= y_curve_end / s.q.y;
97 const float sin_th = std::sin(
total.
th);
98 const float cos_th = std::cos(
total.
th);
100 if (std::abs(sin_th) < 1e-3f) {
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 | スリップ角定数 |
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);
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;
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;
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
const Shape & |
obj |
|
) |
| |
|
friend |
情報の表示
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;
◆ curve
Pose ctrl::slalom::Shape::curve |
◆ dddth_max
float ctrl::slalom::Shape::dddth_max |
◆ ddth_max
float ctrl::slalom::Shape::ddth_max |
◆ dth_max
float ctrl::slalom::Shape::dth_max |
◆ straight_post
float ctrl::slalom::Shape::straight_post |
◆ straight_prev
float ctrl::slalom::Shape::straight_prev |
◆ total
Pose ctrl::slalom::Shape::total |
◆ v_ref
float ctrl::slalom::Shape::v_ref |
この構造体詳解は次のファイルから抽出されました: