GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
simulation_end_checker_factory.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 <utility>
11
12#include "cassert_define.h"
13#include "math_quaternion.h"
14#include "math_rot_converter.h"
18
19namespace designlab {
20
21std::unique_ptr<ISimulationEndChecker> SimulationEndCheckerFactory::Create(
22 const SimulationSettingRecord& record) {
25
26 if (record.end_check_mode == kGoalTape) {
27 auto simulation_end_checker =
28 std::make_unique<SimulationEndCheckerByGoalTape>(
30
31 return std::move(simulation_end_checker);
32 } else if (record.end_check_mode == kPosture) {
33 EulerXYZ target_euler_rad{ConvertDegToRad(record.target_posture.x_angle),
34 ConvertDegToRad(record.target_posture.y_angle),
35 ConvertDegToRad(record.target_posture.z_angle)};
36
37 auto simulation_end_checker =
38 std::make_unique<SimulationEndCheckerByPosture>(
39 ToQuaternion(target_euler_rad),
40 ConvertDegToRad(record.target_posture_allowable_error_deg));
41
42 return std::move(simulation_end_checker);
43 } else if (record.end_check_mode == kPosition) {
44 const Vector3 goal_position(record.target_position);
45
46 auto simulation_end_checker =
47 std::make_unique<SimulationEndCheckerByPosition>(
48 goal_position, record.target_position_allowable_error);
49
50 return std::move(simulation_end_checker);
51 } else {
52 assert(false);
53 }
54
55 return nullptr;
56}
57
58} // namespace designlab
static std::unique_ptr< ISimulationEndChecker > Create(const SimulationSettingRecord &record)
シミュレーションの終了を判定するクラスを生成する.
constexpr T ConvertDegToRad(const T deg) noexcept
角度を [deg] から [rad] に変換する関数.
Definition math_util.h:119
Quaternion ToQuaternion(const RotationMatrix3x3 &rot)
回転角行列からクォータニオンへの変換.
XYZオイラー角を用いた回転を表す構造体.
Definition math_euler.h:30
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
enums::SimulationEndCheckMode end_check_mode
3次元の位置ベクトルを表す構造体.