11 template <
size_t NJOINTS,
typename SCALAR>
17 template <
size_t NJOINTS,
typename SCALAR>
23 template <
size_t NJOINTS,
typename SCALAR>
25 std::vector<double> zeta)
27 if ((w_n.size() != NJOINTS) || (zeta.size() != NJOINTS))
28 throw std::runtime_error(
"SecondOrderActuatorDynamics: w_n or zeta is not correct size");
30 oscillators_.resize(NJOINTS);
31 for (
size_t i = 0;
i < NJOINTS;
i++)
36 template <
size_t NJOINTS,
typename SCALAR>
38 std::vector<double> zeta,
39 std::vector<double> g_dc)
41 if ((w_n.size() != NJOINTS) || (zeta.size() != NJOINTS) || (g_dc.size() != NJOINTS))
42 throw std::runtime_error(
"SecondOrderActuatorDynamics: w_n, zeta or g_dc is not correct size");
44 oscillators_.resize(NJOINTS);
45 for (
size_t i = 0;
i < NJOINTS;
i++)
49 template <
size_t NJOINTS,
typename SCALAR>
54 template <
size_t NJOINTS,
typename SCALAR>
60 template <
size_t NJOINTS,
typename SCALAR>
69 for (
size_t i = 0;
i < NJOINTS;
i++)
74 inputCtrl(0) = control(
i);
76 secondOrderState << state(
i), state(
i + NJOINTS);
78 oscillators_[
i].computeControlledDynamics(secondOrderState,
SCALAR(0.0), inputCtrl, secondOrderStateDerivative);
80 derivative(
i) = state(
i + NJOINTS);
81 derivative(
i + NJOINTS) = secondOrderStateDerivative(1);
85 template <
size_t NJOINTS,
typename SCALAR>
88 const typename BASE::act_state_vector_t& actState)
91 return actState.template topRows<NJOINTS>();
94 template <
size_t NJOINTS,
typename SCALAR>
joint state and joint velocity
Definition: JointState.h:21
virtual core::ControlVector< NJOINTS, SCALAR > computeControlOutput(const JointState< NJOINTS, SCALAR > &robotJointState, const typename BASE::act_state_vector_t &actState) override
Definition: SecondOrderActuatorDynamics-impl.h:86
virtual ct::core::StateVector< 2 *NJOINTS, SCALAR > computeStateFromOutput(const JointState< NJOINTS, SCALAR > &refRobotJointState, const core::ControlVector< NJOINTS, SCALAR > &refControl) override
reconstruct actuator state from a desired control output and robot joint state (e.g. for initialization)
Definition: SecondOrderActuatorDynamics-impl.h:95
SecondOrderActuatorDynamics(double w_n, double zeta)
constructor assuming unit amplification
Definition: SecondOrderActuatorDynamics-impl.h:12
virtual SecondOrderActuatorDynamics< NJOINTS, SCALAR > * clone() const override
deep cloning
Definition: SecondOrderActuatorDynamics-impl.h:55
tpl::SecondOrderSystem< double > SecondOrderSystem
virtual void computeActuatorDynamics(const JointState< NJOINTS, SCALAR > &robotJointState, const ct::core::StateVector< 2 *NJOINTS, SCALAR > &state, const SCALAR &t, const ct::core::ControlVector< NJOINTS, SCALAR > &control, ct::core::StateVector< 2 *NJOINTS, SCALAR > &derivative) override
Definition: SecondOrderActuatorDynamics-impl.h:61
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Definition: SecondOrderActuatorDynamics.h:19
Base & toImplementation()
virtual ~SecondOrderActuatorDynamics()
destructor
Definition: SecondOrderActuatorDynamics-impl.h:50