Template Class ResidualModelContactWrenchConeTpl
Defined in File contact-wrench-cone.hpp
Inheritance Relationships
Base Type
public crocoddyl::ResidualModelAbstractTpl< _Scalar >(Template Class ResidualModelAbstractTpl)
Class Documentation
-
template<typename _Scalar>
class ResidualModelContactWrenchConeTpl : public crocoddyl::ResidualModelAbstractTpl<_Scalar> Contact wrench cone residual function.
This residual function is defined as \(\mathbf{r}=\mathbf{A}\boldsymbol{\lambda}\), where \(\mathbf{A}\) is the inequality matrix defined by the contact wrench cone, and \(\boldsymbol{\lambda}\) is the current spatial forces. The current spatial forces \(\boldsymbol{\lambda}\in\mathbb{R}^{nc}\) is computed by
DifferentialActionModelContactFwdDynamicsTplorActionModelImpulseFwdDynamicTpl, withncas the dimension of the contact.Both residual and residual Jacobians are computed analytically, where the force vector \(\boldsymbol{\lambda}\) and its Jacobians \(\left(\frac{\partial\boldsymbol{\lambda}}{\partial\mathbf{x}}, \frac{\partial\boldsymbol{\lambda}}{\partial\mathbf{u}}\right)\) are computed by
DifferentialActionModelContactFwdDynamicsTplorActionModelImpulseFwdDynamicTpl. These values are stored in a shared data (i.e.,DataCollectorContactTplorDataCollectorImpulseTpl). Note that this residual function cannot be used with other action models.See also
ResidualModelAbstractTpl,calc(),calcDiff(),createData(),DifferentialActionModelContactFwdDynamicsTpl,ActionModelImpulseFwdDynamicTpl,DataCollectorForceTplPublic Types
-
typedef MathBaseTpl<Scalar> MathBase
-
typedef ResidualModelAbstractTpl<Scalar> Base
-
typedef ResidualDataContactWrenchConeTpl<Scalar> Data
-
typedef StateMultibodyTpl<Scalar> StateMultibody
-
typedef ResidualDataAbstractTpl<Scalar> ResidualDataAbstract
-
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract
-
typedef WrenchConeTpl<Scalar> WrenchCone
Public Functions
Initialize the contact wrench cone residual model.
Note that for the inverse-dynamic cases, the control vector contains the generalized accelerations, torques, and all the contact forces.
- Parameters:
state – [in] Multibody state
id – [in] Reference frame id
fref – [in] Reference contact wrench cone
nu – [in] Dimension of control vector
fwddyn – [in] Indicates that we have a forward dynamics problem (true) or inverse dynamics (false)
Initialize the contact wrench cone residual model.
The default
nuis obtained fromStateAbstractTpl::get_nv(). Note that this constructor can be used for forward-dynamics cases only.- Parameters:
state – [in] Multibody state
id – [in] Reference frame id
fref – [in] Reference contact wrench cone
-
virtual ~ResidualModelContactWrenchConeTpl() = default
Compute the contact wrench cone residual.
The CoP residual is computed based on the \(\mathbf{A}\) matrix, the force vector is computed by
DifferentialActionModelContactFwdDynamicsTplorActionModelImpulseFwdDynamicTplwhich is stored inDataCollectorContactTplorDataCollectorImpulseTpl.- Parameters:
data – [in] Contact force 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 (i.e., it ignores the contact forces). 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 derivatives of the contact wrench cone residual.
The CoP residual is computed based on the \(\mathbf{A}\) matrix, the force vector is computed by
DifferentialActionModelContactFwdDynamicsTplorActionModelImpulseFwdDynamicTplwhich is stored inDataCollectorContactTplorDataCollectorImpulseTpl.- Parameters:
data – [in] Contact force data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)
Compute the Jacobian of the residual functions with respect to the state only.
It updates the Jacobian of the residual function based on the state only (i.e., it ignores the contact forces). 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 std::shared_ptr<ResidualDataAbstract> createData(DataCollectorAbstract *const data) override
Create the contact wrench cone residual data.
- Parameters:
data – [in] shared data (it should be of type DataCollectorContactTpl)
- Returns:
the residual data.
Update the Jacobians of the contact friction cone residual.
- Parameters:
data – [in] Contact friction cone residual data
-
template<typename NewScalar>
ResidualModelContactWrenchConeTpl<NewScalar> cast() const Cast the contact-wrench-cone 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:
ResidualModelContactWrenchConeTpl<NewScalar> A residual model with the new scalar type.
-
bool is_fwddyn() const
Indicates if we are using the forward-dynamics (true) or inverse-dynamics (false)
-
pinocchio::FrameIndex get_id() const
Return the reference frame id.
-
const WrenchCone &get_reference() const
Return the reference contact wrench cone.
- DEPRECATED ("Do not use set_id, instead create a new model", void set_id(const pinocchio::FrameIndex id);) void set_reference(const WrenchCone &reference)
Modify the reference frame id.
Modify the reference contact wrench cone
-
virtual void print(std::ostream &os) const override
Print relevant information of the contact-wrench-cone 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.
-
typedef MathBaseTpl<Scalar> MathBase