9 #ifndef CROCODDYL_MULTIBODY_ACTUATIONS_FULL_HPP_
10 #define CROCODDYL_MULTIBODY_ACTUATIONS_FULL_HPP_
12 #include "crocoddyl/core/actuation-base.hpp"
13 #include "crocoddyl/core/state-base.hpp"
14 #include "crocoddyl/multibody/fwd.hpp"
29 template <
typename _Scalar>
32 typedef _Scalar Scalar;
37 typedef typename MathBase::VectorXs VectorXs;
38 typedef typename MathBase::MatrixXs MatrixXs;
46 :
Base(state, state->get_nv()) {};
56 virtual void calc(
const boost::shared_ptr<Data>& data,
57 const Eigen::Ref<const VectorXs>& ,
58 const Eigen::Ref<const VectorXs>& u) {
59 if (
static_cast<std::size_t
>(u.size()) !=
nu_) {
60 throw_pretty(
"Invalid argument: "
61 <<
"u has wrong dimension (it should be " +
62 std::to_string(
nu_) +
")");
75 virtual void calcDiff(
const boost::shared_ptr<Data>& data,
76 const Eigen::Ref<const VectorXs>& ,
77 const Eigen::Ref<const VectorXs>&) {
79 virtual void calcDiff(
const boost::shared_ptr<Data>&,
80 const Eigen::Ref<const VectorXs>& ,
81 const Eigen::Ref<const VectorXs>&) {
84 assert_pretty(data->dtau_dx.isZero(),
"dtau_dx has wrong value");
85 assert_pretty(MatrixXs(data->dtau_du)
86 .isApprox(MatrixXs::Identity(
state_->get_nv(),
nu_)),
87 "dtau_du has wrong value");
90 virtual void commands(
const boost::shared_ptr<Data>& data,
91 const Eigen::Ref<const VectorXs>&,
92 const Eigen::Ref<const VectorXs>& tau) {
93 if (
static_cast<std::size_t
>(tau.size()) !=
nu_) {
94 throw_pretty(
"Invalid argument: "
95 <<
"tau has wrong dimension (it should be " +
96 std::to_string(
nu_) +
")");
103 const Eigen::Ref<const VectorXs>&,
104 const Eigen::Ref<const VectorXs>&) {
107 const Eigen::Ref<const VectorXs>&,
108 const Eigen::Ref<const VectorXs>&) {
111 assert_pretty(MatrixXs(data->Mtau).isApprox(MatrixXs::Identity(
nu_,
nu_)),
112 "Mtau has wrong value");
122 boost::shared_ptr<Data> data =
123 boost::allocate_shared<Data>(Eigen::aligned_allocator<Data>(),
this);
124 data->dtau_du.diagonal().setOnes();
125 data->Mtau.setIdentity();
Abstract class for the actuation-mapping model.
boost::shared_ptr< StateAbstract > state_
Model of the state.
std::size_t nu_
Dimension of joint torque inputs.
ActuationModelFullTpl(boost::shared_ptr< StateAbstract > state)
Initialize the full actuation model.
boost::shared_ptr< StateAbstract > state_
Model of the state.
std::size_t nu_
Dimension of joint torque inputs.
virtual void torqueTransform(const boost::shared_ptr< Data > &data, const Eigen::Ref< const VectorXs > &, const Eigen::Ref< const VectorXs > &)
Compute the torque transform from generalized torques to joint torque inputs.
virtual void calc(const boost::shared_ptr< Data > &data, const Eigen::Ref< const VectorXs > &, const Eigen::Ref< const VectorXs > &u)
Compute the full actuation.
virtual void commands(const boost::shared_ptr< Data > &data, const Eigen::Ref< const VectorXs > &, const Eigen::Ref< const VectorXs > &tau)
Compute the joint torque input from the generalized torques.
virtual void calcDiff(const boost::shared_ptr< Data > &data, const Eigen::Ref< const VectorXs > &, const Eigen::Ref< const VectorXs > &)
Compute the Jacobians of the full actuation model.
virtual boost::shared_ptr< Data > createData()
Create the full actuation data.
Abstract class for the state representation.