MicroMouse Maze Library
3703225
|
区画ベースのステップマップを管理するクラス [詳解]
#include <StepMap.h>
公開型 | |
using | step_t = uint16_t |
ステップの型 [詳解] | |
公開メンバ関数 | |
StepMap () | |
デフォルトコンストラクタ [詳解] | |
void | reset (const step_t step=STEP_MAX) |
ステップマップを初期化する関数 [詳解] | |
step_t | getStep (const int8_t x, const int8_t y) const |
ステップの取得 [詳解] | |
step_t | getStep (const Position p) const |
ステップの取得 [詳解] | |
void | setStep (const int8_t x, const int8_t y, const step_t step) |
ステップの更新 [詳解] | |
void | setStep (const Position p, const step_t step) |
ステップの更新 [詳解] | |
const auto & | getMapArray () const |
ステップマップの生配列への参照を取得 (読み取り専用) [詳解] | |
const auto | getScalingFactor () const |
ステップのスケーリング係数を取得 [詳解] | |
void | print (const Maze &maze, const Position p=Position(-1, -1), const Direction d=Direction::Max, std::ostream &os=std::cout) const |
ステップの表示 [詳解] | |
void | print (const Maze &maze, const Directions &dirs, const Position start=Position(0, 0), std::ostream &os=std::cout) const |
void | printFull (const Maze &maze, const Position p=Position(-1, -1), const Direction d=Direction::Max, std::ostream &os=std::cout) const |
void | printFull (const Maze &maze, const Directions &dirs, const Position start=Position(0, 0), std::ostream &os=std::cout) const |
void | update (const Maze &maze, const Positions &dest, const bool knownOnly, const bool simple) |
ステップマップの更新 [詳解] | |
Directions | calcShortestDirections (const Maze &maze, const Position start, const Positions &dest, const bool knownOnly, const bool simple) |
与えられた区画間の最短経路を導出する関数 [詳解] | |
Directions | calcShortestDirections (const Maze &maze, const bool knownOnly, const bool simple) |
スタートからゴールまでの最短経路を導出する関数 [詳解] | |
Pose | calcNextDirections (const Maze &maze, const Pose &start, Directions &nextDirectionsKnown, Directions &nextDirectionCandidates) const |
ステップマップから次に行くべき方向を計算する関数 [詳解] | |
Directions | getStepDownDirections (const Maze &maze, const Pose &start, Pose &end, const bool knownOnly, const bool simple, const bool breakUnknown) const |
ステップマップにより次に行くべき方向列を生成する [詳解] | |
Directions | getNextDirectionCandidates (const Maze &maze, const Pose &focus) const |
引数区画の周囲の未知壁の確認優先順位を生成する関数 [詳解] | |
静的公開メンバ関数 | |
static void | appendStraightDirections (const Maze &maze, Directions &shortestDirections, const bool knownOnly, const bool diagEnabled) |
ゴール区画内を行けるところまで直進させる方向列を追加する関数 [詳解] | |
静的公開変数類 | |
static constexpr step_t | STEP_MAX |
最大ステップ値 [詳解] | |
限定公開メンバ関数 | |
void | calcStraightCostTable () |
計算の高速化のために予め直進のコストテーブルを計算する関数 [詳解] | |
限定公開変数類 | |
std::array< step_t, Position::SIZE > | stepMap |
迷路中のステップ数 [詳解] | |
std::array< step_t, MAZE_SIZE > | stepTable |
台形加速を考慮した移動コストテーブル (壁沿い方向) [詳解] | |
静的限定公開変数類 | |
static constexpr int | stepTableSize = MAZE_SIZE |
コストテーブルのサイズ [詳解] | |
static constexpr float | scalingFactor = 2 |
コストが最大値を超えないようにスケーリングする係数 [詳解] | |
区画ベースのステップマップを管理するクラス
using MazeLib::StepMap::step_t = uint16_t |
ステップの型
MazeLib::StepMap::StepMap | ( | ) |
デフォルトコンストラクタ
台形加速のコストテーブルを計算する処理を含む
|
static |
ゴール区画内を行けるところまで直進させる方向列を追加する関数
[in] | maze | 使用する迷路 |
[in,out] | shortestDirections | 追記元の方向列。これ自体に追記される。 |
[in] | knownOnly | 未知壁は壁ありとみなし、既知壁のみを使用する |
[in] | diagEnabled | 斜めありなし |
Pose MazeLib::StepMap::calcNextDirections | ( | const Maze & | maze, |
const Pose & | start, | ||
Directions & | nextDirectionsKnown, | ||
Directions & | nextDirectionCandidates | ||
) | const |
ステップマップから次に行くべき方向を計算する関数
[in] | maze | 使用する迷路 |
[in] | start | 移動開始位置 |
[out] | nextDirectionsKnown | 既知区間移動方向列 |
[out] | nextDirectionCandidates | 既知区間移動後の移動方向の優先順位 |
|
inline |
スタートからゴールまでの最短経路を導出する関数
[in] | maze | 使用する迷路 |
[in] | knownOnly | 未知壁は壁ありとみなし、既知壁のみを使用する |
[in] | simple | 台形加速を考慮せず、隣接区画のコストをすべて1にする |
Directions MazeLib::StepMap::calcShortestDirections | ( | const Maze & | maze, |
const Position | start, | ||
const Positions & | dest, | ||
const bool | knownOnly, | ||
const bool | simple | ||
) |
与えられた区画間の最短経路を導出する関数
[in] | maze | 使用する迷路 |
[in] | start | 始点区画 |
[in] | dest | 目的地区画の集合(順不同) |
[in] | knownOnly | 未知壁は壁ありとみなし、既知壁のみを使用する |
[in] | simple | 台形加速を考慮せず、隣接区画のコストをすべて1にする |
|
protected |
計算の高速化のために予め直進のコストテーブルを計算する関数
|
inline |
ステップマップの生配列への参照を取得 (読み取り専用)
Directions MazeLib::StepMap::getNextDirectionCandidates | ( | const Maze & | maze, |
const Pose & | focus | ||
) | const |
引数区画の周囲の未知壁の確認優先順位を生成する関数
[in] | maze | 使用する迷路 |
[in] | focus | 注目する区画の位置姿勢 |
|
inline |
|
inline |
Directions MazeLib::StepMap::getStepDownDirections | ( | const Maze & | maze, |
const Pose & | start, | ||
Pose & | end, | ||
const bool | knownOnly, | ||
const bool | simple, | ||
const bool | breakUnknown | ||
) | const |
ステップマップにより次に行くべき方向列を生成する
[in] | maze | 使用する迷路 |
[in] | start | 移動開始位置 |
[out] | end | 移動後の位置姿勢 |
[in] | knownOnly | 未知壁は壁ありとみなし、既知壁のみを使用する |
[in] | simple | 台形加速を考慮せず、隣接区画のコストをすべて1にする |
[in] | breakUnknown | 未知壁を含む区画に到達したら終了する(探索用) |
void MazeLib::StepMap::print | ( | const Maze & | maze, |
const Directions & | dirs, | ||
const Position | start = Position(0, 0) , |
||
std::ostream & | os = std::cout |
||
) | const |
void MazeLib::StepMap::print | ( | const Maze & | maze, |
const Position | p = Position(-1, -1) , |
||
const Direction | d = Direction::Max , |
||
std::ostream & | os = std::cout |
||
) | const |
ステップの表示
[in] | maze | 表示する迷路 |
[in] | p | ハイライト区画 |
[in] | d | ハイライト方向 |
[in,out] | os | output-stream |
void MazeLib::StepMap::printFull | ( | const Maze & | maze, |
const Directions & | dirs, | ||
const Position | start = Position(0, 0) , |
||
std::ostream & | os = std::cout |
||
) | const |
void MazeLib::StepMap::printFull | ( | const Maze & | maze, |
const Position | p = Position(-1, -1) , |
||
const Direction | d = Direction::Max , |
||
std::ostream & | os = std::cout |
||
) | const |
|
inline |
ステップの更新
盤面外なら何もしない
void MazeLib::StepMap::update | ( | const Maze & | maze, |
const Positions & | dest, | ||
const bool | knownOnly, | ||
const bool | simple | ||
) |
ステップマップの更新
[in] | maze | 更新に使用する迷路情報 |
[in] | dest | ステップを0とする目的地の区画の集合(順不同) |
[in] | knownOnly | true:未知壁は通過不可能、false:未知壁は通過可能とする |
[in] | simple | 台形加速を考慮せず、隣接区画のコストをすべて1にする |
|
staticconstexprprotected |
コストが最大値を超えないようにスケーリングする係数
|
staticconstexpr |
最大ステップ値
|
protected |
迷路中のステップ数
|
staticconstexprprotected |
コストテーブルのサイズ