25 const std::shared_ptr<const IHexapodCoordinateConverter>& converter_ptr,
26 const std::shared_ptr<const IHexapodStatePresenter>& presenter_ptr,
27 const std::shared_ptr<const IHexapodPostureValidator>& checker_ptr,
30 converter_ptr_(converter_ptr),
31 presenter_ptr_(presenter_ptr),
32 checker_ptr_(checker_ptr),
39 std::vector<RobotStateNode>* output_graph)
const
45 float map_highest_z = -100000;
51 map_highest_z = map_.
GetTopZ(map_index_x, map_index_y);
57 const Vector3 kCoxaVec = converter_ptr_->ConvertRobotToGlobalCoordinate(
58 presenter_ptr_->GetLegBasePosRobotCoordinate(i),
66 map_highest_z = (std::max)(map_.
GetTopZ(kCoxaX, kCoxaY), map_highest_z);
73 float highest_body_pos_z = map_highest_z + presenter_ptr_->GetGroundHeightMarginMax();
74 float lowest_body_pos_z = map_highest_z + presenter_ptr_->GetGroundHeightMarginMin();
93 highest_body_pos_z = (std::min)(
99 pushNodeByMaxAndMinPosZ(current_node, current_num, highest_body_pos_z,
100 lowest_body_pos_z, output_graph);
104void NodeCreatorComUpDown::pushNodeByMaxAndMinPosZ(
105 const RobotStateNode& current_node,
const int current_num,
const float high,
106 const float low, std::vector<RobotStateNode>* output_graph)
const
111 const float kDivZ = (high - low) /
static_cast<float>(kDiscretization);
114 for (
int i = 0; i < kDiscretization + 1; ++i)
116 bool is_valid =
true;
122 new_com.
z = low + kDivZ * i;
129 if (!checker_ptr_->IsLegInRange(j, new_node.
leg_pos[j]))
141 (*output_graph).emplace_back(new_node);
146 RobotStateNode same_node = current_node;
150 (*output_graph).emplace_back(same_node);
constexpr int GetDividedMapIndexX(const float pos_x) const noexcept
指定した座標を DividedMap のインデックスに変換する. 範囲外の値を指定した場合でも,値を丸めずに返す. そのため,IsInMap で範囲内に存在するかどうかを確認する必要がある.
constexpr bool IsInMap(const float x, const float y) const
指定した座標がマップの範囲内に存在するかどうかを返す.
constexpr int GetDividedMapIndexY(const float pos_y) const noexcept
指定した座標を DividedMap のインデックスに変換する. 範囲外の値を指定した場合でも,値を丸めずに返す. そのため,IsInMap で範囲内に存在するかどうかを確認する必要がある.
float GetTopZ(int x_index, int y_index) const
格子状に切り分けられたマップから,最も高いZ座標を返す.
static constexpr int kLegNum
NodeCreatorComUpDown(const DividedMapState &devide_map, const std::shared_ptr< const IHexapodCoordinateConverter > &converter_ptr, const std::shared_ptr< const IHexapodStatePresenter > &presenter_ptr, const std::shared_ptr< const IHexapodPostureValidator > &checker_ptr, HexapodMove next_move)
void Create(const RobotStateNode ¤t_node, int current_num, std::vector< RobotStateNode > *output_graph) const override
現在のノードから次のノード群を生成する.
static constexpr float kFemurLength
第2関節部の長さ[mm].
static constexpr float kCoxaLength
第1関節部の長さ[mm].
static constexpr float kTibiaLength
第3関節部の長さ[mm].
bool IsGrounded(const LegStateBit &leg_state, const int leg_index)
脚番号 leg_index 0 ~ 5 に応じて,その脚が接地しているかを調べる. 脚は右前脚を0番として,時計回りに0,1,2,3,4,5となる.左前足が5番.
constexpr T Squared(const T num) noexcept
2乗した値を返す関数.
HexapodMove
ロボットが次にどの動作をするのかを表す列挙体.
グラフ構造のためのノード(頂点).旧名 LNODE
std::array< Vector3, HexapodConst::kLegNum > leg_pos
[4 * 3 * 6 = 72 byte] 脚先の座標.(coxa(脚の付け根)を原点とする)
void ChangeGlobalCenterOfMass(const designlab::Vector3 &new_com, bool do_change_leg_base_pos)
重心位置を変更する関数.
leg_func::LegStateBit leg_state
[4 byte] 脚状態,重心パターンを bitで表す.旧名 leg_con.
constexpr void ChangeToNextNode(const int parent_index_, const HexapodMove next_move_)
次の動作を設定する関数. 深さを一つ深くして,親と次の動作を設定する.
Vector3 center_of_mass_global_coord
[4 * 3 = 12byte] グローバル座標系における重心の位置.旧名 GCOM
Quaternion posture
[4 * 4 = 16byte] 姿勢を表すクォータニオン.