Buran Motion Planning Framework
one_direction_sync_path_finder.h
1 #pragma once
2 
3 #include <memory>
4 #include <unordered_map>
5 #include <set>
6 #include <utility>
7 #include <unordered_set>
8 #include <base/grid_path_finder.h>
9 #include <future>
10 #include <solid_collider.h>
11 #include "solid_sync_collider.h"
12 #include "scene.h"
13 #include "one_direction_path_finder.h"
14 
15 namespace bmpf {
50  public:
62  OneDirectionSyncPathFinder(const std::shared_ptr<bmpf::Scene> &scene,
63  bool showTrace,
64  unsigned int maxOpenSetSize,
65  int gridSize,
66  unsigned int maxNodeCnt,
67  unsigned int kG = 1,
68  unsigned int kD = 0,
69  int threadCnt = 1)
70  : OneDirectionPathFinder(scene, showTrace, maxOpenSetSize, gridSize, maxNodeCnt, kG, kD, threadCnt) {
71 
72  // инициализируем многопоточный коллайдер
73  _collider = std::make_shared<bmpf::SolidSyncCollider>(threadCnt);
74  _collider->init(scene->getGroupedModelPaths(), false);
75 
76  // разбиваем смещения по пакетам
77  std::vector<std::vector<int>> group;
78  int cnt = 0;
79  for (auto &offset: _offsetList) {
80  group.emplace_back(offset);
81  cnt++;
82  if (cnt >= threadCnt) {
83  _groupedOffsetList.emplace_back(group);
84  group.clear();
85  cnt = 0;
86  }
87 
88  }
89  };
90 
91  protected:
92 
102  std::shared_ptr<PathNode> _forEachNeighbor(
103  std::shared_ptr<PathNode> currentNode,
104  std::vector<int> &endCoords
105  ) override;
106 
111  std::vector<std::vector<std::vector<int>>> _groupedOffsetList;
112  };
113 
114 }
bmpf::OneDirectionPathFinder::_offsetList
std::vector< std::vector< int > > _offsetList
Definition: one_direction_path_finder.h:97
bmpf::OneDirectionSyncPathFinder::_forEachNeighbor
std::shared_ptr< PathNode > _forEachNeighbor(std::shared_ptr< PathNode > currentNode, std::vector< int > &endCoords) override
Definition: one_direction_sync_path_finder.cpp:44
bmpf::OneDirectionSyncPathFinder
Definition: one_direction_sync_path_finder.h:49
bmpf::PathFinder::_collider
std::shared_ptr< bmpf::Collider > _collider
Definition: path_finder.h:246
bmpf::OneDirectionSyncPathFinder::OneDirectionSyncPathFinder
OneDirectionSyncPathFinder(const std::shared_ptr< bmpf::Scene > &scene, bool showTrace, unsigned int maxOpenSetSize, int gridSize, unsigned int maxNodeCnt, unsigned int kG=1, unsigned int kD=0, int threadCnt=1)
Definition: one_direction_sync_path_finder.h:62
bmpf::OneDirectionPathFinder
Definition: one_direction_path_finder.h:44
bmpf::OneDirectionSyncPathFinder::_groupedOffsetList
std::vector< std::vector< std::vector< int > > > _groupedOffsetList
Definition: one_direction_sync_path_finder.h:111