Public Member Functions | Private Member Functions | List of all members
tuw::TrajectorySimulatorPrecalc Class Reference

#include <trajectory_simulator_precalc.h>

Inheritance diagram for tuw::TrajectorySimulatorPrecalc:
Inheritance graph
[legend]

Public Member Functions

TrajectorySimulatorPrecalcoperator= (const TrajectorySimulatorPrecalc &)=default
 
TrajectorySimulatorPrecalcoperator= (TrajectorySimulatorPrecalc &&)=default
 
void simulateTrajectory (double _lastValidArc=0) override
 Simulates (discrete numerical evaluation) an entire trajectory according to the specified intervals and lattices. More...
 
 TrajectorySimulatorPrecalc (StateSimPtr _stateSim)
 
 TrajectorySimulatorPrecalc (StateSimPtr _stateSim, std::unique_ptr< CostsEvaluatorClass > _costsEvaluator)
 
 TrajectorySimulatorPrecalc (const TrajectorySimulatorPrecalc &)=default
 
 TrajectorySimulatorPrecalc (TrajectorySimulatorPrecalc &&)=default
 
virtual ~TrajectorySimulatorPrecalc ()=default
 
- Public Member Functions inherited from tuw::TrajectorySimulator< TNumType, TSimType >
const double & ds () const
 Const reference to arc parametrization interval used for the equal distance lattice. More...
 
const TNumType & ds () const
 Const reference to arc parametrization interval used for the equal distance lattice. More...
 
double & dsBase ()
 Reference to arc parametrization interval used for the equal distance lattice. More...
 
TNumType & dsBase ()
 Reference to arc parametrization interval used for the equal distance lattice. More...
 
const double & dt () const
 Const reference to arc parametrization interval used for the equal arc-length lattice. More...
 
const TNumType & dt () const
 Const reference to arc parametrization interval used for the equal arc-length lattice. More...
 
double & dtBase ()
 Reference to arc parametrization interval used for the equal arc-length lattice. More...
 
TNumType & dtBase ()
 Reference to arc parametrization interval used for the equal arc-length lattice. More...
 
TrajectorySimulatoroperator= (const TrajectorySimulator &)=default
 
TrajectorySimulatoroperator= (TrajectorySimulator &&)=default
 
TrajectorySimulatoroperator= (const TrajectorySimulator &)=default
 
TrajectorySimulatoroperator= (TrajectorySimulator &&)=default
 
void setBoolDsScale (const bool &_doScale)
 
void setBoolDsScale (const bool &_doScale)
 
void setBoolDtScale (const bool &_doScale)
 
void setBoolDtScale (const bool &_doScale)
 
void setUserDefLattice (const std::vector< std::vector< double * > > &_userDefLattices)
 
void setUserDefLattice (const std::vector< std::vector< TNumType * >> &_userDefLattices)
 
std::vector< LatticePointType > & simLattice ()
 Reference to the lattice that requested each simulated trajectory state. More...
 
const std::vector< LatticePointType > & simLattice () const
 Const reference to the lattice that requested each simulated trajectory state. More...
 
LatticePointTypesimLatticeI (const size_t &_i)
 
const LatticePointTypesimLatticeI (const size_t &_i) const
 
size_t simLatticeSize () const
 
void simulateTrajectory (TNumType _lastValidArc=0)
 
template<bool canComputeStateGrad = CanComputeStateGrad, typename std::enable_if<(canComputeStateGrad)>::type * = nullptr>
void simulateTrajectoryWithGrad (TNumType _lastValidArc=0)
 
StateSimPtr stateSim ()
 Reference of the state simulator object. More...
 
const StateSimPtr stateSim () const
 Const reference of the state simulator object. More...
 
StateSimSPtrstateSim ()
 Reference of the state simulator object. More...
 
const StateSimSPtrstateSim () const
 Const reference of the state simulator object. More...
 
 TrajectorySimulator (StateSimPtr _stateSim)
 
 TrajectorySimulator (StateSimPtr _stateSim, std::unique_ptr< CostsEvaluatorClass > _costsEvaluator)
 
 TrajectorySimulator (const TrajectorySimulator &)=default
 
 TrajectorySimulator (StateSimSPtr &_stateSim)
 
 TrajectorySimulator (TrajectorySimulator &&)=default
 
 TrajectorySimulator (StateSimSPtr &_stateSim, std::unique_ptr< CostsEvaluatorClass > _costsEvaluator)
 
 TrajectorySimulator (const TrajectorySimulator &)=default
 
 TrajectorySimulator (TrajectorySimulator &&)=default
 
void updateUserDefLattice ()
 
void updateUserDefLattice ()
 
virtual ~TrajectorySimulator ()=default
 
virtual ~TrajectorySimulator ()=default
 

Private Member Functions

size_t getMinArcLatCacheIdx () const
 Returns the partial lattice cached index that has the smallest arc. More...
 
void populatePartSimLatticesGeneral (size_t _firstLaticeInvalidIdx, double _arcParamMax, double _minArcLatticeVal) override
 Performs simulation and populates simulation and partial lattices in the general case of various enabled lattices. More...
 

Additional Inherited Members

- Public Types inherited from tuw::TrajectorySimulator< TNumType, TSimType >
enum  BaseSimLatticeType : signed int {
  BaseSimLatticeType::ARC_BG_BK = -3, BaseSimLatticeType::LATTICE_ARC_EQ_DT = -2, BaseSimLatticeType::LATTICE_ARC_EQ_DS = -1, BaseSimLatticeType::LATTICE_ENUM_SIZE = 3,
  BaseSimLatticeType::ARC_BG_BK = -3, BaseSimLatticeType::LATTICE_ARC_EQ_DT = -2, BaseSimLatticeType::LATTICE_ARC_EQ_DS = -1, BaseSimLatticeType::LATTICE_ENUM_SIZE = 3
}
 Fundamental lattice types. More...
 
enum  BaseSimLatticeType : signed int {
  BaseSimLatticeType::ARC_BG_BK = -3, BaseSimLatticeType::LATTICE_ARC_EQ_DT = -2, BaseSimLatticeType::LATTICE_ARC_EQ_DS = -1, BaseSimLatticeType::LATTICE_ENUM_SIZE = 3,
  BaseSimLatticeType::ARC_BG_BK = -3, BaseSimLatticeType::LATTICE_ARC_EQ_DT = -2, BaseSimLatticeType::LATTICE_ARC_EQ_DS = -1, BaseSimLatticeType::LATTICE_ENUM_SIZE = 3
}
 Fundamental lattice types. More...
 
using CostsEvaluatorClass = CostsEvaluatorBase< TrajectorySimulator::LatticeVec >
 
using CostsEvaluatorClass = CostsEvaluatorBase< TrajectorySimulator::LatticeVec >
 
using LatticeVec = std::vector< LatticePoint >
 
using LatticeVec = std::vector< LatticePoint >
 
using LatticeVecSPtr = std::shared_ptr< std::vector< LatticePoint > >
 
using LatticeVecSPtr = std::shared_ptr< std::vector< LatticePoint >>
 
using LatticeVecSPtrVec = std::vector< std::shared_ptr< std::vector< LatticePoint > > >
 
using LatticeVecSPtrVec = std::vector< std::shared_ptr< std::vector< LatticePoint >>>
 
enum  SimMode { SimMode::ONLINE, SimMode::PRECALC }
 Mode of the simulation. More...
 
using StateForSimType = typename TSimType::StateForSimType
 
using StateSimSPtr = std::shared_ptr< TSimType >
 
using StateSPtr = std::shared_ptr< StateType >
 
using StateType = typename TSimType::StateType
 
- Static Public Member Functions inherited from tuw::TrajectorySimulator< TNumType, TSimType >
static size_t lattTypeIdx (int _enumIdx)
 Converts shifted (int) lattice index to container (size_t) index. More...
 
static size_t lattTypeIdx (int _enumIdx)
 Converts shifted (int) lattice index to container (size_t) index. More...
 
- Public Attributes inherited from tuw::TrajectorySimulator< TNumType, TSimType >
std::unique_ptr< CostsEvaluatorClasscostsEvaluator_
 
LatticeVecSPtrVec partLattices_
 Vector containing the ordered sequence of arc parametrizations for each of the used lattices. More...
 
bool simulatingWithGrad
 Simulates (discrete numerical evaluation) an entire trajectory according to the specified intervals and lattices. More...
 
std::vector< LatticePointTypesimulationLattice_
 Lattice requesting each simulated trajectory state. More...
 
- Static Public Attributes inherited from tuw::TrajectorySimulator< TNumType, TSimType >
static constexpr const bool CanComputeStateGrad
 
static constexpr const std::size_t extArcLatIdxBegin
 
- Protected Member Functions inherited from tuw::TrajectorySimulator< TNumType, TSimType >
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. More...
 
void appendToPartLat (const TNumType &_arcNow, const int &_latticePtType, const std::size_t &_minArcLatCacheIdx)
 Appends the new arc and state pointer to the afferent partial lattice point. More...
 
void computeScaleDtDs ()
 
void computeScaleDtDs ()
 
void initExtLatticeCache (const double &_minArcLatticeVal)
 Initializes the cached partial lattices index at the highest arc lower than. More...
 
void initExtLatticeCache (const TNumType &_minArcLatticeVal)
 Initializes the cached partial lattices index at the highest arc lower than. More...
 
bool initSimLatticeState0 (const double &_lastValidArc, size_t &_firstLaticeInvalidIdx)
 Initializes the simulation lattice (truncation from the. More...
 
bool initSimLatticeState0 (const TNumType &_lastValidArc, size_t &_firstLaticeInvalidIdx)
 Initializes the simulation lattice (truncation from the. More...
 
bool isEmptyAllExtLattices () const
 Returns true if all extended lattices are empty (the DS lattice as well as user-defined lattices). More...
 
bool isEmptyAllExtLattices () const
 Returns true if all extended lattices are empty (the DS lattice as well as user-defined lattices). More...
 
virtual void populatePartSimLatticesDtOnly (const size_t &_firstLaticeInvalidIdx, double _arcParamMax)
 Performs simulation and populates simulation and partial lattice when only equal dt lattice is enabled. More...
 
void populatePartSimLatticesDtOnly (const size_t &_firstLaticeInvalidIdx, TNumType _arcParamMax)
 Performs simulation and populates simulation and partial lattice when only equal dt lattice is enabled. More...
 
void populatePartSimLatticesGeneral (size_t _firstLaticeInvalidIdx, TNumType _arcParamMax, TNumType _minArcLatticeVal)
 Performs simulation and populates simulation and partial lattices in the general case of various enabled lattices. More...
 
void populateTrajSimPartLattice (const size_t &_firstLaticeInvalidIdx)
 Main function that performs resizing, reserving and calls the proper population function. More...
 
void populateTrajSimPartLattice (const size_t &_firstLaticeInvalidIdx)
 Main function that performs resizing, reserving and calls the proper population function. More...
 
void setBeginEndArcsToLattices (const double &_arcBegin, const double &_arcEnd)
 Sets begin and end arcs to all partial lattices on the first and last container positions. More...
 
void setBeginEndArcsToLattices (const TNumType &_arcBegin, const TNumType &_arcEnd)
 Sets begin and end arcs to all partial lattices on the first and last container positions. More...
 
void setBeginStateToLattices (const double &_arcBegin)
 Binds reference to the initial simulated state (at. More...
 
void setBeginStateToLattices (const TNumType &_arcBegin)
 Binds reference to the initial simulated state (at. More...
 
void setEndStateToLattices (const double &_arcEnd)
 Binds reference to the final simulated state (at. More...
 
void setEndStateToLattices (const TNumType &_arcEnd)
 Binds reference to the final simulated state (at. More...
 
void simAppendToSimPartLat (const double &_arcNow, const int &_latticePtType, const std::size_t &_minArcLatCacheIdx)
 Performs a simulation step (if. More...
 
void simAppendToSimPartLat (const TNumType &_arcNow, const int &_latticePtType, const std::size_t &_minArcLatCacheIdx)
 Performs a simulation step (if. More...
 
- Static Protected Member Functions inherited from tuw::TrajectorySimulator< TNumType, TSimType >
static bool cmpLatticePt (const TrajectorySimulator::LatticePoint &a, const TrajectorySimulator::LatticePoint &b)
 
- Protected Attributes inherited from tuw::TrajectorySimulator< TNumType, TSimType >
bool canComputeDistLattice_
 Flags if the StateSim object has access to the StateSimDist functionality. More...
 
std::vector< int > partLatIdxCache_
 Vector containing cached container indices for each partial lattice related to the the highest arc lower than the current evaluated arc. More...
 
bool scaleDs_
 
bool scaleDt_
 
StateSimPtr stateSim_
 State simulator object. More...
 
StateSimSPtr stateSim_
 State simulator object. More...
 

Detailed Description

Definition at line 42 of file trajectory_simulator_precalc.h.

Constructor & Destructor Documentation

TrajectorySimulatorPrecalc::TrajectorySimulatorPrecalc ( StateSimPtr  _stateSim)

Definition at line 44 of file trajectory_simulator_precalc.cpp.

tuw::TrajectorySimulatorPrecalc::TrajectorySimulatorPrecalc ( StateSimPtr  _stateSim,
std::unique_ptr< CostsEvaluatorClass _costsEvaluator 
)
virtual tuw::TrajectorySimulatorPrecalc::~TrajectorySimulatorPrecalc ( )
virtualdefault
tuw::TrajectorySimulatorPrecalc::TrajectorySimulatorPrecalc ( const TrajectorySimulatorPrecalc )
default
tuw::TrajectorySimulatorPrecalc::TrajectorySimulatorPrecalc ( TrajectorySimulatorPrecalc &&  )
default

Member Function Documentation

size_t TrajectorySimulatorPrecalc::getMinArcLatCacheIdx ( ) const
private

Returns the partial lattice cached index that has the smallest arc.

Definition at line 152 of file trajectory_simulator_precalc.cpp.

TrajectorySimulatorPrecalc& tuw::TrajectorySimulatorPrecalc::operator= ( const TrajectorySimulatorPrecalc )
default
TrajectorySimulatorPrecalc& tuw::TrajectorySimulatorPrecalc::operator= ( TrajectorySimulatorPrecalc &&  )
default
void TrajectorySimulatorPrecalc::populatePartSimLatticesGeneral ( size_t  _firstLaticeInvalidIdx,
double  _arcParamMax,
double  _minArcLatticeVal 
)
overrideprivatevirtual

Performs simulation and populates simulation and partial lattices in the general case of various enabled lattices.

Implements tuw::TrajectorySimulator< TNumType, TSimType >.

Definition at line 113 of file trajectory_simulator_precalc.cpp.

void TrajectorySimulatorPrecalc::simulateTrajectory ( double  _lastValidArc = 0)
overridevirtual

Simulates (discrete numerical evaluation) an entire trajectory according to the specified intervals and lattices.

Parameters
_lastValidArcSpecifies the last arc at which the previous simulation was still valid. Setting it non-zero is beneficial if already computed (in memory) trajStates() are guaranteed to not have changed. Thus, it allows the function to simulate only portions of the entire arc parametrization domain.

Implements tuw::TrajectorySimulator< TNumType, TSimType >.

Definition at line 53 of file trajectory_simulator_precalc.cpp.


The documentation for this class was generated from the following files:


tuw_control
Author(s): George Todoran
autogenerated on Mon Jun 10 2019 15:27:24