10 #ifndef CROCODDYL_CORE_ACTUATION_BASE_HPP_
11 #define CROCODDYL_CORE_ACTUATION_BASE_HPP_
13 #include "crocoddyl/core/fwd.hpp"
14 #include "crocoddyl/core/state-base.hpp"
45 template <
typename _Scalar>
48 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
50 typedef _Scalar Scalar;
54 typedef typename MathBase::VectorXs VectorXs;
55 typedef typename MathBase::MatrixXs MatrixXs;
64 const std::size_t nu);
76 virtual void calc(
const std::shared_ptr<ActuationDataAbstract>& data,
77 const Eigen::Ref<const VectorXs>& x,
78 const Eigen::Ref<const VectorXs>& u) = 0;
89 void calc(
const std::shared_ptr<ActuationDataAbstract>& data,
90 const Eigen::Ref<const VectorXs>& x);
99 virtual void calcDiff(
const std::shared_ptr<ActuationDataAbstract>& data,
100 const Eigen::Ref<const VectorXs>& x,
101 const Eigen::Ref<const VectorXs>& u) = 0;
112 void calcDiff(
const std::shared_ptr<ActuationDataAbstract>& data,
113 const Eigen::Ref<const VectorXs>& x);
124 virtual void commands(
const std::shared_ptr<ActuationDataAbstract>& data,
125 const Eigen::Ref<const VectorXs>& x,
126 const Eigen::Ref<const VectorXs>& tau) = 0;
139 const std::shared_ptr<ActuationDataAbstract>& data,
140 const Eigen::Ref<const VectorXs>& x,
const Eigen::Ref<const VectorXs>& u);
156 const std::shared_ptr<StateAbstract>&
get_state()
const;
161 template <
class Scalar>
170 virtual void print(std::ostream& os)
const;
178 template <
typename _Scalar>
180 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
182 typedef _Scalar Scalar;
184 typedef typename MathBase::VectorXs VectorXs;
185 typedef typename MathBase::MatrixXs MatrixXs;
187 template <
template <
typename Scalar>
class Model>
189 :
tau(model->get_state()->get_nv()),
191 dtau_dx(model->get_state()->get_nv(), model->get_state()->get_ndx()),
192 dtau_du(model->get_state()->get_nv(), model->get_nu()),
193 Mtau(model->get_nu(), model->get_state()->get_nv()),
194 tau_set(model->get_state()->get_nv(),
true) {
219 #include "crocoddyl/core/actuation-base.hxx"
Abstract class for the actuation-mapping model.
std::shared_ptr< StateAbstract > state_
Model of the state.
virtual void print(std::ostream &os) const
Print relevant information of the residual model.
virtual void calc(const std::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
Compute the actuation signal from the state point and joint torque inputs .
void calcDiff(const std::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Ignore the computation of the Jacobians of the actuation function.
virtual void calcDiff(const std::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
Compute the Jacobians of the actuation function.
virtual void commands(const std::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &tau)=0
Compute the joint torque input from the generalized torques.
virtual void torqueTransform(const std::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the torque transform from generalized torques to joint torque inputs.
const std::shared_ptr< StateAbstract > & get_state() const
Return the state.
std::size_t nu_
Dimension of joint torque inputs.
ActuationModelAbstractTpl(std::shared_ptr< StateAbstract > state, const std::size_t nu)
Initialize the actuation model.
friend std::ostream & operator<<(std::ostream &os, const ActuationModelAbstractTpl< Scalar > &model)
Print information on the actuation model.
virtual std::shared_ptr< ActuationDataAbstract > createData()
Create the actuation data.
std::size_t get_nu() const
Return the dimension of the joint-torque input.
void calc(const std::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Ignore the computation of the actuation signal.
Abstract class for the state representation.
std::vector< bool > tau_set
True for joints that are actuacted.
VectorXs tau
Generalized torques.