9#ifndef CROCODDYL_MULTIBODY_RESIDUALS_CONTROL_GRAVITY_HPP_
10#define CROCODDYL_MULTIBODY_RESIDUALS_CONTROL_GRAVITY_HPP_
12#include "crocoddyl/core/residual-base.hpp"
13#include "crocoddyl/multibody/states/multibody.hpp"
14#include "crocoddyl/multibody/data/multibody.hpp"
15#include "crocoddyl/core/utils/exception.hpp"
32template <
typename _Scalar>
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
37 typedef _Scalar Scalar;
44 typedef typename MathBase::VectorXs VectorXs;
45 typedef typename MathBase::MatrixXs MatrixXs;
72 virtual void calc(
const boost::shared_ptr<ResidualDataAbstract> &data,
const Eigen::Ref<const VectorXs> &x,
73 const Eigen::Ref<const VectorXs> &u);
79 virtual void calc(
const boost::shared_ptr<ResidualDataAbstract> &data,
const Eigen::Ref<const VectorXs> &x);
88 virtual void calcDiff(
const boost::shared_ptr<ResidualDataAbstract> &data,
const Eigen::Ref<const VectorXs> &x,
89 const Eigen::Ref<const VectorXs> &u);
95 virtual void calcDiff(
const boost::shared_ptr<ResidualDataAbstract> &data,
const Eigen::Ref<const VectorXs> &x);
104 virtual void print(std::ostream &os)
const;
113 typename StateMultibody::PinocchioModel pin_model_;
116template <
typename _Scalar>
118 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
120 typedef _Scalar Scalar;
125 typedef pinocchio::DataTpl<Scalar> PinocchioData;
127 template <
template <
typename Scalar>
class Model>
132 throw_pretty(
"Invalid argument: the shared data should be derived from DataCollectorActMultibodyTpl");
141 boost::shared_ptr<ActuationDataAbstractTpl<Scalar> >
actuation;
153#include "crocoddyl/multibody/residuals/control-gravity.hxx"
Abstract class for residual models.
boost::shared_ptr< StateAbstract > state_
State description.
std::size_t nu_
Control dimension.
VectorXs unone_
No control vector.
bool v_dependent_
Label that indicates if the residual function depends on v.
Control gravity residual.
virtual void calc(const boost::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
virtual boost::shared_ptr< ResidualDataAbstract > createData(DataCollectorAbstract *const data)
Create the residual data.
virtual void calcDiff(const boost::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x)
virtual void print(std::ostream &os) const
Print relevant information of the control-grav residual.
virtual void calc(const boost::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the control gravity residual.
virtual void calcDiff(const boost::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
Compute the Jacobians of the control gravity residual.
ResidualModelControlGravTpl(boost::shared_ptr< StateMultibody > state, const std::size_t nu)
Initialize the control gravity residual model.
ResidualModelControlGravTpl(boost::shared_ptr< StateMultibody > state)
Initialize the control gravity residual model.
State multibody representation.
const boost::shared_ptr< PinocchioModel > & get_pinocchio() const
Return the Pinocchio model (i.e., model of the rigid body system)
MatrixXs Ru
Jacobian of the residual vector with respect the control.
MatrixXs Rx
Jacobian of the residual vector with respect the state.
DataCollectorAbstract * shared
Shared data allocated by the action model.
VectorXs r
Residual vector.
PinocchioData pinocchio
Pinocchio data.
boost::shared_ptr< ActuationDataAbstractTpl< Scalar > > actuation
Actuation data.
DataCollectorAbstract * shared
Shared data allocated by the action model.