GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
simulation_end_checker_by_posture.cpp
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
9
10#include <numbers>
11
12#include "math_rot_converter.h"
13
14namespace designlab {
15
17 const Quaternion& goal_orientation, const float allowable_error)
18 : goal_orientation_(goal_orientation),
19 goal_euler_(ToEulerXYZ(goal_orientation)),
20 allowable_error_(allowable_error) {}
21
23 // 角度を取得し,誤差を計算.
24 auto now = ToEulerXYZ(node.posture);
25
26 float error_x = std::abs(now.x_angle - goal_euler_.x_angle);
27 error_x = (std::min)(error_x, 2 * std::numbers::pi_v<float> - error_x);
28
29 if (error_x > allowable_error_) {
30 return false;
31 }
32
33 float error_y = std::abs(now.y_angle - goal_euler_.y_angle);
34 error_y = (std::min)(error_y, 2 * std::numbers::pi_v<float> - error_y);
35
36 if (error_y > allowable_error_) {
37 return false;
38 }
39
40 float error_z = std::abs(now.z_angle - goal_euler_.z_angle);
41 error_z = (std::min)(error_z, 2 * std::numbers::pi_v<float> - error_z);
42
43 if (error_z > allowable_error_) {
44 return false;
45 }
46
47 return true;
48}
49
50} // namespace designlab
bool IsEnd(const RobotStateNode &node) const override
シミュレーションの終了を判定する.
SimulationEndCheckerByPosture(const Quaternion &goal_orientation, float allowable_error)
EulerXYZ ToEulerXYZ(const RotationMatrix3x3 &rot)
回転角行列からXYZオイラー角への変換.
float x_angle
X 軸周りの回転 [rad]
Definition math_euler.h:99
float y_angle
Y 軸周りの回転 [rad]
Definition math_euler.h:100
float z_angle
Z 軸周りの回転 [rad]
Definition math_euler.h:101
クォータニオンを表す構造体.
グラフ構造のためのノード(頂点).
Quaternion posture
[4 * 4 = 16byte] 姿勢を表すクォータニオン.