9 #ifndef CROCODDYL_MULTIBODY_ACTUATIONS_FULL_HPP_ 10 #define CROCODDYL_MULTIBODY_ACTUATIONS_FULL_HPP_ 12 #include "crocoddyl/multibody/fwd.hpp" 13 #include "crocoddyl/core/actuation-base.hpp" 14 #include "crocoddyl/multibody/states/multibody.hpp" 18 template <
typename _Scalar>
21 typedef _Scalar Scalar;
26 typedef typename MathBase::VectorXs VectorXs;
27 typedef typename MathBase::MatrixXs MatrixXs;
28 explicit ActuationModelFullTpl(boost::shared_ptr<StateMultibody> state) : Base(state, state->get_nv()) {
29 pinocchio::JointModelFreeFlyerTpl<Scalar> ff_joint;
30 if (state->get_pinocchio()->joints[1].shortname() == ff_joint.shortname()) {
31 throw_pretty(
"Invalid argument: " 32 <<
"the first joint cannot be free-flyer");
38 virtual void calc(
const boost::shared_ptr<Data>& data,
const Eigen::Ref<const VectorXs>& ,
39 const Eigen::Ref<const VectorXs>& u) {
40 if (static_cast<std::size_t>(u.size()) != nu_) {
41 throw_pretty(
"Invalid argument: " 42 <<
"u has wrong dimension (it should be " + std::to_string(nu_) +
")");
47 virtual void calcDiff(
const boost::shared_ptr<Data>& data,
const Eigen::Ref<const VectorXs>& ,
48 const Eigen::Ref<const VectorXs>& ) {
50 assert_pretty(data->dtau_dx == MatrixXs::Zero(state_->get_nv(), state_->get_ndx()),
"dtau_dx has wrong value");
51 assert_pretty(data->dtau_du == MatrixXs::Identity(state_->get_nv(), nu_),
"dtau_du has wrong value");
54 virtual boost::shared_ptr<Data> createData() {
55 boost::shared_ptr<Data> data = boost::allocate_shared<Data>(Eigen::aligned_allocator<Data>(),
this);
56 data->dtau_du.diagonal().fill((Scalar)1);
67 #endif // CROCODDYL_MULTIBODY_ACTUATIONS_FULL_HPP_