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" 31 template <
typename _Scalar>
34 typedef _Scalar Scalar;
39 typedef typename MathBase::VectorXs VectorXs;
40 typedef typename MathBase::MatrixXs MatrixXs;
49 :
Base(state, state->get_nv() - state->get_pinocchio()->joints[1].nv()){};
59 virtual void calc(
const boost::shared_ptr<Data>& data,
const Eigen::Ref<const VectorXs>& ,
60 const Eigen::Ref<const VectorXs>& u) {
61 if (static_cast<std::size_t>(u.size()) !=
nu_) {
62 throw_pretty(
"Invalid argument: " 63 <<
"u has wrong dimension (it should be " + std::to_string(
nu_) +
")");
65 data->tau.tail(
nu_) = u;
76 virtual void calcDiff(
const boost::shared_ptr<Data>& data,
const Eigen::Ref<const VectorXs>& ,
77 const Eigen::Ref<const VectorXs>& ) {
79 virtual void calcDiff(
const boost::shared_ptr<Data>&,
const Eigen::Ref<const VectorXs>& ,
80 const Eigen::Ref<const VectorXs>& ) {
83 assert_pretty(data->dtau_dx.isZero(),
"dtau_dx has wrong value");
84 assert_pretty(MatrixXs(data->dtau_du).isApprox(dtau_du_),
"dtau_du has wrong value");
95 boost::shared_ptr<Data> data = boost::allocate_shared<Data>(Eigen::aligned_allocator<Data>(),
this);
96 data->dtau_du.diagonal(-state->get_pinocchio()->joints[1].nv()).setOnes();
98 dtau_du_ = data->dtau_du;
115 #endif // CROCODDYL_MULTIBODY_ACTUATIONS_FLOATING_BASE_HPP_ virtual void calcDiff(const boost::shared_ptr< Data > &data, const Eigen::Ref< const VectorXs > &, const Eigen::Ref< const VectorXs > &)
Compute the Jacobians of the floating-base actuation function.
virtual void calc(const boost::shared_ptr< Data > &data, const Eigen::Ref< const VectorXs > &, const Eigen::Ref< const VectorXs > &u)
Compute the floating-base actuation signal from the control input .
ActuationModelFloatingBaseTpl(boost::shared_ptr< StateMultibody > state)
Initialize the floating-base actuation model.
std::size_t nu_
Control dimension.
boost::shared_ptr< StateAbstract > state_
Model of the state.
State multibody representation.
Floating-base actuation model.
virtual boost::shared_ptr< Data > createData()
Create the floating-base actuation data.
Abstract class for the actuation-mapping model.