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
14
15namespace designlab
16{
17
19 const Quaternion& goal_orientation,
20 const float allowable_error) :
21 goal_orientation_(goal_orientation),
22 goal_euler_(ToEulerXYZ(goal_orientation)),
23 allowable_error_(allowable_error)
24{
25}
26
28{
29 // 角度を取得し,誤差を計算.
30 auto now = ToEulerXYZ(node.posture);
31
32 float error_x = std::abs(now.x_angle - goal_euler_.x_angle);
33 error_x = (std::min)(error_x, 2 * std::numbers::pi_v<float> -error_x);
34
35 if (error_x > allowable_error_)
36 {
37 return false;
38 }
39
40 float error_y = std::abs(now.y_angle - goal_euler_.y_angle);
41 error_y = (std::min)(error_y, 2 * std::numbers::pi_v<float> -error_y);
42
43 if (error_y > allowable_error_)
44 {
45 return false;
46 }
47
48 float error_z = std::abs(now.z_angle - goal_euler_.z_angle);
49 error_z = (std::min)(error_z, 2 * std::numbers::pi_v<float> -error_z);
50
51 if (error_z > allowable_error_)
52 {
53 return false;
54 }
55
56 return true;
57}
58
59} // 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:109
float y_angle
Y 軸周りの回転 [rad]
Definition math_euler.h:110
float z_angle
Z 軸周りの回転 [rad]
Definition math_euler.h:111
クォータニオンを表す構造体.
グラフ構造のためのノード(頂点).旧名 LNODE
Quaternion posture
[4 * 4 = 16byte] 姿勢を表すクォータニオン.