GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
node_creator_body_rot.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_NODE_CREATOR_BODY_ROT_H_
9#define DESIGNLAB_NODE_CREATOR_BODY_ROT_H_
10
11#include <memory>
12#include <vector>
13
14#include "divided_map_state.h"
18#include "math_util.h"
19
20namespace designlab {
21
24class NodeCreatorBodyRot final : public INodeCreator {
25 public:
27 const DividedMapState& devide_map,
28 const std::shared_ptr<const IHexapodCoordinateConverter>& converter_ptr,
29 const std::shared_ptr<const IHexapodPostureValidator>& checker_ptr,
30 const Vector3& rot_axis, HexapodMove next_move);
31
33
34 void Create(const RobotStateNode& current_node, int current_num,
35 std::vector<RobotStateNode>* output_graph) const override;
36
37 private:
39 static constexpr float kBodyYawRotAngleMax = math_util::ConvertDegToRad(20.f);
40
42 static constexpr float kBodyYawRotAngleMin =
44
46 static constexpr int kBodyYawRotAngleDivNum = 21;
47
48 constexpr std::array<float, kBodyYawRotAngleDivNum> CreateCandidateAngle()
49 const {
50 std::array<float, kBodyYawRotAngleDivNum> res{};
51 int count = 0;
52
53 res[count++] = (kBodyYawRotAngleMax + kBodyYawRotAngleMin) / 2;
54
55 // 絶対値の小さい順に並べる.
56 const float dif = (kBodyYawRotAngleMax - kBodyYawRotAngleMin) /
57 (kBodyYawRotAngleDivNum - 1);
58
59 for (int i = 0; i < kBodyYawRotAngleDivNum / 2; ++i) {
60 res[count++] = res[0] + dif * (i + 1);
61 res[count++] = res[0] - dif * (i + 1);
62 }
63
64 return res;
65 }
66
67 const std::array<float, kBodyYawRotAngleDivNum> candidate_angle_ =
68 CreateCandidateAngle();
69
70 const DividedMapState map_;
71 const HexapodMove next_move_;
72
73 const std::shared_ptr<const IHexapodCoordinateConverter> converter_ptr_;
74 const std::shared_ptr<const IHexapodPostureValidator> checker_ptr_;
75
76 Vector3 rot_axis_;
77
78 static_assert(
79 kBodyYawRotAngleMax > kBodyYawRotAngleMin,
80 "kBodyYawRotAngleMax は kBodyYawRotAngleMinよりも大きい必要があります.");
81 static_assert(kBodyYawRotAngleDivNum % 2 == 1,
82 "kBodyYawRotAngleDivNum は奇数である必要があります.");
83};
84
85} // namespace designlab
86
87#endif // DESIGNLAB_NODE_CREATOR_BODY_ROT_H_
マップを格子状に分割して管理するクラス.
ノード生成処理のインターフェース.
ロボットの回転を表すノードを生成するクラス.
void Create(const RobotStateNode &current_node, int current_num, std::vector< RobotStateNode > *output_graph) const override
現在のノードから次のノード群を生成する.
constexpr T ConvertDegToRad(const T deg) noexcept
角度を [deg] から [rad] に変換する関数.
Definition math_util.h:119
HexapodMove
ロボットが次にどの動作をするのかを表す列挙体.
グラフ構造のためのノード(頂点).
3次元の位置ベクトルを表す構造体.