Template Class ResidualModelJointEffortTpl

Inheritance Relationships

Base Type

Class Documentation

template<typename _Scalar>
class ResidualModelJointEffortTpl : public crocoddyl::ResidualModelAbstractTpl<_Scalar>

Define a joint-effort residual.

This residual function is defined as \(\mathbf{r}=\mathbf{u}-\mathbf{u}^*\), where \(\mathbf{u},\mathbf{u}^*\in~\mathbb{R}^{nu}\) are the current and reference joint effort inputs, respectively. Note that the dimension of the residual vector is obtained from ActuationModelAbstract::nu.

Both residual and residual Jacobians are computed analytically.

As described in ResidualModelAbstractTpl(), the residual value and its Jacobians are calculated by calc and calcDiff, respectively.

Public Types

typedef MathBaseTpl<Scalar> MathBase
typedef ResidualModelAbstractTpl<Scalar> Base
typedef ResidualDataJointEffortTpl<Scalar> Data
typedef ResidualDataAbstractTpl<Scalar> ResidualDataAbstract
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract
typedef StateAbstractTpl<Scalar> StateAbstract
typedef ActuationModelAbstractTpl<Scalar> ActuationModelAbstract
typedef MathBase::VectorXs VectorXs
typedef MathBase::MatrixXs MatrixXs

Public Functions

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.

Parameters:
  • state[in] State description

  • actuation[in] Actuation model

  • uref[in] Reference joint effort

  • nu[in] Dimension of the control vector

  • fwddyn[in] Indicates that we have a forward dynamics problem (true) or inverse dynamics (false) (default false)

ResidualModelJointEffortTpl(std::shared_ptr<StateAbstract> state, std::shared_ptr<ActuationModelAbstract> actuation, const VectorXs &uref)

Initialize the joint-effort residual model.

The default nu value is obtained from StateAbstractTpl::get_nv().

Parameters:
  • state[in] State description

  • actuation[in] Actuation model

  • uref[in] Reference joint effort

ResidualModelJointEffortTpl(std::shared_ptr<StateAbstract> state, std::shared_ptr<ActuationModelAbstract> actuation, const std::size_t nu)

Initialize the joint-effort residual model.

The default reference joint effort is obtained from MathBaseTpl<>::VectorXs::Zero(actuation->get_nu()).

Parameters:
  • state[in] State description

  • actuation[in] Actuation model

  • nu[in] Dimension of the control vector

ResidualModelJointEffortTpl(std::shared_ptr<StateAbstract> state, std::shared_ptr<ActuationModelAbstract> actuation)

Initialize the joint-effort residual model.

The default reference joint effort is obtained from MathBaseTpl<>::VectorXs::Zero(actuation->get_nu()). The default nu value is obtained from StateAbstractTpl::get_nv().

Parameters:
  • state[in] State description

  • actuation[in] Actuation model

virtual ~ResidualModelJointEffortTpl() = default
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.

Parameters:
  • data[in] Joint-effort residual data

  • x[in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)

  • u[in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)

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.

It updates the residual vector based on the state only. This function is used in the terminal nodes of an optimal control problem.

Parameters:
  • data[in] Residual data

  • x[in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)

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.

Parameters:
  • data[in] Joint-effort residual data

  • x[in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)

  • u[in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)

virtual void calcDiff(const std::shared_ptr<ResidualDataAbstract> &data, const Eigen::Ref<const VectorXs> &x) override
virtual std::shared_ptr<ResidualDataAbstract> createData(DataCollectorAbstract *const data) override

Create the joint-effort residual data.

template<typename NewScalar>
ResidualModelJointEffortTpl<NewScalar> cast() const

Cast the joint-effort residual model to a different scalar type.

It is useful for operations requiring different precision or scalar types.

Template Parameters:

NewScalar – The new scalar type to cast to.

Returns:

ResidualModelJointEffortTpl<NewScalar> A residual model with the new scalar type.

const VectorXs &get_reference() const

Return the reference joint-effort vector.

void set_reference(const VectorXs &reference)

Modify the reference joint-effort vector.

virtual void print(std::ostream &os) const override

Print relevant information of the joint-effort residual.

Parameters:

os[out] Output stream object

Public Members

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Protected Attributes

std::size_t nr_

Residual vector dimension.

std::size_t nu_

Control dimension.

bool q_dependent_

Label that indicates if the residual function depends on q

std::shared_ptr<StateAbstract> state_

State description.

bool v_dependent_

Label that indicates if the residual function depends on v