19 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR =
double>
23 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
28 bool activated =
true,
37 : activated_(activated), system_(system), states_(states), controls_(controls), times_(times)
50 virtual bool checkEvent(
const state_t& state,
const SCALAR& t)
override {
return activated_; }
54 states_->push_back(state);
55 controls_->push_back(system_->getLastControlAction());
59 void setEnable(
bool activated) { activated_ = activated; }
63 states_ = std::shared_ptr<ct::core::StateVectorArray<STATE_DIM, SCALAR>>(
65 controls_ = std::shared_ptr<ct::core::ControlVectorArray<CONTROL_DIM, SCALAR>>(
70 const std::shared_ptr<ct::core::StateVectorArray<STATE_DIM, SCALAR>>&
getSubstates()
const {
return states_; }
71 const std::shared_ptr<ct::core::ControlVectorArray<CONTROL_DIM, SCALAR>>&
getSubcontrols()
const 79 std::shared_ptr<ct::core::ControlledSystem<STATE_DIM, CONTROL_DIM, SCALAR>> system_;
81 std::shared_ptr<ct::core::StateVectorArray<STATE_DIM, SCALAR>> states_;
82 std::shared_ptr<ct::core::ControlVectorArray<CONTROL_DIM, SCALAR>>
84 std::shared_ptr<ct::core::tpl::TimeArray<SCALAR>> times_;
virtual ~SubstepRecorder()
default destructor
Definition: SubstepRecorder.h:42
An discrete array (vector) of a particular data type.
Definition: DiscreteArray.h:22
const std::shared_ptr< ct::core::ControlVectorArray< CONTROL_DIM, SCALAR > > & getSubcontrols() const
Definition: SubstepRecorder.h:71
SubstepRecorder(std::shared_ptr< ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >> system=nullptr, bool activated=true, std::shared_ptr< ct::core::StateVectorArray< STATE_DIM, SCALAR >> states=std::shared_ptr< ct::core::StateVectorArray< STATE_DIM, SCALAR >>(new ct::core::StateVectorArray< STATE_DIM, SCALAR >), std::shared_ptr< ct::core::ControlVectorArray< CONTROL_DIM, SCALAR >> controls=std::shared_ptr< ct::core::ControlVectorArray< CONTROL_DIM, SCALAR >>(new ct::core::ControlVectorArray< CONTROL_DIM, SCALAR >), std::shared_ptr< ct::core::tpl::TimeArray< SCALAR >> times=std::shared_ptr< ct::core::tpl::TimeArray< SCALAR >>(new ct::core::tpl::TimeArray< SCALAR >))
Definition: SubstepRecorder.h:27
const std::shared_ptr< ct::core::StateVectorArray< STATE_DIM, SCALAR > > & getSubstates() const
Definition: SubstepRecorder.h:70
void setControlledSystem(const std::shared_ptr< ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &system)
Definition: SubstepRecorder.h:44
virtual void reset() override
resets kill flag to false
Definition: SubstepRecorder.h:61
virtual bool callOnSubsteps() override
Definition: SubstepRecorder.h:43
Event handler to record substeps.
Definition: SubstepRecorder.h:20
virtual void handleEvent(const state_t &state, const SCALAR &t) override
records the state
Definition: SubstepRecorder.h:52
void setEnable(bool activated)
Definition: SubstepRecorder.h:59
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Definition: StateVector.h:12
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef StateVector< STATE_DIM, SCALAR > state_t
Definition: SubstepRecorder.h:25
An array in time.
Definition: TimeArray.h:22
Interface for an event handler for an Integrator.
Definition: EventHandler.h:24
virtual bool checkEvent(const state_t &state, const SCALAR &t) override
checks the kill flag
Definition: SubstepRecorder.h:50
A general, non-linear dynamic system with a control input.
Definition: ControlledSystem.h:46