45 TrajectorySimulator::TrajectorySimulator(
StateSimPtr _stateSim)
49 , canComputeDistLattice_(
stateSim_->paramFuncsDist() != nullptr)
63 unique_ptr<TrajectorySimulator::CostsEvaluatorClass> _costsEvaluator)
79 for (
size_t i = 0; i < _userDefLattices.size(); ++i)
103 const std::size_t& _minArcLatCacheIdx)
114 const std::size_t& _minArcLatCacheIdx)
117 partLatticeNow.arc = _arcNow;
177 if (_firstLaticeInvalidIdx == 0)
214 const double arcParamMax =
stateSim_->paramFuncs()->funcsArcEnd();
223 simLatticeSize = max(simLatticeSize, (
size_t)0);
227 double minArcLatticeVal = 0;
258 size_t itEnd = (int)_arcParamMax /
dt() + 1;
260 for (
size_t aPLIdx = _firstLaticeInvalidIdx + 1; aPLIdx < itEnd; ++aPLIdx)
276 bool emptyExtArcLat =
true;
281 emptyExtArcLat =
false;
285 return emptyExtArcLat;
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.
static bool cmpLatticePt(const TrajectorySimulator::LatticePoint &a, const TrajectorySimulator::LatticePoint &b)
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.
double & dtBase()
Reference to arc parametrization interval used for the equal arc-length lattice.
virtual void populatePartSimLatticesGeneral(size_t _firstLaticeInvalidIdx, double _arcParamMax, double _minArcLatticeVal)=0
Performs simulation and populates simulation and partial lattices in the general case of various enab...
void setBoolDsScale(const bool &_doScale)
std::unique_ptr< CostsEvaluatorClass > costsEvaluator_
void appendToPartLat(const double &_arcNow, const int &_latticePtType, const std::size_t &_minArcLatCacheIdx)
Appends the new arc and state pointer to the afferent partial lattice point.
Structure containing the lattice type afferent to a.
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
void setBeginStateToLattices(const double &_arcBegin)
Binds reference to the initial simulated state (at.
std::vector< LatticePoint > LatticeVec
bool initSimLatticeState0(const double &_lastValidArc, size_t &_firstLaticeInvalidIdx)
Initializes the simulation lattice (truncation from the.
double dt_
Arc parametrization interval used for the equal arc-length lattice.
std::vector< std::vector< double * > > userDefPartLattices_
std::vector< LatticePointType > & simLattice()
Reference to the lattice that requested each simulated trajectory state.
virtual void populatePartSimLatticesDtOnly(const size_t &_firstLaticeInvalidIdx, double _arcParamMax)
Performs simulation and populates simulation and partial lattice when only equal dt lattice is enable...
bool isEmptyAllExtLattices() const
Returns true if all extended lattices are empty (the DS lattice as well as user-defined lattices)...
BaseSimLatticeType
Fundamental lattice types.
static constexpr const std::size_t extArcLatIdxBegin
Structure containing an evaluation arc and a state pointer.
TrajectorySimulator(StateSimPtr _stateSim)
void setBoolDtScale(const bool &_doScale)
void setEndStateToLattices(const double &_arcEnd)
Binds reference to the final simulated state (at.
void setUserDefLattice(const std::vector< std::vector< double * > > &_userDefLattices)
const double & dt() const
Const reference to arc parametrization interval used for the equal arc-length lattice.
std::shared_ptr< StateSim > StateSimPtr
double ds_
Arc parametrization interval used for the equal distance lattice.
StateSimPtr stateSim()
Reference of the state simulator object.
void simAppendToSimPartLat(const double &_arcNow, const int &_latticePtType, const std::size_t &_minArcLatCacheIdx)
Performs a simulation step (if.
std::shared_ptr< StateType > StateSPtr
double & dsBase()
Reference to arc parametrization interval used for the equal distance lattice.
static size_t lattTypeIdx(int _enumIdx)
Converts shifted (int) lattice index to container (size_t) index.
void updateUserDefLattice()
StateSimSPtr stateSim_
State simulator object.