Template Class ResidualModelControlGravTpl
Defined in File control-gravity.hpp
Inheritance Relationships
Base Type
public crocoddyl::ResidualModelAbstractTpl< _Scalar >(Template Class ResidualModelAbstractTpl)
Class Documentation
-
template<typename _Scalar>
class ResidualModelControlGravTpl : public crocoddyl::ResidualModelAbstractTpl<_Scalar> Control gravity residual.
This residual function is defined as \(\mathbf{r}=\mathbf{u}-\mathbf{g}(\mathbf{q})\), where \(\mathbf{u}\in~\mathbb{R}^{nu}\) is the current control input, \(\mathbf{g}(\mathbf{q})\) is the gravity torque corresponding to the current configuration, \(\mathbf{q}\in~\mathbb{R}^{nq}\) the current position joints input. Note that the dimension of the residual vector is obtained from
StateAbstractTpl::get_nv().As described in
ResidualModelAbstractTpl(), the residual value and its Jacobians are calculated bycalc()andcalcDiff(), respectively.See also
Public Types
-
typedef MathBaseTpl<Scalar> MathBase
-
typedef ResidualModelAbstractTpl<Scalar> Base
-
typedef ResidualDataControlGravTpl<Scalar> Data
-
typedef ResidualDataAbstractTpl<Scalar> ResidualDataAbstract
-
typedef StateMultibodyTpl<Scalar> StateMultibody
-
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract
Public Functions
Initialize the control gravity residual model.
- Parameters:
state – [in] State of the multibody system
nu – [in] Dimension of control vector
Initialize the control gravity residual model.
The default
nuvalue is obtained fromStateAbstractTpl::get_nv().- Parameters:
state – [in] State of the multibody system
-
virtual ~ResidualModelControlGravTpl() = default
Compute the control gravity residual.
- Parameters:
data – [in] Control residual data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)
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}\)
Compute the Jacobians of the control gravity residual.
- Parameters:
data – [in] Control residual data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)
-
virtual std::shared_ptr<ResidualDataAbstract> createData(DataCollectorAbstract *const data) override
Create the residual data.
The default data contains objects to store the values of the residual vector and their Jacobians. However, it is possible to specialize this function if we need to create additional data, for instance, to avoid dynamic memory allocation.
- Parameters:
data – Data collector
- Returns:
the residual data
-
template<typename NewScalar>
ResidualModelControlGravTpl<NewScalar> cast() const Cast the control-gravity 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:
ResidualModelControlGravTpl<NewScalar> A residual model with the new scalar type.
-
virtual void print(std::ostream &os) const override
Print relevant information of the control-grav residual.
- Parameters:
os – [out] Output stream object
Public Members
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
Protected Attributes
-
std::size_t nu_
Control dimension.
-
std::shared_ptr<StateAbstract> state_
State description.
-
bool v_dependent_
Label that indicates if the residual function depends on v
-
typedef MathBaseTpl<Scalar> MathBase