29 #ifndef POINT_EXPANDER_H 30 #define POINT_EXPANDER_H 32 #define POT_HIGH 1.0e10 36 #include <opencv/cv.h> 37 #include <unordered_set> 39 #include <eigen3/Eigen/Dense> 64 bool findGoalOnMap(
const Eigen::Vector2d &_start,
const uint32_t &_cycles,
float *_potential,
const std::map<uint32_t, Eigen::Vector2d> &_goals,
const uint32_t &_optimizationSteps, Eigen::Vector2d &_foundPoint, int32_t &_segIdx,
const uint32_t &_radius);
72 template <
class T,
class S,
class C>
73 void clearpq(std::priority_queue<T, S, C> &q)
75 q = std::priority_queue<T, S, C>();
80 Index(
int index,
float c,
float d,
float p)
88 Index(
int x_val,
int y_val,
int nx,
float c,
float d,
float p)
90 i = x_val + y_val * nx;
98 int x_val = (
i % nx) + dist_x;
99 int y_val = (
i / nx) + dist_y;
101 if (x_val < 0 || x_val > nx || y_val < 0 || y_val > ny)
102 return Index(-1, -1, -1, -1);
104 return Index(x_val, y_val, nx, 0, 0, 0);
119 float dx = abs(
getX(_nx) - _p.
getX(_nx));
120 float dy = abs(
getY(_nx) - _p.
getY(_nx));
122 return std::sqrt(dx * dx + dy * dy);
141 Index findGoal(
const Index &_start,
const uint32_t &_cycles,
float *_potential,
const std::map<uint32_t, Index> &_goals,
const uint32_t &_optimizationSteps, int32_t &segIdx,
const uint32_t &_radius);
143 bool isGoal(
Index _p,
const std::map<uint32_t, Index> &_goals, int32_t &segIdx);
149 #endif // VORONOI_EXPANDER_H float distance(Index _p, int _nx)
Index(int x_val, int y_val, int nx, float c, float d, float p)
void addPotentialExpansionCandidate(Index _current, int32_t _next_x, int32_t _next_y, float *_potential, uint32_t _distToObstacle)
bool findGoalOnMap(const Eigen::Vector2d &_start, const uint32_t &_cycles, float *_potential, const std::map< uint32_t, Eigen::Vector2d > &_goals, const uint32_t &_optimizationSteps, Eigen::Vector2d &_foundPoint, int32_t &_segIdx, const uint32_t &_radius)
searches the first occurence of a point in the goals_ list and returns the index
float getDistanceToObstacle(const Eigen::Vector2d &vec)
returns the distance to the closest obstacle for a point
void clearpq(std::priority_queue< T, S, C > &q)
void initialize(const cv::Mat &_map)
initializes the point expander with a distance map
Index findGoal(const Index &_start, const uint32_t &_cycles, float *_potential, const std::map< uint32_t, Index > &_goals, const uint32_t &_optimizationSteps, int32_t &segIdx, const uint32_t &_radius)
std::priority_queue< Index, std::vector< Index >, greater1 > queue_
bool operator()(const Index &a, const Index &b) const
Index offsetDist(int dist_x, int dist_y, int nx, int ny)
Index(int index, float c, float d, float p)
bool isGoal(Index _p, const std::map< uint32_t, Index > &_goals, int32_t &segIdx)