12 template <
size_t POS_DIM,
size_t VEL_DIM,
size_t CONTROL_DIM,
class Stepper,
typename SCALAR>
16 : systemSymplectic_(system), observer_(eventHandlers)
21 template <
size_t POS_DIM,
size_t VEL_DIM,
size_t CONTROL_DIM,
class Stepper,
typename SCALAR>
31 template <
size_t POS_DIM,
size_t VEL_DIM,
size_t CONTROL_DIM,
class Stepper,
typename SCALAR>
41 xPair.first = state.head(POS_DIM);
42 xPair.second = state.tail(VEL_DIM);
44 stateTrajectory.push_back(state);
45 timeTrajectory.push_back(time);
47 for (
size_t i = 0;
i < numSteps; ++
i)
50 stepper_.do_step(std::make_pair(systemFunctionPosition_, systemFunctionVelocity_), xPair, time, dt);
51 state.head(POS_DIM) = xPair.first;
52 state.tail(VEL_DIM) = xPair.second;
55 stateTrajectory.push_back(state);
56 timeTrajectory.push_back(time);
60 template <
size_t POS_DIM,
size_t VEL_DIM,
size_t CONTROL_DIM,
class Stepper,
typename SCALAR>
68 xPair.first = state.head(POS_DIM);
69 xPair.second = state.tail(VEL_DIM);
71 for (
size_t i = 0;
i < numSteps; ++
i)
74 stepper_.do_step(std::make_pair(systemFunctionPosition_, systemFunctionVelocity_), xPair, time, dt);
75 state.head(POS_DIM) = xPair.first;
76 state.tail(VEL_DIM) = xPair.second;
82 template <
size_t POS_DIM,
size_t VEL_DIM,
size_t CONTROL_DIM,
class Stepper,
typename SCALAR>
88 template <
size_t POS_DIM,
size_t VEL_DIM,
size_t CONTROL_DIM,
class Stepper,
typename SCALAR>
91 systemFunctionPosition_ = [
this](
92 const Eigen::Matrix<SCALAR, VEL_DIM, 1>& v, Eigen::Matrix<SCALAR, POS_DIM, 1>& dxdt) {
95 xCached_.template bottomRows<VEL_DIM>() = v;
96 systemSymplectic_->computePdot(xCached_, vState, dxdtState);
99 systemFunctionVelocity_ = [
this](
100 const Eigen::Matrix<SCALAR, POS_DIM, 1>&
x, Eigen::Matrix<SCALAR, VEL_DIM, 1>& dvdt) {
103 xCached_.template topRows<POS_DIM>() = x;
104 systemSymplectic_->computeVdot(xCached_, xState, dvdtState);
std::vector< EventHandlerPtr, Eigen::aligned_allocator< EventHandlerPtr > > EventHandlerPtrVector
Definition: IntegratorSymplectic.h:41
void observeInternal(const StateVector< STATE_DIM, SCALAR > &x, const SCALAR &t)
Definition: Observer-impl.h:51
An discrete array (vector) of a particular data type.
Definition: DiscreteArray.h:22
void reset()
Definition: IntegratorSymplectic-impl.h:83
std::shared_ptr< EventHandler< POS_DIM+VEL_DIM, SCALAR > > EventHandlerPtr
Definition: IntegratorSymplectic.h:40
void integrate_n_steps(StateVector< POS_DIM+VEL_DIM, SCALAR > &state, const SCALAR &startTime, size_t numSteps, SCALAR dt, StateVectorArray< POS_DIM+VEL_DIM, SCALAR > &stateTrajectory, tpl::TimeArray< SCALAR > &timeTrajectory)
Equidistant integration based on number of time steps and step length.
Definition: IntegratorSymplectic-impl.h:32
CppAD::AD< CppAD::cg::CG< double > > SCALAR
ct::core::StateVector< state_dim > x
An array in time.
Definition: TimeArray.h:22
This class wraps the symplectic integrators from boost to this toolbox.
Definition: IntegratorSymplectic.h:34
IntegratorSymplectic(const std::shared_ptr< SymplecticSystem< POS_DIM, VEL_DIM, CONTROL_DIM, SCALAR >> system, const EventHandlerPtrVector &eventHandlers=EventHandlerPtrVector(0))
The constructor. This integrator can only treat symplectic systems.
Definition: IntegratorSymplectic-impl.h:13
The base class for the implementation of a symplectic system. In a symplectic system, the position and the velocity update can be separated. During integration, the velocity gets update first and the position update uses the updated velocity.
Definition: SymplecticSystem.h:25
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef std::pair< Eigen::Matrix< SCALAR, POS_DIM, 1 >, Eigen::Matrix< SCALAR, VEL_DIM, 1 > > pair_t
Definition: IntegratorSymplectic.h:38
void reset()
reset the observer
Definition: Observer-impl.h:24