GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
phantomx_mk2_const.h
[詳解]
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#ifndef DESIGNLAB_PHANTOMX_MK2_CONST_H_
9#define DESIGNLAB_PHANTOMX_MK2_CONST_H_
10
11#include <array>
12
13#include "cassert_define.h"
14#include "math_util.h"
15
16
17namespace designlab
18{
19
32{
33private:
34 constexpr static int kPhantomXLegNum = 6;
35
36public:
37 // コンストラクタとコピーコンストラクタを削除し,実体を生成できないようにする.
39 PhantomXMkIIConst(const PhantomXMkIIConst& other) = delete;
42
44 constexpr static std::array<float, kPhantomXLegNum> kCoxaDefaultAngle = {
51 };
52
54 constexpr static float kCoxaAngleMin = math_util::ConvertDegToRad(-81.0f);
55
57 constexpr static float kCoxaAngleMax = math_util::ConvertDegToRad(81.0f);
58
59
61 constexpr static float kFemurAngleMin = math_util::ConvertDegToRad(-105.0f);
62
64 constexpr static float kFemurAngleMax = math_util::ConvertDegToRad(99.0f);
65
66
68 constexpr static float kTibiaAngleMin = math_util::ConvertDegToRad(-145.0f);
69
71 constexpr static float kTibiaAngleMax = math_util::ConvertDegToRad(25.5f);
72
73
74 constexpr static float kCoxaLength = 52.0f;
75 constexpr static float kFemurLength = 66.0f;
76 constexpr static float kTibiaLength = 130.0f;
77
79 constexpr static float kCoxaBaseOffsetY = 61.f;
80
82 constexpr static float kCenterCoxaBaseOffsetY = 103.4f;
83
85 constexpr static float kCoxaBaseOffsetX = 122.f;
86
88 constexpr static float kCoxaBaseOffsetZ = 1.116f;
89
91 constexpr static float kBodyHeight = 40.0f;
92
93
98 constexpr static bool IsValidCoxaAngle(const int leg_index, const float angle)
99 {
100 // 0 <= leg_index < kPhantomXLegNum であることを保証する.
101 assert(0 <= leg_index);
102 assert(leg_index < kPhantomXLegNum);
103
104 return (kCoxaAngleMin + kCoxaDefaultAngle[leg_index] <= angle &&
105 angle <= kCoxaAngleMax + kCoxaDefaultAngle[leg_index]);
106 };
107
111 constexpr static bool IsValidFemurAngle(const float angle)
112 {
113 return kFemurAngleMin <= angle && angle <= kFemurAngleMax;
114 };
115
119 constexpr static bool IsValidTibiaAngle(const float angle)
120 {
121 return kTibiaAngleMin <= angle && angle <= kTibiaAngleMax;
122 };
123
124
125 static_assert(kCoxaAngleMin < kCoxaAngleMax,
126 "kCoxaAngleMax > Min is required.");
127 static_assert(kFemurAngleMin < kFemurAngleMax,
128 "kFemurAngleMax > Min is required.");
129 static_assert(kTibiaAngleMin < kTibiaAngleMax,
130 "kTibiaAngleMax > Min is required.");
131
132 static_assert(kCoxaLength > 0.f,
133 "kCoxaLength and Coxa Link must be positive.");
134 static_assert(kFemurLength > 0.f,
135 "kFemurLength and Femur Link must be positive.");
136 static_assert(kTibiaLength > 0.f,
137 "kTibiaLength and Tibia Link must be positive.");
138};
139
140} // namespace designlab
141
142
143#endif // DESIGNLAB_PHANTOMX_MK2_CONST_H_
PhantomX mk-Ⅱ のパラメータを定数で表現したもの.
static constexpr float kFemurLength
第2関節部の長さ[mm].
static constexpr bool IsValidCoxaAngle(const int leg_index, const float angle)
第1関節の角度が有効な範囲内かどうかを判定する.
static constexpr float kTibiaAngleMax
static constexpr float kFemurAngleMin
第2関節の可動範囲の最大値[rad].詳しくは referenceフォルダ参照.
static constexpr float kCoxaBaseOffsetY
coxa linkの付け根(中央)までの長さ[mm].
static constexpr float kFemurAngleMax
第2関節の可動範囲の最小値[rad].詳しくは referenceフォルダ参照.
PhantomXMkIIConst(PhantomXMkIIConst &&other)=delete
static constexpr float kCenterCoxaBaseOffsetY
coxa linkの付け根(前方・後方)までの長さ[mm].
static constexpr float kCoxaLength
第1関節部の長さ[mm].
static constexpr float kCoxaAngleMin
第1関節の可動範囲の最大値[rad].詳しくは referenceフォルダ参照.
static constexpr float kTibiaAngleMin
第2関節の可動範囲の最大値[rad].詳しくは referenceフォルダ参照.
static constexpr float kTibiaLength
第3関節部の長さ[mm].
PhantomXMkIIConst(const PhantomXMkIIConst &other)=delete
static constexpr std::array< float, kPhantomXLegNum > kCoxaDefaultAngle
第1関節の初期角度[rad]
PhantomXMkIIConst & operator=(const PhantomXMkIIConst &other)=delete
static constexpr float kBodyHeight
static constexpr bool IsValidFemurAngle(const float angle)
第2関節の角度が有効な範囲内かどうかを判定する.
static constexpr bool IsValidTibiaAngle(const float angle)
第3関節の角度が有効な範囲内かどうかを判定する.
static constexpr float kCoxaBaseOffsetX
coxa linkの付け根までの長さ(上方向)[mm].
static constexpr float kCoxaBaseOffsetZ
胴体の高さ[mm].
static constexpr float kCoxaAngleMax
第2関節の可動範囲の最小値[rad].詳しくは referenceフォルダ参照.
constexpr T ConvertDegToRad(const T deg) noexcept
角度を [deg] から [rad] に変換する関数.
Definition math_util.h:126