8#ifndef DESIGNLAB_DIVIDED_MAP_STATE_H_
9#define DESIGNLAB_DIVIDED_MAP_STATE_H_
73 constexpr bool IsInMap(
const float x,
const float y)
const
107 return static_cast<int>(
120 return static_cast<int>(
128 if (index < 0) {
return 0; }
154 void GetPointVector(
int x_index,
int y_index, std::vector<Vector3>* point_vec)
const;
160 float GetTopZ(
int x_index,
int y_index)
const;
170 constexpr int GetDividedMapIndex(
const int x_index,
const int y_index)
const noexcept
179 constexpr bool IsValidIndex(
const int index)
const noexcept
189 const float kMapMinZ;
191 Vector3 global_robot_com_;
194 std::vector<std::vector<Vector3> > divided_map_point_;
197 std::vector<float> divided_map_top_z_;
201 "kDividedMapPointNum は正の整数である必要があります.");
204 "kDividedAreaLengthは正の実数である必要があります.");
207 "kDividedNum は正の整数である必要があります.");
210 " kDividedMapMaxX は kDividedMapMinX より大きい必要があります.");
213 "kDividedMapMaxY は kDividedMapMinY より大きい必要があります.");
constexpr bool IsInMap(const Vector3 &pos) const noexcept
指定した座標がマップの範囲内に存在するかどうかを返す.
constexpr int GetDividedMapIndexX(const float pos_x) const noexcept
指定した座標を DividedMap のインデックスに変換する. 範囲外の値を指定した場合でも,値を丸めずに返す. そのため,IsInMap で範囲内に存在するかどうかを確認する必要がある.
static constexpr float kDividedAreaLength
static constexpr float kDividedMapMaxX
マップの最大のX座標.
Vector3 GetPointPos(int x_index, int y_index, int divided_map_index) const
格子状に切り分けられたマップから,脚設置可能点の実際の座標を取得する. 範囲外の値を指定した場合は,(0,0,0)を返す.
void Init(const MapState &map_state, const Vector3 global_robot_com)
マップのデータを初期化する. ロボットの重心座標を中心にマップのデータを格子状に分割し, その中に存在する脚設置可能点を集める.
constexpr bool IsInMap(const float x, const float y) const
指定した座標がマップの範囲内に存在するかどうかを返す.
static constexpr float kDividedMapMinX
マップの最小のX座標.
static constexpr float kDividedMapMinY
マップの最小のY座標.
void Clear()
マップのデータを消去する.
static constexpr int kDividedMapPointNum
< 1つのマスに存在する脚設置可能点の数は kDividedMapPointNum × kDividedMapPointNum 個.
constexpr int GetDividedMapIndexY(const float pos_y) const noexcept
指定した座標を DividedMap のインデックスに変換する. 範囲外の値を指定した場合でも,値を丸めずに返す. そのため,IsInMap で範囲内に存在するかどうかを確認する必要がある.
int GetPointNum(int x_index, int y_index) const
格子状に切り分けられたマップから,脚設置可能点の数を取得する. 範囲外の値を指定した場合は,0を返す.
float GetTopZ(int x_index, int y_index) const
格子状に切り分けられたマップから,最も高いZ座標を返す.
void GetPointVector(int x_index, int y_index, std::vector< Vector3 > *point_vec) const
格子状に切り分けられたマップから,脚設置可能点の vector を取得する 範囲外の値を指定した場合は,空の vector を返す.
static constexpr int ClampDividedMapIndex(const int index) noexcept
指定した座標がマップのインデックスの範囲内になるように丸める.
float GetMapMinZ() const noexcept
static constexpr float kDividedMapMaxY
マップの最大のY座標.
static constexpr int kDividedNum
格子の数.
static constexpr float kMapPointDistance
z軸から(上から)みたとき,格子点状に分けられた脚接地可能点の間隔 [mm].
static constexpr float kMapMinZ
マップの最低のZ座標