9#ifndef CROCODDYL_CORE_ACTUATION_BASE_HPP_
10#define CROCODDYL_CORE_ACTUATION_BASE_HPP_
13#include <boost/shared_ptr.hpp>
14#include <boost/make_shared.hpp>
16#include "crocoddyl/core/fwd.hpp"
17#include "crocoddyl/core/mathbase.hpp"
18#include "crocoddyl/core/state-base.hpp"
19#include "crocoddyl/core/utils/exception.hpp"
38template <
typename _Scalar>
41 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
43 typedef _Scalar Scalar;
47 typedef typename MathBase::VectorXs VectorXs;
48 typedef typename MathBase::MatrixXs MatrixXs;
67 virtual void calc(
const boost::shared_ptr<ActuationDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
68 const Eigen::Ref<const VectorXs>& u) = 0;
79 void calc(
const boost::shared_ptr<ActuationDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x);
88 virtual void calcDiff(
const boost::shared_ptr<ActuationDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x,
89 const Eigen::Ref<const VectorXs>& u) = 0;
100 void calcDiff(
const boost::shared_ptr<ActuationDataAbstract>& data,
const Eigen::Ref<const VectorXs>& x);
107 virtual boost::shared_ptr<ActuationDataAbstract>
createData();
117 const boost::shared_ptr<StateAbstract>&
get_state()
const;
122 template <
class Scalar>
130 virtual void print(std::ostream& os)
const;
137template <
typename _Scalar>
139 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
141 typedef _Scalar Scalar;
143 typedef typename MathBase::VectorXs VectorXs;
144 typedef typename MathBase::MatrixXs MatrixXs;
146 template <
template <
typename Scalar>
class Model>
148 :
tau(model->get_state()->get_nv()),
149 dtau_dx(model->get_state()->get_nv(), model->get_state()->get_ndx()),
150 dtau_du(model->get_state()->get_nv(), model->get_nu()) {
167#include "crocoddyl/core/actuation-base.hxx"
Abstract class for the actuation-mapping model.
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 control input .
virtual boost::shared_ptr< ActuationDataAbstract > createData()
Create the actuation data.
friend std::ostream & operator<<(std::ostream &os, const ResidualModelAbstractTpl< Scalar > &model)
Print information on the residual model.
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.
const boost::shared_ptr< StateAbstract > & get_state() const
Return the state.
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_
Control dimension.
std::size_t get_nu() const
Return the dimension of the control 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.
MatrixXs dtau_dx
Partial derivatives of the actuation model w.r.t. the state point.
VectorXs tau
Actuation (generalized force) signal.
MatrixXs dtau_du
Partial derivatives of the actuation model w.r.t. the control input.