マップを格子状に分割して管理するクラス.
[詳解]
#include <divided_map_state.h>
|
| DividedMapState (float min_z=MapState::kMapMinZ) |
|
void | Init (const MapState &map_state, const Vector3 global_robot_com) |
| マップのデータを初期化する. ロボットの重心座標を中心にマップのデータを格子状に分割し, その中に存在する脚設置可能点を集める.
|
|
void | Clear () |
| マップのデータを消去する.
|
|
constexpr bool | IsInMap (const float x, const float y) const |
| 指定した座標がマップの範囲内に存在するかどうかを返す.
|
|
constexpr bool | IsInMap (const Vector3 &pos) const noexcept |
| 指定した座標がマップの範囲内に存在するかどうかを返す.
|
|
constexpr int | GetDividedMapIndexX (const float pos_x) const noexcept |
| 指定した座標を DividedMap のインデックスに変換する. 範囲外の値を指定した場合でも,値を丸めずに返す. そのため,IsInMap で範囲内に存在するかどうかを確認する必要がある.
|
|
constexpr int | GetDividedMapIndexY (const float pos_y) const noexcept |
| 指定した座標を DividedMap のインデックスに変換する. 範囲外の値を指定した場合でも,値を丸めずに返す. そのため,IsInMap で範囲内に存在するかどうかを確認する必要がある.
|
|
int | GetPointNum (int x_index, int y_index) const |
| 格子状に切り分けられたマップから,脚設置可能点の数を取得する.
範囲外の値を指定した場合は,0を返す.
|
|
Vector3 | GetPointPos (int x_index, int y_index, int divided_map_index) const |
| 格子状に切り分けられたマップから,脚設置可能点の実際の座標を取得する.
範囲外の値を指定した場合は,(0,0,0)を返す.
|
|
void | GetPointVector (int x_index, int y_index, std::vector< Vector3 > *point_vec) const |
| 格子状に切り分けられたマップから,脚設置可能点の vector を取得する
範囲外の値を指定した場合は,空の vector を返す.
|
|
float | GetTopZ (int x_index, int y_index) const |
| 格子状に切り分けられたマップから,最も高いZ座標を返す.
|
|
float | GetMapMinZ () const noexcept |
|
|
static constexpr int | ClampDividedMapIndex (const int index) noexcept |
| 指定した座標がマップのインデックスの範囲内になるように丸める.
|
|
マップを格子状に分割して管理するクラス.
ロボットのセンサには限界があるため,マップのデータを全て保持することはできない. そのため,ロボットの近くのデータのみを保持すればよい. 処理を軽くするために,マップが存在する領域を長方形に切り分けて, その中に存在する脚設置可能点を集めたものが,このクラスである.
要素は参考の「1次元の配列を多次元配列として使う」の要領で並んでいる.
座標はグローバル座標である.
参考
divided_map_state.h の 31 行目に定義があります。
◆ DividedMapState()
◆ ClampDividedMapIndex()
static constexpr int designlab::DividedMapState::ClampDividedMapIndex |
( |
const int |
index | ) |
|
|
inlinestaticconstexprnoexcept |
◆ Clear()
void designlab::DividedMapState::Clear |
( |
| ) |
|
◆ GetDividedMapIndexX()
constexpr int designlab::DividedMapState::GetDividedMapIndexX |
( |
const float |
pos_x | ) |
const |
|
inlineconstexprnoexcept |
◆ GetDividedMapIndexY()
constexpr int designlab::DividedMapState::GetDividedMapIndexY |
( |
const float |
pos_y | ) |
const |
|
inlineconstexprnoexcept |
◆ GetMapMinZ()
float designlab::DividedMapState::GetMapMinZ |
( |
| ) |
const |
|
inlinenoexcept |
◆ GetPointNum()
int designlab::DividedMapState::GetPointNum |
( |
int |
x_index, |
|
|
int |
y_index |
|
) |
| const |
格子状に切り分けられたマップから,脚設置可能点の数を取得する.
範囲外の値を指定した場合は,0を返す.
- 引数
-
[in] | x_index | X座標,切り分けられたタイルの位置で指定する. |
[in] | y_index | Y座標,切り分けられたタイルの位置で指定する. |
- 戻り値
- 脚設置可能点の数.
divided_map_state.cpp の 77 行目に定義があります。
◆ GetPointPos()
Vector3 designlab::DividedMapState::GetPointPos |
( |
int |
x_index, |
|
|
int |
y_index, |
|
|
int |
divided_map_index |
|
) |
| const |
格子状に切り分けられたマップから,脚設置可能点の実際の座標を取得する.
範囲外の値を指定した場合は,(0,0,0)を返す.
- 引数
-
[in] | x_index | x座標,切り分けられたタイルの位置で指定する. |
[in] | y_index | y座標,切り分けられたタイルの位置で指定する. |
[in] | divided_map_index | 何番目の脚設置可能点か. |
- 戻り値
- 脚設置可能点の座標.
divided_map_state.cpp の 88 行目に定義があります。
◆ GetPointVector()
void designlab::DividedMapState::GetPointVector |
( |
int |
x_index, |
|
|
int |
y_index, |
|
|
std::vector< Vector3 > * |
point_vec |
|
) |
| const |
格子状に切り分けられたマップから,脚設置可能点の vector を取得する
範囲外の値を指定した場合は,空の vector を返す.
- 引数
-
[in] | x_index | x座標,切り分けられたタイルの位置で指定する. |
[in] | y_index | y座標,切り分けられたタイルの位置で指定する. |
[out] | point_vec | 脚設置可能点の座標の配列. |
divided_map_state.cpp の 107 行目に定義があります。
◆ GetTopZ()
float designlab::DividedMapState::GetTopZ |
( |
int |
x_index, |
|
|
int |
y_index |
|
) |
| const |
格子状に切り分けられたマップから,最も高いZ座標を返す.
- 引数
-
[in] | x_index | X座標,切り分けられたタイルの位置で指定する. |
[in] | y_index | Y座標,切り分けられたタイルの位置で指定する. |
- 戻り値
- 最も高いZ座標.
divided_map_state.cpp の 124 行目に定義があります。
◆ Init()
void designlab::DividedMapState::Init |
( |
const MapState & |
map_state, |
|
|
const Vector3 |
global_robot_com |
|
) |
| |
マップのデータを初期化する. ロボットの重心座標を中心にマップのデータを格子状に分割し, その中に存在する脚設置可能点を集める.
- 引数
-
[in] | map_state | マップのデータ. |
[in] | global_robot_com | ロボットの重心のグローバル座標. |
divided_map_state.cpp の 26 行目に定義があります。
◆ IsInMap() [1/2]
constexpr bool designlab::DividedMapState::IsInMap |
( |
const float |
x, |
|
|
const float |
y |
|
) |
| const |
|
inlineconstexpr |
指定した座標がマップの範囲内に存在するかどうかを返す.
- 引数
-
[in] | x | グローバル座標. |
[in] | y | グローバル座標. |
- 戻り値
-
true | 範囲内に存在する. |
false | 範囲内に存在しない. |
divided_map_state.h の 73 行目に定義があります。
◆ IsInMap() [2/2]
constexpr bool designlab::DividedMapState::IsInMap |
( |
const Vector3 & |
pos | ) |
const |
|
inlineconstexprnoexcept |
◆ kDividedAreaLength
◆ kDividedMapMaxX
◆ kDividedMapMaxY
◆ kDividedMapMinX
constexpr float designlab::DividedMapState::kDividedMapMinX { -kDividedMapMaxX } |
|
staticconstexpr |
◆ kDividedMapMinY
constexpr float designlab::DividedMapState::kDividedMapMinY { -kDividedMapMaxY } |
|
staticconstexpr |
◆ kDividedMapPointNum
constexpr int designlab::DividedMapState::kDividedMapPointNum { 4 } |
|
staticconstexpr |
< 1つのマスに存在する脚設置可能点の数は kDividedMapPointNum × kDividedMapPointNum 個.
1つのマスの一辺の長さ.
divided_map_state.h の 35 行目に定義があります。
◆ kDividedNum
constexpr int designlab::DividedMapState::kDividedNum { 15 } |
|
staticconstexpr |
このクラス詳解は次のファイルから抽出されました: