9#ifndef CROCODDYL_CORE_RESIDUALS_JOINT_TORQUE_HPP_ 10#define CROCODDYL_CORE_RESIDUALS_JOINT_TORQUE_HPP_ 12#include "crocoddyl/core/actuation-base.hpp" 13#include "crocoddyl/core/data/joint.hpp" 14#include "crocoddyl/core/fwd.hpp" 15#include "crocoddyl/core/residual-base.hpp" 35template <
typename _Scalar>
38 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41 typedef _Scalar Scalar;
49 typedef typename MathBase::VectorXs VectorXs;
50 typedef typename MathBase::MatrixXs MatrixXs;
63 std::shared_ptr<ActuationModelAbstract> actuation,
64 const VectorXs& uref,
const std::size_t nu,
65 const bool fwddyn =
false);
77 std::shared_ptr<ActuationModelAbstract> actuation,
78 const VectorXs& uref);
91 std::shared_ptr<ActuationModelAbstract> actuation,
92 const std::size_t nu);
105 std::shared_ptr<StateAbstract> state,
106 std::shared_ptr<ActuationModelAbstract> actuation);
117 virtual void calc(
const std::shared_ptr<ResidualDataAbstract>& data,
118 const Eigen::Ref<const VectorXs>& x,
119 const Eigen::Ref<const VectorXs>& u)
override;
125 virtual void calc(
const std::shared_ptr<ResidualDataAbstract>& data,
126 const Eigen::Ref<const VectorXs>& x)
override;
135 virtual void calcDiff(
const std::shared_ptr<ResidualDataAbstract>& data,
136 const Eigen::Ref<const VectorXs>& x,
137 const Eigen::Ref<const VectorXs>& u)
override;
144 virtual void calcDiff(
const std::shared_ptr<ResidualDataAbstract>& data,
145 const Eigen::Ref<const VectorXs>& x)
override;
151 DataCollectorAbstract*
const data)
override;
162 template <
typename NewScalar>
180 virtual void print(std::ostream& os)
const override;
190 std::shared_ptr<ActuationModelAbstract> actuation_;
195template <
typename _Scalar>
196struct ResidualDataJointEffortTpl :
public ResidualDataAbstractTpl<_Scalar> {
197 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
199 typedef _Scalar Scalar;
201 typedef ResidualDataAbstractTpl<Scalar> Base;
204 template <
template <
typename Scalar>
class Model>
205 ResidualDataJointEffortTpl(Model<Scalar>*
const model,
206 DataCollectorAbstract*
const data)
207 : Base(model, data) {
213 "Invalid argument: the shared data should be derived from " 214 "DataCollectorJoint");
218 virtual ~ResidualDataJointEffortTpl() =
default;
220 std::shared_ptr<JointDataAbstractTpl<Scalar> >
joint;
232#include "crocoddyl/core/residuals/joint-effort.hxx" Abstract class for the actuation-mapping model.
std::shared_ptr< StateAbstract > state_
ResidualModelAbstractTpl(std::shared_ptr< StateAbstract > state, const std::size_t nr, const std::size_t nu, const bool q_dependent=true, const bool v_dependent=true, const bool u_dependent=true)
Initialize the residual model.
Define a joint-effort residual.
ResidualModelJointEffortTpl(std::shared_ptr< StateAbstract > state, std::shared_ptr< ActuationModelAbstract > actuation, const VectorXs &uref)
Initialize the joint-effort residual model.
virtual void calc(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x) override
Compute the residual vector for nodes that depends only on the state.
ResidualModelJointEffortTpl(std::shared_ptr< StateAbstract > state, std::shared_ptr< ActuationModelAbstract > actuation)
Initialize the joint-effort residual model.
virtual void calcDiff(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
Compute the derivatives of the joint-effort residual.
virtual std::shared_ptr< ResidualDataAbstract > createData(DataCollectorAbstract *const data) override
Create the joint-effort residual data.
void set_reference(const VectorXs &reference)
Modify the reference joint-effort vector.
ResidualModelJointEffortTpl(std::shared_ptr< StateAbstract > state, std::shared_ptr< ActuationModelAbstract > actuation, const std::size_t nu)
Initialize the joint-effort residual model.
ResidualModelJointEffortTpl(std::shared_ptr< StateAbstract > state, std::shared_ptr< ActuationModelAbstract > actuation, const VectorXs &uref, const std::size_t nu, const bool fwddyn=false)
Initialize the joint-effort residual model.
virtual void calc(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u) override
Compute the joint-effort residual.
ResidualModelJointEffortTpl< NewScalar > cast() const
Cast the joint-effort residual model to a different scalar type.
virtual void print(std::ostream &os) const override
Print relevant information of the joint-effort residual.
const VectorXs & get_reference() const
Return the reference joint-effort vector.
virtual void calcDiff(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x) override
Abstract class for the state representation.
DataCollectorAbstract * shared
std::shared_ptr< JointDataAbstractTpl< Scalar > > joint
Joint data.
DataCollectorAbstract * shared
Shared data allocated by the action model.