MicroMouse Maze Library  3703225
クラス | 型定義 | 関数 | 変数
MazeLib 名前空間

迷路探索ライブラリはすべてこの名前空間に格納されている。 [詳解]

クラス

class  Direction
 迷路上の方向を表す。 [詳解]
 
struct  Position
 迷路の区画の位置(座標)を定義。 [詳解]
 
struct  Pose
 PositionDirection をまとめた型。位置姿勢。 [詳解]
 
struct  WallIndex
 区画ベースではなく、壁ベースの管理ID [詳解]
 
struct  WallRecord
 区画位置、方向、壁の有無を保持する構造体。 [詳解]
 
class  Maze
 迷路の壁情報を管理するクラス [詳解]
 
class  StepMap
 区画ベースのステップマップを管理するクラス [詳解]
 

型定義

using Directions = std::vector< Direction >
 Direction 構造体の動的配列、集合 [詳解]
 
using Positions = std::vector< Position >
 Position 構造体の動的配列、集合 [詳解]
 
using WallIndexes = std::vector< WallIndex >
 WallIndex の動的配列、集合 [詳解]
 
using WallRecords = std::vector< WallRecord >
 WallRecord 構造体の動的配列の定義 [詳解]
 

関数

std::ostream & operator<< (std::ostream &os, const Directions &obj)
 Directions の stream 表示 [詳解]
 
std::ostream & operator<< (std::ostream &os, const Position p)
 
std::ostream & operator<< (std::ostream &os, const Pose &pose)
 
std::ostream & operator<< (std::ostream &os, const WallIndex i)
 
std::ostream & operator<< (std::ostream &os, const WallRecord &obj)
 
static StepMap::step_t calcStraightCost (const int i, const float am, const float vs, const float vm, const float seg)
 台形加速を考慮したコストを生成する関数 [詳解]
 

変数

static constexpr int MAZE_SIZE = 16
 迷路の1辺の区画数の定数。 [詳解]
 
static constexpr int MAZE_SIZE_BIT = std::ceil(std::log2(MAZE_SIZE))
 迷路の1辺の区画数の bit 数。bit shift などに用いる。 [詳解]
 
static constexpr int MAZE_SIZE_MAX = std::pow(2, MAZE_SIZE_BIT)
 迷路の1辺の区画数の最大値。2のbit数乗の値。 [詳解]
 

詳解

迷路探索ライブラリはすべてこの名前空間に格納されている。

型定義詳解

◆ Directions

using MazeLib::Directions = typedef std::vector<Direction>

Direction 構造体の動的配列、集合

◆ Positions

using MazeLib::Positions = typedef std::vector<Position>

Position 構造体の動的配列、集合

◆ WallIndexes

using MazeLib::WallIndexes = typedef std::vector<WallIndex>

WallIndex の動的配列、集合

◆ WallRecords

using MazeLib::WallRecords = typedef std::vector<WallRecord>

WallRecord 構造体の動的配列の定義

関数詳解

◆ calcStraightCost()

static StepMap::step_t MazeLib::calcStraightCost ( const int  i,
const float  am,
const float  vs,
const float  vm,
const float  seg 
)
static

台形加速を考慮したコストを生成する関数

引数
iマスの数
am最大加速度
vs始点速度
vm飽和速度
seg1マスの長さ
戻り値
StepMap::step_t コスト
408  {
409  const auto d = seg * i; //< i 区画分の走行距離
410  /* グラフの面積から時間を求める */
411  const auto d_thr = (vm * vm - vs * vs) / am; //< 最大速度に達する距離
412  if (d < d_thr)
413  return 2 * (std::sqrt(vs * vs + am * d) - vs) / am * 1000; //< 三角加速
414  else
415  return (am * d + (vm - vs) * (vm - vs)) / (am * vm) * 1000; //< 台形加速
416 }
unsigned int d
壁の方向
Definition: Maze.h:609

◆ operator<<() [1/5]

std::ostream & MazeLib::operator<< ( std::ostream &  os,
const Directions obj 
)

Directions の stream 表示

>^<v の形式

16  {
17  for (const auto d : obj) os << d;
18  return os;
19 }

◆ operator<<() [2/5]

std::ostream& MazeLib::operator<< ( std::ostream &  os,
const Pose pose 
)
66  {
67  return os << "( " << std::setw(2) << +pose.p.x << ", " << std::setw(2)
68  << +pose.p.y << ", " << pose.d.toChar() << ")";
69 }

◆ operator<<() [3/5]

std::ostream& MazeLib::operator<< ( std::ostream &  os,
const Position  p 
)
60  {
61  return os << "( " << std::setw(2) << +p.x << ", " << std::setw(2) << +p.y
62  << ")";
63 }

◆ operator<<() [4/5]

std::ostream& MazeLib::operator<< ( std::ostream &  os,
const WallIndex  i 
)
95  {
96  return os << "( " << std::setw(2) << +i.x << ", " << std::setw(2) << +i.y
97  << ", " << i.getDirection().toChar() << ")";
98 }

◆ operator<<() [5/5]

std::ostream& MazeLib::operator<< ( std::ostream &  os,
const WallRecord obj 
)
101  {
102  return os << "( " << std::setw(2) << +obj.x << ", " << std::setw(2) << +obj.y
103  << ", " << obj.getDirection().toChar() << ", "
104  << (obj.b ? "true" : "false") << ")";
105 }

変数詳解

◆ MAZE_SIZE

constexpr int MazeLib::MAZE_SIZE = 16
staticconstexpr

迷路の1辺の区画数の定数。

◆ MAZE_SIZE_BIT

constexpr int MazeLib::MAZE_SIZE_BIT = std::ceil(std::log2(MAZE_SIZE))
staticconstexpr

迷路の1辺の区画数の bit 数。bit shift などに用いる。

◆ MAZE_SIZE_MAX

constexpr int MazeLib::MAZE_SIZE_MAX = std::pow(2, MAZE_SIZE_BIT)
staticconstexpr

迷路の1辺の区画数の最大値。2のbit数乗の値。