48 unique_ptr<CostsEvaluatorClass> _costsEvaluator)
59 const double arcParamMax =
stateSim_->paramFuncs()->funcsArcEnd();
66 static vector<double> dsLattice;
70 stateSim_->paramFuncsDist()->computeS2TLattice(0,
ds(), dsLattice);
71 partLatticeDs->resize(dsLattice.size());
72 for (
size_t i = 0; i < dsLattice.size(); ++i)
74 partLatticeDs->at(i).arc = dsLattice[i];
79 stateSim_->paramFuncsDist()->computeS2TLattice(_lastValidArc,
ds(), dsLattice);
80 const double& firstDsLattice = dsLattice[0];
81 size_t idxFirstInvalidDs = max(0, (
int)partLatticeDs->size() - 2);
82 for (
size_t i = 1; i < partLatticeDs->size(); ++i)
84 if (partLatticeDs->at(i).arc > firstDsLattice + 1e-3)
86 idxFirstInvalidDs = --i;
90 partLatticeDs->resize(idxFirstInvalidDs + dsLattice.size());
91 for (
size_t i = 0; i < dsLattice.size(); ++i)
93 partLatticeDs->at(i + idxFirstInvalidDs).arc = dsLattice[i];
102 size_t firstLaticeInvalidIdx = 0;
114 double _minArcLatticeVal)
119 size_t arcParamLatticeIdx = max(0, (
int)(_minArcLatticeVal /
dt()));
120 size_t minArcLatCacheIdx =
125 const size_t deltaArcParamLattice = max(0, (
int)(_minArcLatticeVal /
dt()) - (
int)arcParamLatticeIdx);
126 const size_t simLatticeInjectEnd = ++_firstLaticeInvalidIdx + deltaArcParamLattice;
128 for (; _firstLaticeInvalidIdx < simLatticeInjectEnd; ++_firstLaticeInvalidIdx)
136 if (idxMinLatticePt + 1 < (
int)
partLattices_[minArcLatCacheIdx]->size())
142 const double simLatticeInjectEnd = _arcParamMax /
dt();
143 ++arcParamLatticeIdx;
144 for (; arcParamLatticeIdx < simLatticeInjectEnd; ++arcParamLatticeIdx)
155 double minArc = FLT_MAX;
StateSimPtr stateSim_
State simulator object.
LatticeVecSPtrVec partLattices_
Vector containing the ordered sequence of arc parametrizations for each of the used lattices...
void populateTrajSimPartLattice(const size_t &_firstLaticeInvalidIdx)
Main function that performs resizing, reserving and calls the proper population function.
size_t simLatticeSize() const
void setBeginEndArcsToLattices(const double &_arcBegin, const double &_arcEnd)
Sets begin and end arcs to all partial lattices on the first and last container positions.
void populatePartSimLatticesGeneral(size_t _firstLaticeInvalidIdx, double _arcParamMax, double _minArcLatticeVal) override
Performs simulation and populates simulation and partial lattices in the general case of various enab...
std::vector< int > partLatIdxCache_
Vector containing cached container indices for each partial lattice related to the the highest arc lo...
void initExtLatticeCache(const double &_minArcLatticeVal)
Initializes the cached partial lattices index at the highest arc lower than.
std::unique_ptr< CostsEvaluatorClass > costsEvaluator_
Helper function needed to upgrade c++ 2011.
const double & ds() const
Const reference to arc parametrization interval used for the equal distance lattice.
constexpr auto asInt(Enumeration const value) -> typename std::underlying_type< Enumeration >::type
size_t getMinArcLatCacheIdx() const
Returns the partial lattice cached index that has the smallest arc.
bool initSimLatticeState0(const double &_lastValidArc, size_t &_firstLaticeInvalidIdx)
Initializes the simulation lattice (truncation from the.
BaseSimLatticeType
Fundamental lattice types.
static constexpr const std::size_t extArcLatIdxBegin
Structure containing an evaluation arc and a state pointer.
bool canComputeDistLattice_
Flags if the StateSim object has access to the StateSimDist functionality.
TrajectorySimulator(StateSimPtr _stateSim)
void setEndStateToLattices(const double &_arcEnd)
Binds reference to the final simulated state (at.
void simulateTrajectory(double _lastValidArc=0) override
Simulates (discrete numerical evaluation) an entire trajectory according to the specified intervals a...
const double & dt() const
Const reference to arc parametrization interval used for the equal arc-length lattice.
std::shared_ptr< StateSim > StateSimPtr
void simAppendToSimPartLat(const double &_arcNow, const int &_latticePtType, const std::size_t &_minArcLatCacheIdx)
Performs a simulation step (if.
static size_t lattTypeIdx(int _enumIdx)
Converts shifted (int) lattice index to container (size_t) index.
TrajectorySimulatorPrecalc(StateSimPtr _stateSim)
void updateUserDefLattice()