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"
35 template <
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;
162 template <
typename NewScalar>
180 virtual void print(std::ostream& os)
const override;
190 std::shared_ptr<ActuationModelAbstract> actuation_;
195 template <
typename _Scalar>
197 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
199 typedef _Scalar Scalar;
204 template <
template <
typename Scalar>
class Model>
207 :
Base(model, data) {
213 "Invalid argument: the shared data should be derived from "
214 "DataCollectorJoint");
220 std::shared_ptr<JointDataAbstractTpl<Scalar> >
joint;
232 #include "crocoddyl/core/residuals/joint-effort.hxx"
Abstract class for the actuation-mapping model.
Abstract class for residual models.
std::shared_ptr< StateAbstract > state_
State description.
std::size_t nu_
Control dimension.
std::size_t nr_
Residual vector dimension.
Define a joint-effort residual.
ResidualModelJointEffortTpl< NewScalar > cast() const
Cast the joint-effort residual model to a different scalar type.
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
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.
void set_reference(const VectorXs &reference)
Modify the reference joint-effort vector.
const VectorXs & get_reference() const
Return 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.
virtual void print(std::ostream &os) const override
Print relevant information of the joint-effort residual.
virtual std::shared_ptr< ResidualDataAbstract > createData(DataCollectorAbstract *const data) override
Create the joint-effort residual data.
virtual void calcDiff(const std::shared_ptr< ResidualDataAbstract > &data, const Eigen::Ref< const VectorXs > &x) override
Abstract class for the state representation.
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.
std::shared_ptr< JointDataAbstractTpl< Scalar > > joint
Joint data.
DataCollectorAbstract * shared
Shared data allocated by the action model.