14 template <
class RBDDynamics,
bool QUAT_INTEGRATION = false>
16 :
public RBDSystem<RBDDynamics, QUAT_INTEGRATION>,
25 const static size_t STATE_DIM = RBDDynamics::NSTATE + QUAT_INTEGRATION;
33 :
RBDSystem<RBDDynamics, QUAT_INTEGRATION>(arg),
34 core::
ControlledSystem<RBDDynamics::NSTATE + QUAT_INTEGRATION, 4, typename RBDDynamics::SCALAR>(arg),
35 dynamics_(arg.dynamics_)
41 virtual RBDDynamics&
dynamics()
override {
return dynamics_; }
42 virtual const RBDDynamics&
dynamics()
const override {
return dynamics_; }
56 typename RBDDynamics::RBDAcceleration_t xd;
61 joint_torques = -0.0005 * x.joints().getVelocities();
63 dynamics_.FloatingBaseForwardDynamics(x, joint_torques, linkForces, xd);
65 derivative = toStateDerivative<QUAT_INTEGRATION>(xd, x);
77 size_t baseLinkId = 0;
82 control.template segment<3>(1);
87 return RBDStateFromVectorImpl<QUAT_INTEGRATION>(state);
92 typename std::enable_if<T, bool>::type =
true)
95 x.fromStateVectorQuaternion(state);
101 typename std::enable_if<!T, bool>::type =
true)
104 x.fromStateVectorEulerXyz(state);
110 const typename RBDDynamics::RBDState_t& state,
111 typename std::enable_if<T, bool>::type =
true)
113 return acceleration.toStateUpdateVectorQuaternion(state);
118 const typename RBDDynamics::RBDState_t& state,
119 typename std::enable_if<!T, bool>::type =
true)
121 return acceleration.toStateUpdateVectorEulerXyz(state);
131 RBDDynamics dynamics_;
RBDDynamics::RBDState_t RBDStateFromVector(const core::StateVector< STATE_DIM, SCALAR > &state)
Definition: QuadrotorWithLoadFDSystem.h:85
RBDDynamics::RBDState_t RBDStateFromVectorImpl(const core::StateVector< STATE_DIM, SCALAR > &state, typename std::enable_if< T, bool >::type=true)
Definition: QuadrotorWithLoadFDSystem.h:91
virtual RBDDynamics & dynamics() override
Definition: QuadrotorWithLoadFDSystem.h:41
RBDDynamics::RBDState_t RBDStateFromVectorImpl(const core::StateVector< STATE_DIM, SCALAR > &state, typename std::enable_if<!T, bool >::type=true)
Definition: QuadrotorWithLoadFDSystem.h:100
Definition: QuadrotorWithLoadFDSystem.h:15
typename RBDDynamics::Kinematics_t Kinematics
Definition: QuadrotorWithLoadFDSystem.h:21
QuadrotorWithLoadFDSystem()
Definition: QuadrotorWithLoadFDSystem.h:30
virtual ~QuadrotorWithLoadFDSystem()
Definition: QuadrotorWithLoadFDSystem.h:39
core::ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > Base
Definition: QuadrotorWithLoadFDSystem.h:28
CppAD::AD< CppAD::cg::CG< double > > SCALAR
Definition: HyQLinearizationCodegen.cpp:14
virtual const RBDDynamics & dynamics() const override
Definition: QuadrotorWithLoadFDSystem.h:42
RBDDynamics Dynamics
Definition: QuadrotorWithLoadFDSystem.h:20
typename ct::rbd::HyA::tpl::Dynamics< SCALAR >::ExtLinkForces_t ExtLinkForces_t
Definition: HyALinearizationCodeGen.cpp:31
void computeControlledDynamics(const core::StateVector< STATE_DIM, SCALAR > &state, const core::Time &t, const core::ControlVector< CONTROL_DIM, SCALAR > &control, core::StateVector< STATE_DIM, SCALAR > &derivative) override
Definition: QuadrotorWithLoadFDSystem.h:43
ct::core::StateVector< state_dim > x
core::StateVector< STATE_DIM > toStateDerivative(const typename RBDDynamics::RBDAcceleration_t &acceleration, const typename RBDDynamics::RBDState_t &state, typename std::enable_if<!T, bool >::type=true)
Definition: QuadrotorWithLoadFDSystem.h:117
RBDDynamics::SCALAR SCALAR
Definition: QuadrotorWithLoadFDSystem.h:23
static const size_t CONTROL_DIM
Definition: QuadrotorWithLoadFDSystem.h:26
core::StateVector< STATE_DIM > toStateDerivative(const typename RBDDynamics::RBDAcceleration_t &acceleration, const typename RBDDynamics::RBDState_t &state, typename std::enable_if< T, bool >::type=true)
Definition: QuadrotorWithLoadFDSystem.h:109
virtual QuadrotorWithLoadFDSystem< RBDDynamics, QUAT_INTEGRATION > * clone() const override
Definition: QuadrotorWithLoadFDSystem.h:125
static const size_t STATE_DIM
Definition: QuadrotorWithLoadFDSystem.h:25
void mapControlInputsToLinkForces(const typename RBDDynamics::RBDState_t &state, const core::ControlVector< CONTROL_DIM, SCALAR > &control, typename RBDDynamics::ExtLinkForces_t &linkForces)
Definition: QuadrotorWithLoadFDSystem.h:69
QuadrotorWithLoadFDSystem(const QuadrotorWithLoadFDSystem &arg)
Definition: QuadrotorWithLoadFDSystem.h:32
LinkIdentifiers
Definition: declarations.h:30
ControlledSystem(const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL)