18 : color_gray_(GetColor(180, 80, 80)),
19 color_light_gray_(GetColor(200, 160, 160)),
20 color_dark_gray_(GetColor(40, 40, 40)),
26 divided_map_.
Init(map_, hexapod_pos_);
32 divided_map_.
Init(map_, hexapod_pos_);
41 for (
size_t i = 0; i < map_point_size; i++) {
42 DrawCube3DWithTopPos(ConvertToDxlibVec(map_.
GetMapPoint(i)), cube_size_,
46 for (
const auto& [i, j] : DoubleIntRange(30, 30)) {
52 for (
int k = 0; k < *num; k++) {
54 const auto point_pos = divided_map_.
GetPointPos(i, j, k);
59 DrawCube3DWithTopPos(ConvertToDxlibVec(*point_pos), cube_size_,
60 (i + j) % 2 == 0 ? color_light_gray_ : color_gray_);
nostd::expected< Vector3, std::string > GetPointPos(int x_index, int y_index, int divided_map_index) const
格子状に切り分けられたマップから,脚設置可能点の実際の座標を取得する. 範囲外の値を指定した場合は, unexpected を返す.
void Init(const MapState &map_state, const Vector3 global_robot_com)
マップのデータを初期化する. ロボットの重心座標を中心にマップのデータを格子状に分割し, その中に存在する脚設置可能点を集める.
nostd::expected< int, std::string > GetPointNum(int x_index, int y_index) const
格子状に切り分けられたマップから,脚設置可能点の数を取得する. 範囲外の値を指定した場合は, unexpected を返す.
void SetNode(const RobotStateNode &pos) override
ロボットの重心のグローバル座標を設定する. DividedMap はロボットの重心を中心にしているので, ロボットの重心のグローバル座標を設定する必要がある. 代入と同時に DividedMap...
void Draw() const override
マップの描画を行う.
void SetMapState(const MapState &map)
マップの状態を設定する.代入と同時に DividedMap も更新される.
size_t GetMapPointSize() const noexcept
脚設置可能点の総数を返す.
Vector3 GetMapPoint(const size_t index) const noexcept
脚設置可能点の座標を返す.
void DrawCube3DWithTopPos(const VECTOR &top_pos, const float side_len, const unsigned int color)
3D空間に立方体を描画する.立方体の上面の中心の座標から描画する.
VECTOR ConvertToDxlibVec(const Vector3 &vec)
Dxlibの座標を示すVECTORと,このプログラムで使用しているVectorを変換する. ロボット座標系は右手座標系, Dxlibは左手座標系(工学は右手・ゲームライブラリは左手が多い)なのでyを...
Vector3 center_of_mass_global_coord
[4 * 3 = 12byte] グローバル座標系における重心の位置.旧名 GCOM