n-Dimensional Fast Methods  0.7
 All Classes Functions Variables Typedefs Pages
FM2< grid_t, heap_t > Class Template Reference

Implements the Fast Marching Square (FM2) planning algorithm. More...

#include <fm2.hpp>

Inheritance diagram for FM2< grid_t, heap_t >:
Collaboration diagram for FM2< grid_t, heap_t >:

Public Types

typedef std::vector
< std::array< double,
grid_t::getNDims()> > 
path_t
 Path type encapsulation.
 

Public Member Functions

 FM2 (double maxDistance=-1)
 maxDistance sets the velocities map saturation distance in real units (before normalization).
 
 FM2 (const char *name, double maxDistance=-1)
 maxDistance sets the velocities map saturation distance in real units (before normalization).
 
virtual void setEnvironment (grid_t *g)
 Sets the environment to run the solver and sets the sources for the velocities map computation.
 
virtual void setup ()
 Sets up the solver to check whether is ready to run.
 
virtual void computeInternal ()
 Implements the actual FM2 method.
 
void computeVelocitiesMap ()
 Computes the velocities map of the FM2 algorithm. If maxDistance_ != -1 then the map is saturated to the set value. It is then normalized: velocities in [0,1].
 
virtual void computePath (path_t *p, std::vector< double > *path_velocity, double step=1)
 Encapsulates the path extraction. More...
 
virtual void clear ()
 Clears the solver, it is not recommended to be used out of the destructor.
 
virtual void reset ()
 Clears temporal data, so it is ready to run again.
 
virtual double getTimeVelocities () const
 Returns velocities map computation time.
 
- Public Member Functions inherited from Solver< grid_t >
 Solver (const std::string &name)
 
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.
 
virtual void setInitialPoints (const std::vector< unsigned int > &init_points)
 Sets the initial points by the indices of the grid.
 
virtual void setInitialAndGoalPoints (const std::array< unsigned int, grid_t::getNDims()> &init_coord, const std::array< unsigned int, grid_t::getNDims()> &goal_coord)
 Sets the initial and goal points by the coordinates of the grid.
 
virtual void setInitialPoints (const std::array< unsigned int, grid_t::getNDims()> &init_coord)
 Sets the initial point by the coordinates of the grid.
 
void compute ()
 Computes the distances map. Will call setup() if not done already.
 
template<class T >
T * as ()
 Cast this instance to a desired type.
 
template<class T >
const T * as () const
 Cast this instance to a desired type.
 
const std::string & getName () const
 Returns name of the solver.
 
grid_t * getGrid () const
 Returns a pointer to the grid used.
 
virtual double getTime () const
 
virtual void printRunInfo () const
 

Protected Attributes

std::vector< unsigned int > fm2_sources_
 Wave propagation sources for the Fast Marching Square velocities map computation.
 
FMM< grid_t, heap_t > * solver_
 Underlying FMM-based solver.
 
double maxDistance_
 Distance value to saturate the first potential.
 
double time_vels_
 Time elapsed in the velocities map computation.
 
- Protected Attributes inherited from Solver< grid_t >
grid_t * grid_
 Grid container.
 
std::string name_
 Solver name.
 
bool setup_
 Setup status.
 
std::vector< unsigned int > init_points_
 Initial index.
 
unsigned int goal_idx_
 Goal index.
 
std::chrono::time_point
< std::chrono::steady_clock > 
start_
 Time measurement variables.
 
std::chrono::time_point
< std::chrono::steady_clock > 
end_
 
double time_
 Time elapsed by the compute method.
 

Additional Inherited Members

- Protected Member Functions inherited from Solver< grid_t >
int sanityChecks ()
 Performs different check before a solver can proceed.
 

Detailed Description

template<class grid_t, class heap_t = FMDaryHeap<FMCell>>
class FM2< grid_t, heap_t >

Todo:
Include support to other solvers (GMM, FIM, UFMM). It requires a better way of setting parameters.

It uses as a main container the nDGridMap class. The nDGridMap template parameter has to be an FMCell or something inherited from it. It also uses a heap type in order to specify the underlying FMM.

IMPORTANT NOTE: When running FM2 many times on the same grid it is recommended to completely restart the grid (erase and create or resize). See test_fm2.cpp.

External documentation:
FM2: A. Valero, J.V. Gómez, S. Garrido and L. Moreno, The Path to Efficiency: Fast Marching Method for Safer, More Efficient Mobile Robot Trajectories, IEEE Robotics and Automation Magazine, Vol. 20, No. 4, 2013.

Copyright (C) 2014 Javier V. Gomez and Jose Pardeiro www.javiervgomez.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition at line 49 of file fm2.hpp.

Member Function Documentation

template<class grid_t , class heap_t = FMDaryHeap<FMCell>>
virtual void FM2< grid_t, heap_t >::computePath ( path_t p,
std::vector< double > *  path_velocity,
double  step = 1 
)
inlinevirtual

Computes the path from the given goal index to the minimum of the times of arrival map. No checks are done (points in the borders, points in obstacles...).

Parameters
ppath the resulting path (output).
path_velocityvelocity the resulting path (output).
goal_idxindex of the goal point, where gradient descent will start. If no specified, the previously set goal point is used.

Definition at line 161 of file fm2.hpp.


The documentation for this class was generated from the following file: