45 unique_ptr<CostsEvaluatorClass> _costsEvaluator)
56 size_t firstLaticeInvalidIdx = 0;
71 static double add, ans;
73 temp = ceil(_x / _dx);
78 ans = (++add + temp) * _dx;
84 double _minArcLatticeVal)
90 double& arcLatNextMin = _minArcLatticeVal = 0;
91 double arcLatEqDtNext = 0;
92 double arcLatEqDsNext = 0;
93 double arcLatOldMin = arcLatNextMin;
95 while (arcLatNextMin < _arcParamMax)
99 arcLatNextMin = arcLatEqDtNext;
102 arcLatEqDsNext = FLT_MAX;
105 static double arcTemp;
108 stateSim_->paramFuncsDist()->setEvalDist(distLatticeNext);
109 arcLatEqDsNext =
stateSim_->paramFuncs()->funcsArcEval();
110 arcLatNextMin = fmin(arcLatNextMin, arcLatEqDsNext);
111 stateSim_->paramFuncs()->setEvalArc(arcTemp);
135 if (arcLatNextMin == 0)
139 static constexpr
const int uninitLattTypeVal = -100;
140 if (arcLatNextMin <= _arcParamMax)
154 (fabs(arcLatNextMin - arcLatEqDtNext) <= FLT_MIN)) ||
155 ((iPart ==
lattTypeIdx(
asInt(BSLT::LATTICE_ARC_EQ_DS))) && (fabs(arcLatNextMin - arcLatEqDsNext) <= FLT_MIN)))
157 if (arcLatNextMin < _arcParamMax)
175 if (fabs(arcLatNextMin - partLattII.
arc) <= FLT_MIN)
186 partLattII.
arc = arcLatNextMin;
220 arcLatOldMin = arcLatNextMin;
264 size_t itEnd = (int)_arcParamMax /
dt() + 1;
266 for (
size_t aPLIdx = _firstLaticeInvalidIdx + 1; aPLIdx < itEnd; ++aPLIdx)
268 double arcLatNextMin = aPLIdx *
dt();
277 if (_arcParamMax == 0)
287 size_t firstInvalidIdx = distance(
313 for (
size_t i = 0; i < partLatTime->size(); ++i)
315 partLatTime->at(i).arc = i *
dt();
StateSimPtr stateSim_
State simulator object.
LatticeVecSPtrVec partLattices_
Vector containing the ordered sequence of arc parametrizations for each of the used lattices...
std::vector< LatticePointType > simulationLattice_
Lattice requesting each simulated trajectory state.
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.
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.
void populatePartSimLatticesDtOnly(const size_t &_firstLaticeInvalidIdx, double _arcParamMax) override
Performs simulation and populates simulation and partial lattice when only equal dt lattice is enable...
void simulateTrajectory(double _lastValidArc=0) override
Simulates (discrete numerical evaluation) an entire trajectory according to the specified intervals a...
std::unique_ptr< CostsEvaluatorClass > costsEvaluator_
Structure containing the lattice type afferent to a.
Helper function needed to upgrade c++ 2011.
void populatePartSimLatticesGeneral(std::size_t _firstLaticeInvalidIdx, double _arcParamMax, double _minArcLatticeVal) override
const double & ds() const
Const reference to arc parametrization interval used for the equal distance lattice.
double toNextIntMult(const double &_x, const double &_dx) const
Numeric safe incremental rounding of x (finds the smallest multiple of.
constexpr auto asInt(Enumeration const value) -> typename std::underlying_type< Enumeration >::type
TrajectorySimulatorOnline(StateSimPtr _stateSim)
bool initSimLatticeState0(const double &_lastValidArc, size_t &_firstLaticeInvalidIdx)
Initializes the simulation lattice (truncation from the.
BaseSimLatticeType
Fundamental lattice types.
Structure containing an evaluation arc and a state pointer.
bool canComputeDistLattice_
Flags if the StateSim object has access to the StateSimDist functionality.
void resizeBeginGeneral(const double &_arcParamMax)
Performs lattices resizing relevant to the general online simulation algorithm.
TrajectorySimulator(StateSimPtr _stateSim)
void setEndStateToLattices(const double &_arcEnd)
Binds reference to the final simulated state (at.
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.
void resizeBeginDtOnly(const double &_arcParamMax)
Performs lattices resizing relevant to the DT-only online simulation algorithm.
std::shared_ptr< StateType > StateSPtr
static size_t lattTypeIdx(int _enumIdx)
Converts shifted (int) lattice index to container (size_t) index.
void updateUserDefLattice()