43 #include <fast_methods/ndgridmap/fmcell.h>
44 #include <fast_methods/fm/fmm.hpp>
45 #include <fast_methods/fm2/fm2.hpp>
46 #include <fast_methods/gradientdescent/gradientdescent.hpp>
51 template <
class gr
id_t,
class heap_t = FMDaryHeap<FMCell> >
class FM2Star :
public FM2<grid_t, heap_t> {
54 typedef std::vector< std::array<double, grid_t::getNDims()> >
path_t;
62 (HeurStrategy heurStrategy = TIME,
double maxDistance = -1) :
FM2Base(
"FM2*", maxDistance),
heurStrategy_(heurStrategy) { }
66 (
const char * name, HeurStrategy heurStrategy = TIME,
double maxDistance = -1) :
FM2Base(name, maxDistance),
heurStrategy_(heurStrategy) { }
70 (
const std::vector<unsigned int> & init_points,
unsigned int goal_idx) {
81 console::error(
"A goal point has to be set for FM2-based solvers.");
95 start_ = std::chrono::steady_clock::now();
98 std::vector <unsigned int> wave_init;
102 solver_->setInitialAndGoalPoints(wave_init, wave_goal);
106 grid_->setClean(
false);
virtual void setInitialAndGoalPoints(const std::vector< unsigned int > &init_points, unsigned int goal_idx)
Overloaded from FM2. In this case the precomputeDistances() method is called.
FMM< grid_t, heap_t > * solver_
Underlying FMM-based solver.
HeurStrategy heurStrategy_
Stores the heuristic strategy to be used.
static void error(const std::string &val)
void computeVelocitiesMap()
Computes the velocities map of the FM2 algorithm. If maxDistance_ != -1 then the map is saturated to ...
FM2< grid_t, heap_t > FM2Base
Shorthand of the base clase.
Implements the Fast Marching Square Star (FM2*) planning algorithm.
grid_t * grid_
Grid container.
double maxDistance_
Distance value to saturate the first potential.
virtual void setInitialAndGoalPoints(const std::vector< unsigned int > &init_points, unsigned int goal_idx)
Sets the initial and goal points by the indices of the grid.
std::vector< std::array< double, grid_t::getNDims()> > path_t
Path type encapsulation.
std::vector< unsigned int > init_points_
Initial index.
virtual void computeInternal()
Implements the actual FM2 method.
virtual void setup()
Sets up the solver to check whether is ready to run.
virtual void setup()
Sets up the solver to check whether is ready to run.
std::chrono::time_point< std::chrono::steady_clock > start_
Time measurement variables.
Implements the Fast Marching Square (FM2) planning algorithm.
unsigned int goal_idx_
Goal index.
FM2Star(HeurStrategy heurStrategy=TIME, double maxDistance=-1)
maxDistance sets the velocities map saturation distance in real units (before normalization).