9 #ifndef CROCODDYL_MULTIBODY_ACTUATIONS_FLOATING_BASE_HPP_ 10 #define CROCODDYL_MULTIBODY_ACTUATIONS_FLOATING_BASE_HPP_ 12 #include "crocoddyl/multibody/fwd.hpp" 13 #include "crocoddyl/core/utils/exception.hpp" 14 #include "crocoddyl/core/actuation-base.hpp" 15 #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;
30 pinocchio::JointModelFreeFlyerTpl<Scalar> ff_joint;
31 if (state->get_pinocchio()->joints[1].shortname() != ff_joint.shortname()) {
32 throw_pretty(
"Invalid argument: " 33 <<
"the first joint has to 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_) +
")");
44 data->tau.tail(nu_) = u;
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 == dtau_du_,
"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(-6).fill((Scalar)1.);
58 dtau_du_ = data->dtau_du;
75 #endif // CROCODDYL_MULTIBODY_ACTUATIONS_FLOATING_BASE_HPP_