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