20 #define ENABLE_FIX_BASE \ 21 template <bool B = FB> \ 22 typename std::enable_if<!B, void>::type 23 #define ENABLE_FIX_BASE_IMPL \ 25 typename std::enable_if<!B, void>::type 26 #define ENABLE_FLOAT_BASE \ 27 template <bool B = FB> \ 28 typename std::enable_if<B, void>::type 29 #define ENABLE_FLOAT_BASE_IMPL \ 31 typename std::enable_if<B, void>::type 42 template <
class RBD,
size_t NEE>
46 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49 typedef typename ROBCOGEN::SCALAR
SCALAR;
51 static const bool FB = ROBCOGEN::TRAIT::floating_base;
53 static const size_t NJOINTS = RBD::NJOINTS;
54 static const size_t NLINKS = RBD::NLINKS;
59 static const size_t N_EE = NEE;
92 Dynamics(
const Dynamics& other) : S_(other.S_), kinematics_(other.kinematics_->clone()), p_dynamics_(kinematics_) {}
105 const control_vector_t&
u,
106 ExtLinkForces_t& force,
107 JointAcceleration_t& qdd);
118 ExtLinkForces_t force(Eigen::Matrix<SCALAR, 6, 1>::Zero());
131 const JointAcceleration_t& qdd,
132 const ExtLinkForces_t& force,
133 control_vector_t& u);
153 const control_vector_t& u,
154 const ExtLinkForces_t& link_forces,
155 RBDAcceleration_t& xd);
167 const JointAcceleration_t& qdd,
168 const ExtLinkForces_t& force,
170 RigidBodyAcceleration_t& base_a);
183 const RigidBodyAcceleration_t& base_ac,
184 const JointAcceleration_t& qdd,
185 const ExtLinkForces_t& force,
186 ForceVector_t& base_w,
187 control_vector_t& u);
199 const control_vector_t& u,
200 RBDAcceleration_t& rbd_a)
203 ee_contact_ = ee_contact;
204 p_dynamics_.setContactConfiguration(ee_contact);
206 p_dynamics_.ProjectedForwardDynamics(x, u, rbd_a);
211 const RBDAcceleration_t& rbd_a,
215 ee_contact_ = ee_contact;
216 p_dynamics_.setContactConfiguration(ee_contact);
217 p_dynamics_.ProjectedInverseDynamics(x, rbd_a, u);
222 const RBDAcceleration_t& rbd_a,
226 ee_contact_ = ee_contact;
227 p_dynamics_.setContactConfiguration(ee_contact);
228 p_dynamics_.ProjectedInverseDynamicsNoGravity(x, rbd_a, u);
232 const Kinematics_t&
kinematics()
const {
return *kinematics_; }
235 SelectionMatrix_t&
S() {
return S_; }
236 const SelectionMatrix_t&
S()
const {
return S_; }
238 SelectionMatrix_t S_;
240 EE_in_contact_t ee_contact_ =
false;
249 template <
class RBD,
size_t NEE>
251 const control_vector_t& u,
252 ExtLinkForces_t& force,
253 JointAcceleration_t& qdd)
258 template <
class RBD,
size_t NEE>
260 const JointAcceleration_t& qdd,
261 const ExtLinkForces_t& force,
267 template <
class RBD,
size_t NEE>
269 const JointAcceleration_t& qdd,
272 ExtLinkForces_t force(Eigen::Matrix<SCALAR, 6, 1>::Zero());
276 template <
class RBD,
size_t NEE>
278 const control_vector_t& u,
279 const ExtLinkForces_t& l_forces,
280 RBDAcceleration_t& xd)
284 kinematics_->robcogen().forwardDynamics().fd(xd.
joints().getAcceleration(), b_accel, x.
baseVelocities().getVector(),
290 template <
class RBD,
size_t NEE>
292 const JointAcceleration_t& qdd,
293 const ExtLinkForces_t& l_forces,
295 RigidBodyAcceleration_t& base_a)
299 kinematics_->robcogen().inverseDynamics().id(u,
307 template <
class RBD,
size_t NEE>
309 const RigidBodyAcceleration_t& base_a,
310 const JointAcceleration_t& qdd,
311 const ExtLinkForces_t& l_forces,
312 ForceVector_t& base_w,
322 #undef ENABLE_FIX_BASE 323 #undef ENABLE_FIX_BASE_IMPL 324 #undef ENABLE_FLOAT_BASE 325 #undef ENABLE_FLOAT_BASE_IMPL
static const bool FB
Definition: Dynamics.h:51
const Kinematics_t & kinematics() const
Definition: Dynamics.h:232
static const size_t NLINKS
Definition: Dynamics.h:54
static const size_t NSTATE
Definition: Dynamics.h:58
Eigen::Matrix< SCALAR, 6, 1 > computeGravityB6D(const Vector3Tpl &gravityW=gravity3DW()) const
This methods returns the 6D gravity vector expressed in the Base frame.
Definition: RigidBodyPose.h:380
RigidBodyPose_t & basePose()
get base pose
Definition: RBDState.h:67
Eigen::Matrix< SCALAR, NJOINTS, 1 > control_vector_t
Definition: Dynamics.h:62
ct::core::ControlVector< control_dim > u
ENABLE_FLOAT_BASE FloatingBaseFullyActuatedID(const RBDState_t &x, const RigidBodyAcceleration_t &base_ac, const JointAcceleration_t &qdd, const ExtLinkForces_t &force, ForceVector_t &base_w, control_vector_t &u)
Computes the inverse dynamics of a floating-base fully-actuated system.
Definition: Dynamics.h:308
SelectionMatrix< NJOINTS, NSTATE/2, SCALAR > SelectionMatrix_t
Definition: Dynamics.h:74
joint state and joint velocity
Definition: JointState.h:21
#define ENABLE_FLOAT_BASE
Definition: Dynamics.h:26
JointAcceleration< NJOINTS, SCALAR > & joints()
get joint acceleration
Definition: RBDAcceleration.h:52
ENABLE_FLOAT_BASE ProjectedInverseDynamicsNoGravity(const EE_in_contact_t &ee_contact, const RBDState_t &x, const RBDAcceleration_t &rbd_a, control_vector_t &u)
Definition: Dynamics.h:220
This class implements the equations of motion of a Rigid Body System.
Definition: Dynamics.h:43
RBD::LinkForceMap ExtLinkForces_t
Definition: Dynamics.h:77
ROBCOGEN::SCALAR SCALAR
Definition: Dynamics.h:49
joint states and base states
Definition: RBDState.h:27
ENABLE_FIX_BASE FixBaseForwardDynamics(const JointState_t &x, const control_vector_t &u, JointAcceleration_t &qdd)
Compute forward dynamics of a fixed-base RBD system, NO contact forces forces.
Definition: Dynamics.h:116
RBDAcceleration< NJOINTS, SCALAR > RBDAcceleration_t
Definition: Dynamics.h:68
Kinematics_t & kinematics()
Definition: Dynamics.h:231
Dynamics(typename Kinematics_t::Ptr_t kinematics=typename Kinematics_t::Ptr_t(new Kinematics_t()))
The constructor.
Definition: Dynamics.h:87
static const size_t N_EE
Definition: Dynamics.h:59
joint acceleration
Definition: JointAcceleration.h:17
const SelectionMatrix_t & S() const
Definition: Dynamics.h:236
JointPositionBlock getVelocities()
get joint velocity
Definition: JointState.h:131
static const size_t NJOINTS
Definition: Dynamics.h:53
#define ENABLE_FIX_BASE
Definition: Dynamics.h:20
std::shared_ptr< Kinematics< RBD, N_EE > > Ptr_t
Definition: Kinematics.h:50
ENABLE_FLOAT_BASE ProjectedForwardDynamics(const EE_in_contact_t &ee_contact, const RBDState_t &x, const control_vector_t &u, RBDAcceleration_t &rbd_a)
Computes Projected Forward Dynamics of a floating-base system with contact constraints.
Definition: Dynamics.h:197
ct::core::StateVector< state_dim > x
joint acceleration and base acceleration
Definition: RBDAcceleration.h:23
Kinematics< RBD, NEE > Kinematics_t
Definition: Dynamics.h:81
acceleration of a rigid body
Definition: RigidBodyAcceleration.h:20
ENABLE_FLOAT_BASE FloatingBaseForwardDynamics(const RBDState_t &x, const control_vector_t &u, const ExtLinkForces_t &link_forces, RBDAcceleration_t &xd)
Compute forward dynamics for an floating-base RBD system under external forces.
Definition: Dynamics.h:277
Selection Matrix for a Rigid Body Dynamics System.
Definition: SelectionMatrix.h:23
#define ENABLE_FIX_BASE_IMPL
Definition: Dynamics.h:23
ENABLE_FIX_BASE FixBaseForwardDynamics(const JointState_t &x, const control_vector_t &u, ExtLinkForces_t &force, JointAcceleration_t &qdd)
Compute forward dynamics of a fixed-base RBD system under external forces.
Definition: Dynamics.h:250
JointAcceleration< NJOINTS, SCALAR > JointAcceleration_t
Definition: Dynamics.h:70
tpl::RigidBodyVelocities< SCALAR > & baseVelocities()
get base velocities
Definition: RBDState.h:71
ENABLE_FLOAT_BASE FloatingBaseID(const RBDState_t &x, const JointAcceleration_t &qdd, const ExtLinkForces_t &force, control_vector_t &u, RigidBodyAcceleration_t &base_a)
Computes Inverse dynamics of a floating-base system under external forces.
Definition: Dynamics.h:291
Definition: ProjectedDynamics.h:22
const Kinematics_t::Ptr_t & kinematicsPtr() const
Definition: Dynamics.h:234
Kinematics_t::Ptr_t & kinematicsPtr()
Definition: Dynamics.h:233
ENABLE_FIX_BASE FixBaseID(const JointState_t &x, const JointAcceleration_t &qdd, const ExtLinkForces_t &force, control_vector_t &u)
Computes Inverse dynamics of a fixed-base system under external forces.
Definition: Dynamics.h:259
Vector6d_t ForceVector_t
Definition: Dynamics.h:65
RBDDataMap< bool, NEE > EE_in_contact_t
Definition: Dynamics.h:79
ENABLE_FLOAT_BASE ProjectedInverseDynamics(const EE_in_contact_t &ee_contact, const RBDState_t &x, const RBDAcceleration_t &rbd_a, control_vector_t &u)
Definition: Dynamics.h:209
Eigen::Matrix< SCALAR, NSTATE, 1 > state_vector_t
Definition: Dynamics.h:63
virtual ~Dynamics()
Definition: Dynamics.h:93
SelectionMatrix_t & S()
Definition: Dynamics.h:235
Eigen::Matrix< SCALAR, NJOINTS, 1 > & getAcceleration()
get joint acceleration
Definition: JointAcceleration.h:36
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef RBD ROBCOGEN
Definition: Dynamics.h:48
JointState< NJOINTS, SCALAR > & joints()
get joint states
Definition: RBDState.h:94
JointPositionBlock getPositions()
get joint state
Definition: JointState.h:76
RigidBodyAcceleration_t & base()
get base acceleration
Definition: RBDAcceleration.h:48
tpl::RigidBodyAcceleration< SCALAR > RigidBodyAcceleration_t
Definition: Dynamics.h:71
Dynamics(const Dynamics &other)
Definition: Dynamics.h:92
RBDState< NJOINTS, SCALAR > RBDState_t
Definition: Dynamics.h:67
void fromVector6d(const Eigen::Matrix< SCALAR, 6, 1 > &in)
Definition: RigidBodyAcceleration.h:35
#define ENABLE_FLOAT_BASE_IMPL
Definition: Dynamics.h:29
JointState< NJOINTS, SCALAR > JointState_t
Definition: Dynamics.h:69
Eigen::Matrix< SCALAR, 6, 1 > Vector6d_t
Definition: Dynamics.h:64