Implements the Fast Marching Square (FM2) planning algorithm. More...
#include <fm2.hpp>


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. | |
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.
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/.
|
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...).
| p | path the resulting path (output). |
| path_velocity | velocity the resulting path (output). |
| goal_idx | index of the goal point, where gradient descent will start. If no specified, the previously set goal point is used. |