GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
node_creator_leg_hierarchy_test.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_LEG_HIERARCHY_TEST_H_
9#define DESIGNLAB_NODE_CREATOR_LEG_HIERARCHY_TEST_H_
10
11#include <array>
12#include <vector>
13
14#include "doctest.h"
16
17TEST_SUITE("NodeCreatorLegHierarchyTest") {
25
26 TEST_CASE("CreateTest_WhenOneLegIsSwinging") {
27 using enum DiscreteLegPos;
28
29 // Arrange
30 const HexapodMove move = HexapodMove::kComMove;
31 const std::vector<DiscreteLegPos> discrete_leg_pos = {
32 kBack,
33 kCenter,
34 kFront,
35 };
36
37 NodeCreatorLegHierarchy node_creator_leg_hierarchy{move, discrete_leg_pos};
38
39 // 1脚のみ遊脚させる.
40 std::array<bool, HexapodConst::kLegNum> ground_leg = {false, true, true,
41 true, true, true};
42
43 RobotStateNode robot_state_node;
44
45 robot_state_node.leg_state =
46 MakeLegStateBit(DiscreteComPos::kCenterFront, ground_leg,
47 {kCenter, kCenter, kCenter, kCenter, kCenter, kCenter});
48
49 // Act
50 std::vector<RobotStateNode> actual;
51
52 node_creator_leg_hierarchy.Create(robot_state_node, 0, &actual);
53
54 // Assert
55 CHECK(actual.size() == 3);
56 }
57}
58
59#endif // DESIGNLAB_NODE_CREATOR_LEG_HIERARCHY_TEST_H_
Hexapodの定数をまとめたクラス.
脚の階層構造を作るためのクラス.
LegStateBit MakeLegStateBit(const enums::DiscreteComPos discrete_com_pos, const std::array< bool, HexapodConst::kLegNum > &is_ground, const std::array< DiscreteLegPos, HexapodConst::kLegNum > &discretized_leg_pos)
脚状態を作成して返す関数.脚状態は重心パターン, 脚の接地・遊脚,離散化した脚位置のデータが含まれる.
Definition leg_state.cpp:14
DiscreteLegPos
離散化された脚位置を表す列挙体. 先行研究では 1~7の int型の数値で表現されているが, 可読性を上げるために列挙体にした. 離散化された脚位置は 3bit (0 ~ 7)の範囲で表現される...
HexapodMove
ロボットが次にどの動作をするのかを表す列挙体.
TEST_SUITE("NodeCreatorLegHierarchyTest")
グラフ構造のためのノード(頂点).