31 #include <fast_methods/fm/eikonalsolver.hpp>
59 unsigned int n_neighs;
61 bool stopWavePropagation =
false;
64 tm_= std::numeric_limits<double>::infinity();
66 grid_->getCell(i).setArrivalTime(0);
67 grid_->getCell(i).setState(FMState::FROZEN);
69 for (
unsigned int s = 0; s < n_neighs; ++s){
71 if ((
grid_->getCell(j).getState() == FMState::FROZEN) ||
grid_->getCell(j).isOccupied())
75 if (new_arrival_time <
tm_){
76 tm_ = new_arrival_time;
78 grid_->getCell(j).setArrivalTime(new_arrival_time);
79 grid_->getCell(j).setState(FMState::NARROW);
86 while(!stopWavePropagation && !
gamma_.empty()) {
90 std::list<unsigned int>::reverse_iterator k =
gamma_.rbegin();
91 std::list<unsigned int>::iterator i = k.base();
94 std::list<unsigned int>::iterator q = k.base();
100 if(
grid_->getCell(*i).getArrivalTime() <=
tm_) {
102 for (
unsigned int s = 0; s < n_neighs; ++s){
104 if ( (
grid_->getCell(j).getState() == FMState::FROZEN) ||
grid_->getCell(j).isOccupied() || (
grid_->getCell(j).getVelocity() == 0))
108 if (new_arrival_time < grid_->getCell(j).getArrivalTime())
109 grid_->getCell(j).setArrivalTime(new_arrival_time);
116 const size_t narrow_size =
gamma_.size();
118 for(
size_t z = 0; z < narrow_size; ++z) {
119 if(
grid_->getCell(*i).getArrivalTime()<=
tm_) {
121 for (
unsigned int s = 0; s < n_neighs; ++s) {
123 if ((
grid_->getCell(j).getState() == FMState::FROZEN) ||
grid_->getCell(j).isOccupied() || (
grid_->getCell(j).getVelocity() == 0))
127 if (new_arrival_time < grid_->getCell(j).getArrivalTime()) {
128 grid_->getCell(j).setArrivalTime(new_arrival_time);
130 if (
grid_->getCell(j).getState() == FMState::OPEN){
132 grid_->getCell(j).setState(FMState::NARROW);
136 grid_->getCell(*i).setState(FMState::FROZEN);
138 stopWavePropagation =
true;
Abstract class that serves as interface for the actual EikonalSolvers implemented. It requires (at least) the computeInternal method to be implemented,.
double deltau_
For each updating step, tm_ is increased by this value.
virtual void setup()
Checks that the solver is ready to run. Sets the grid unclean.
virtual void reset()
Clears temporal data, so it is ready to run again.
std::array< unsigned int, 2 *grid_t::getNDims()> neighbors_
Auxiliar array which stores the neighbor of each iteration of the computeFM() function.
virtual double solveEikonal(const int &idx)
Solves nD Eikonal equation for cell idx. If heuristics are activated, it will add the estimated trave...
grid_t * grid_
Grid container.
double tm_
Global bound that determines the group of cells of gamma that will be updated in each step...
std::vector< unsigned int > init_points_
Initial index.
virtual void computeInternal()
Actual method that implements GMM.
void setup()
Checks that the solver is ready to run. Sets the grid unclean.
virtual void clear()
Clears the solver, it is not recommended to be used out of the destructor.
unsigned int goal_idx_
Goal index.
Templated class which computes Group Marching Method (GMM).
virtual void reset()
Clears temporal data, so it is ready to run again.
std::list< unsigned int > gamma_
List wich stores the narrow band of each iteration.