8#ifndef DESIGNLAB_ROBOT_STATE_NODE_H_
9#define DESIGNLAB_ROBOT_STATE_NODE_H_
15#include <magic_enum.hpp>
72 const std::array<Vector3, HexapodConst::kLegNum>& pos,
73 const std::array<Vector3, HexapodConst::kLegNum>& ref_pos,
103 bool do_change_leg_base_pos);
109 const std::shared_ptr<const IHexapodCoordinateConverter>& converter_ptr,
126 const int parent_index_,
187 return !(*
this == other);
195 std::array<Vector3, HexapodConst::kLegNum>
leg_pos;
225 os << value.
leg_state.to_string() <<
",";
239 os << magic_enum::enum_name(value.
next_move) <<
",";
static constexpr int kLegNum
std::bitset< kLegStateBitNum > LegStateBit
脚状態を保存する型.28bitのビット型.
constexpr std::array< T, sizeof...(Args)> MakeArray(Args &&... args)
std::arrayを作成する関数. この関数を作成したモチベーションとしては, std::arrayを constexprで初期化する際に苦戦したため. この関数を使うことで,std::arr...
HexapodMove
ロボットが次にどの動作をするのかを表す列挙体.
std::basic_ostream< Char > & operator<<(std::basic_ostream< Char > &os, const EulerXYZ &r)
出力ストリーム.Csv形式で出力する.カンマ区切り.単位は [rad].
void Normalize() noexcept
自身を正規化する.ノルムが1になる.
グラフ構造のためのノード(頂点).旧名 LNODE
constexpr bool IsLootNode() const
自身が根ノードであるか判定する.
std::array< Vector3, HexapodConst::kLegNum > leg_pos
[4 * 3 * 6 = 72 byte] 脚先の座標.(coxa(脚の付け根)を原点とする)
constexpr bool operator==(const RobotStateNode &other) const
比較演算子
RobotStateNode(RobotStateNode &&other) noexcept=default
void ChangeGlobalCenterOfMass(const designlab::Vector3 &new_com, bool do_change_leg_base_pos)
重心位置を変更する関数.
leg_func::LegStateBit leg_state
[4 byte] 脚状態,重心パターンを bitで表す.旧名 leg_con.
std::string ToCsvString() const
ノードの情報を csv形式の文字列に変換する関数. カンマ区切りで出力する.
static RobotStateNode FromString(const std::string &str)
文字列をノードの情報に変換する関数.
void ChangeLootNode()
自身を根ノードに変更する関数. depthを0に,parent_numを-1に初期化する.
constexpr void ChangeToNextNode(const int parent_index_, const HexapodMove next_move_)
次の動作を設定する関数. 深さを一つ深くして,親と次の動作を設定する.
void ChangePosture(const std::shared_ptr< const IHexapodCoordinateConverter > &converter_ptr, const designlab::Quaternion &new_posture)
クォータニオンを変更し,胴体を回転させる関数.
Vector3 center_of_mass_global_coord
[4 * 3 = 12byte] グローバル座標系における重心の位置.旧名 GCOM
std::string ToString() const
ノードの情報を文字列に変換する関数. デバッグ用に詳細な情報を出力する.
constexpr bool operator!=(const RobotStateNode &other)
RobotStateNode(const RobotStateNode &other)=default
Quaternion posture
[4 * 4 = 16byte] 姿勢を表すクォータニオン.
static constexpr int kNoParentIndex
親がいないことを表す値.
RobotStateNode & operator=(const RobotStateNode &other)=default
std::array< Vector3, HexapodConst::kLegNum > leg_reference_pos
constexpr RobotStateNode()
~RobotStateNode()=default
int depth
[4 byte] 自身の深さ.一番上の親が深さ0となる.
constexpr RobotStateNode(const leg_func::LegStateBit &state, const std::array< Vector3, HexapodConst::kLegNum > &pos, const std::array< Vector3, HexapodConst::kLegNum > &ref_pos, const Vector3 &com, const Quaternion &q, const HexapodMove move, const int parent, const int d)