20float NormalizeAngle(
float angle)
22 while (angle > std::numbers::pi_v<float>)
24 angle -= 2 * std::numbers::pi_v<float>;
27 while (angle < -std::numbers::pi_v<float>)
29 angle += 2 * std::numbers::pi_v<float>;
66 if (most_near_index_ > 0 &&
70 const auto diff = global_route_[most_near_index_].ProjectedXY() -
73 const float angle = atan2(diff.y, diff.x);
75 const float rot_dif = NormalizeAngle(angle - euler_z_angle);
77 if (abs(rot_dif) > kAllowableAngleError)
112 if (most_near_index_ == 0)
118 operation_straight.
straight_move_vector = (global_route_[most_near_index_] - global_route_[most_near_index_ - 1]).GetNormalized();
121 return operation_straight;
RobotOperation Update(const RobotStateNode &node) override
ロボットの動作を更新する.
RobotOperation Init() const override
ロボットの動作を初期化する.
RobotOperatorForPath(const std::vector< Vector3 > &path)
RobotOperationType
Robotをどのように動かすかを表す列挙体.
@ kStraightMoveVector
直線移動をさせる(移動したい方向をベクトルで示す)
@ kSpotTurnLastPosture
その場で旋回させる(最終的な姿勢 Posture を示す)
EulerXYZ ToEulerXYZ(const RotationMatrix3x3 &rot)
回転角行列からXYZオイラー角への変換.
float z_angle
Z 軸周りの回転 [rad]
static Quaternion MakeByAngleAxis(float rad_angle, const Vector3 &axis)
回転軸と回転角からクォータニオンを作成する. q = cos(θ/2) * w + sin(θ/2) * { v.x + v.y + v.z } となる. ノルムは必ず1になる.
探索において目標となる座標や角度,評価する値についてまとめた構造体.
Vector3 straight_move_vector
< 目標方向.正規化されたベクトル.
RobotOperationType operation_type
Quaternion spot_turn_last_posture
旋回時の回転軸.右ねじの回転.
グラフ構造のためのノード(頂点).旧名 LNODE
Vector3 center_of_mass_global_coord
[4 * 3 = 12byte] グローバル座標系における重心の位置.旧名 GCOM
Quaternion posture
[4 * 4 = 16byte] 姿勢を表すクォータニオン.
static constexpr Vector3 GetUpVec() noexcept
上に進む単位ベクトルを返す. 静的な関数なので,Vector3::GetUpVec() と呼び出せる.
static constexpr Vector3 GetFrontVec() noexcept
正面に進む単位ベクトルを返す. 静的な関数なので,Vector3::GetFrontVec() と呼び出せる.
constexpr Vector2 ProjectedXY() const noexcept
XY平面に射影したベクトルを返す.