10 #ifndef CROCODDYL_CORE_ACTUATION_BASE_HPP_
11 #define CROCODDYL_CORE_ACTUATION_BASE_HPP_
13 #include <boost/make_shared.hpp>
14 #include <boost/shared_ptr.hpp>
17 #include "crocoddyl/core/fwd.hpp"
18 #include "crocoddyl/core/mathbase.hpp"
19 #include "crocoddyl/core/state-base.hpp"
20 #include "crocoddyl/core/utils/exception.hpp"
44 template <
typename _Scalar>
47 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49 typedef _Scalar Scalar;
53 typedef typename MathBase::VectorXs VectorXs;
54 typedef typename MathBase::MatrixXs MatrixXs;
63 const std::size_t nu);
75 virtual void calc(
const boost::shared_ptr<ActuationDataAbstract>& data,
76 const Eigen::Ref<const VectorXs>& x,
77 const Eigen::Ref<const VectorXs>& u) = 0;
88 void calc(
const boost::shared_ptr<ActuationDataAbstract>& data,
89 const Eigen::Ref<const VectorXs>& x);
98 virtual void calcDiff(
const boost::shared_ptr<ActuationDataAbstract>& data,
99 const Eigen::Ref<const VectorXs>& x,
100 const Eigen::Ref<const VectorXs>& u) = 0;
111 void calcDiff(
const boost::shared_ptr<ActuationDataAbstract>& data,
112 const Eigen::Ref<const VectorXs>& x);
123 virtual void commands(
const boost::shared_ptr<ActuationDataAbstract>& data,
124 const Eigen::Ref<const VectorXs>& x,
125 const Eigen::Ref<const VectorXs>& tau) = 0;
138 const boost::shared_ptr<ActuationDataAbstract>& data,
139 const Eigen::Ref<const VectorXs>& x,
const Eigen::Ref<const VectorXs>& u);
145 virtual boost::shared_ptr<ActuationDataAbstract>
createData();
155 const boost::shared_ptr<StateAbstract>&
get_state()
const;
160 template <
class Scalar>
169 virtual void print(std::ostream& os)
const;
176 template <
typename _Scalar>
178 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
180 typedef _Scalar Scalar;
182 typedef typename MathBase::VectorXs VectorXs;
183 typedef typename MathBase::MatrixXs MatrixXs;
185 template <
template <
typename Scalar>
class Model>
187 :
tau(model->get_state()->get_nv()),
189 dtau_dx(model->get_state()->get_nv(), model->get_state()->get_ndx()),
190 dtau_du(model->get_state()->get_nv(), model->get_nu()),
191 Mtau(model->get_nu(), model->get_state()->get_nv()),
192 tau_set(model->get_state()->get_nv(),
true) {
217 #include "crocoddyl/core/actuation-base.hxx"
Abstract class for the actuation-mapping model.
virtual void commands(const boost::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 calc(const boost::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 .
const boost::shared_ptr< StateAbstract > & get_state() const
Return the state.
void calc(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Ignore the computation of the actuation signal.
virtual void print(std::ostream &os) const
Print relevant information of the residual model.
void calcDiff(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
Ignore the computation of the Jacobians of the actuation function.
friend std::ostream & operator<<(std::ostream &os, const ResidualModelAbstractTpl< Scalar > &model)
Print information on the residual model.
boost::shared_ptr< StateAbstract > state_
Model of the state.
virtual void calcDiff(const boost::shared_ptr< ActuationDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)=0
Compute the Jacobians of the actuation function.
std::size_t nu_
Dimension of joint torque inputs.
virtual void torqueTransform(const boost::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.
virtual boost::shared_ptr< ActuationDataAbstract > createData()
Create the actuation data.
std::size_t get_nu() const
Return the dimension of the joint-torque input.
ActuationModelAbstractTpl(boost::shared_ptr< StateAbstract > state, const std::size_t nu)
Initialize the actuation model.
Abstract class for residual models.
Abstract class for the state representation.
std::vector< bool > tau_set
True for joints that are actuacted.
VectorXs tau
Generalized torques.