#include <trajectory_simulator_online.h>
Public Member Functions | |
TrajectorySimulatorOnline & | operator= (const TrajectorySimulatorOnline &)=default |
TrajectorySimulatorOnline & | operator= (TrajectorySimulatorOnline &&)=default |
void | simulateTrajectory (double _lastValidArc=0) override |
Simulates (discrete numerical evaluation) an entire trajectory according to the specified intervals and lattices. More... | |
TrajectorySimulatorOnline (StateSimPtr _stateSim) | |
TrajectorySimulatorOnline (StateSimPtr _stateSim, std::unique_ptr< CostsEvaluatorClass > _costsEvaluator) | |
TrajectorySimulatorOnline (const TrajectorySimulatorOnline &)=default | |
TrajectorySimulatorOnline (TrajectorySimulatorOnline &&)=default | |
virtual | ~TrajectorySimulatorOnline ()=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... | |
TrajectorySimulator & | operator= (const TrajectorySimulator &)=default |
TrajectorySimulator & | operator= (TrajectorySimulator &&)=default |
TrajectorySimulator & | operator= (const TrajectorySimulator &)=default |
TrajectorySimulator & | operator= (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... | |
LatticePointType & | simLatticeI (const size_t &_i) |
const LatticePointType & | simLatticeI (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... | |
StateSimSPtr & | stateSim () |
Reference of the state simulator object. More... | |
const StateSimSPtr & | stateSim () 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 | |
void | populatePartSimLatticesDtOnly (const size_t &_firstLaticeInvalidIdx, double _arcParamMax) override |
Performs simulation and populates simulation and partial lattice when only equal dt lattice is enabled. More... | |
void | populatePartSimLatticesGeneral (std::size_t _firstLaticeInvalidIdx, double _arcParamMax, double _minArcLatticeVal) override |
void | resizeBeginDtOnly (const double &_arcParamMax) |
Performs lattices resizing relevant to the DT-only online simulation algorithm. More... | |
void | resizeBeginGeneral (const double &_arcParamMax) |
Performs lattices resizing relevant to the general online simulation algorithm. More... | |
double | toNextIntMult (const double &_x, const double &_dx) const |
Numeric safe incremental rounding of x (finds the smallest multiple of. 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< CostsEvaluatorClass > | costsEvaluator_ |
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< LatticePointType > | simulationLattice_ |
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... | |
void | populatePartSimLatticesDtOnly (const size_t &_firstLaticeInvalidIdx, TNumType _arcParamMax) |
Performs simulation and populates simulation and partial lattice when only equal dt lattice is enabled. More... | |
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 enabled lattices. 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... | |
Definition at line 42 of file trajectory_simulator_online.h.
TrajectorySimulatorOnline::TrajectorySimulatorOnline | ( | StateSimPtr | _stateSim | ) |
Definition at line 41 of file trajectory_simulator_online.cpp.
tuw::TrajectorySimulatorOnline::TrajectorySimulatorOnline | ( | StateSimPtr | _stateSim, |
std::unique_ptr< CostsEvaluatorClass > | _costsEvaluator | ||
) |
|
virtualdefault |
|
default |
|
default |
|
default |
|
default |
|
overrideprivatevirtual |
Performs simulation and populates simulation and partial lattice when only equal dt lattice is enabled.
Reimplemented from tuw::TrajectorySimulator< TNumType, TSimType >.
Definition at line 259 of file trajectory_simulator_online.cpp.
|
overrideprivate |
Definition at line 83 of file trajectory_simulator_online.cpp.
|
private |
Performs lattices resizing relevant to the DT-only online simulation algorithm.
Definition at line 308 of file trajectory_simulator_online.cpp.
|
private |
Performs lattices resizing relevant to the general online simulation algorithm.
Definition at line 241 of file trajectory_simulator_online.cpp.
|
overridevirtual |
Simulates (discrete numerical evaluation) an entire trajectory according to the specified intervals and lattices.
_lastValidArc | Specifies 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 52 of file trajectory_simulator_online.cpp.
|
private |
Numeric safe incremental rounding of x (finds the smallest multiple of.
_dx | larger than |
_x). |
Definition at line 69 of file trajectory_simulator_online.cpp.