Template Class DifferentialActionModelContactInvDynamicsTpl
Defined in File contact-invdyn.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public crocoddyl::DifferentialActionModelAbstractTpl< _Scalar >(Template Class DifferentialActionModelAbstractTpl)
Class Documentation
-
template<typename _Scalar>
class DifferentialActionModelContactInvDynamicsTpl : public crocoddyl::DifferentialActionModelAbstractTpl<_Scalar> Differential action model for contact inverse dynamics in multibody systems.
This class implements forward kinematic with holonomic contact constraints (defined at the acceleration level) and inverse-dynamics computation using the Recursive Newton Euler Algorithm (RNEA). The stack of cost and constraint functions are implemented in
CostModelSumTplandConstraintModelManagerTpl, respectively. The acceleration and contact forces are decision variables defined as the control inputs, and the under-actuation and contact constraint are under the nametauand its frame name, thus the user is not allowed to use it.Additionally, it is important to note that
calcDiff()computes the derivatives using the latest stored values bycalc(). Thus, we need to first runcalc().Public Types
-
typedef DifferentialActionModelAbstractTpl<Scalar> Base
-
typedef DifferentialActionDataContactInvDynamicsTpl<Scalar> Data
-
typedef StateMultibodyTpl<Scalar> StateMultibody
-
typedef ActuationModelAbstractTpl<Scalar> ActuationModelAbstract
-
typedef CostModelSumTpl<Scalar> CostModelSum
-
typedef ConstraintModelManagerTpl<Scalar> ConstraintModelManager
-
typedef ContactModelMultipleTpl<Scalar> ContactModelMultiple
-
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract
-
typedef DifferentialActionDataAbstractTpl<Scalar> DifferentialActionDataAbstract
-
typedef ContactItemTpl<Scalar> ContactItem
-
typedef MathBaseTpl<Scalar> MathBase
Public Functions
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW CROCODDYL_DERIVED_CAST (DifferentialActionModelBase, DifferentialActionModelContactInvDynamicsTpl) typedef _Scalar Scalar
Initialize the contact inverse-dynamics action model.
It describes the kinematic evolution of the multibody system with contacts, and computes the needed torques using inverse-dynamics.
- Parameters:
state – [in] State of the multibody system
actuation – [in] Actuation model
contacts – [in] Multiple contacts
costs – [in] Cost model
Initialize the contact inverse-dynamics action model.
- Parameters:
state – [in] State of the multibody system
actuation – [in] Actuation model
contacts – [in] Multiple contacts
costs – [in] Cost model
constraints – [in] Constraints model
-
virtual ~DifferentialActionModelContactInvDynamicsTpl() = default
Compute the system acceleration, cost value and constraint residuals.
It extracts the acceleration value from control vector and also computes the cost and constraints.
- Parameters:
data – [in] Contact inverse-dynamics data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)
Compute the derivatives of the dynamics, cost and constraint functions.
It computes the partial derivatives of the dynamical system and the cost and contraint functions. It assumes that
calc()has been run first. This function builds a quadratic approximation of the time-continuous action model (i.e., dynamical system, cost and constraint functions).- Parameters:
data – [in] Contact inverse-dynamics 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<DifferentialActionDataAbstract> createData() override
Create the contact inverse-dynamics data.
- Returns:
contact inverse-dynamics data
-
template<typename NewScalar>
DifferentialActionModelContactInvDynamicsTpl<NewScalar> cast() const Cast the contact-invdyn 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:
DifferentialActionModelContactInvDynamicsTpl<NewScalar> A differential-action model with the new scalar type.
Checks that a specific data belongs to the contact inverse-dynamics model.
Computes the quasic static commands.
The quasic static commands are the ones produced for a reference posture as an equilibrium point with zero acceleration, i.e., for \(\mathbf{f^q_x}\delta\mathbf{q}+\mathbf{f_u}\delta\mathbf{u}=\mathbf{0}\)
- Parameters:
data – [in] Contact inverse-dynamics data
u – [out] Quasic-static commands
x – [in] State point (velocity has to be zero)
maxiter – [in] Maximum allowed number of iterations (default 100)
tol – [in] Tolerance (default 1e-9)
-
virtual std::size_t get_ng() const override
Return the number of inequality constraints.
-
virtual std::size_t get_nh() const override
Return the number of equality constraints.
-
virtual std::size_t get_ng_T() const override
Return the number of equality terminal constraints.
-
virtual std::size_t get_nh_T() const override
Return the number of equality terminal constraints.
-
virtual const VectorXs &get_g_lb() const override
Return the lower bound of the inequality constraints.
-
virtual const VectorXs &get_g_ub() const override
Return the upper bound of the inequality constraints.
-
const std::shared_ptr<ActuationModelAbstract> &get_actuation() const
Return the actuation model.
-
const std::shared_ptr<ContactModelMultiple> &get_contacts() const
Return the contact model.
-
const std::shared_ptr<CostModelSum> &get_costs() const
Return the cost model.
-
const std::shared_ptr<ConstraintModelManager> &get_constraints() const
Return the constraint model manager.
-
pinocchio::ModelTpl<Scalar> &get_pinocchio() const
Return the Pinocchio model.
-
virtual void print(std::ostream &os) const override
Print relevant information of the contact inverse-dynamics model.
- Parameters:
os – [out] Output stream object
Protected Attributes
-
std::size_t ng_
< Upper bound of the inequality constraints
-
std::size_t nh_
< Number of inequality constraints
-
std::size_t nu_
< Number of equality constraints
-
std::shared_ptr<StateAbstract> state_
< Control dimension
-
class ResidualModelActuation : public crocoddyl::ResidualModelAbstractTpl<_Scalar>
Actuation residual.
This residual function enforces the torques of under-actuated joints (e.g., floating-base joints) to be zero. We compute these torques and their derivatives using RNEA inside
DifferentialActionModelContactInvDynamicsTpl.As described in
ResidualModelAbstractTpl, the residual value and its Jacobians are calculated bycalcandcalcDiff, respectively.See also
Public Types
-
typedef MathBaseTpl<Scalar> MathBase
-
typedef ResidualModelAbstractTpl<Scalar> Base
-
typedef StateMultibodyTpl<Scalar> StateMultibody
-
typedef ResidualDataAbstractTpl<Scalar> ResidualDataAbstract
-
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract
Public Functions
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW CROCODDYL_INNER_DERIVED_CAST (ResidualModelBase, DifferentialActionModelContactInvDynamicsTpl, ResidualModelActuation) typedef _Scalar Scalar
Initialize the actuation residual model.
- Parameters:
state – [in] State of the multibody system
nu – [in] Dimension of the joint torques
nc – [in] Dimension of all the contacts
-
virtual ~ResidualModelActuation() = default
Compute the actuation residual.
- Parameters:
data – [in] Actuation residual data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nv+nu}\)
Compute the derivatives of the actuation residual.
- Parameters:
data – [in] Actuation residual data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)
-
inline virtual std::shared_ptr<ResidualDataAbstract> createData(DataCollectorAbstract *const data) override
Create the actuation residual data.
- Returns:
Actuation residual data
-
template<typename NewScalar>
inline DifferentialActionModelContactInvDynamicsTpl<NewScalar>::ResidualModelActuation cast() const Cast the actuation-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:
DifferentialActionModelContactInvDynamicsTpl<NewScalar>::ResidualModelActuation A residual model with the new scalar type.
-
inline virtual void print(std::ostream &os) const override
Print relevant information of the actuation residual model.
- Parameters:
os – [out] Output stream object
Protected Attributes
-
std::size_t nu_
Control dimension.
-
std::shared_ptr<StateAbstract> state_
State description.
-
typedef MathBaseTpl<Scalar> MathBase
-
class ResidualModelContact : public crocoddyl::ResidualModelAbstractTpl<_Scalar>
Contact-acceleration residual.
This residual function is defined as \(\mathbf{r} = \mathbf{a_0}\), where \(\mathbf{a_0}\) defines the desired contact acceleration, which might also include the Baumgarte stabilization gains. Furthermore, the Jacobians of the residual function are computed analytically. This is used by
ConstraintModelManagerTplinside parentDifferentialActionModelContactInvDynamicsTplclass.As described in
ResidualModelAbstractTpl, the residual value and its Jacobians are calculated bycalcandcalcDiff, respectively.See also
Public Types
-
typedef MathBaseTpl<Scalar> MathBase
-
typedef ResidualModelAbstractTpl<Scalar> Base
-
typedef StateMultibodyTpl<Scalar> StateMultibody
-
typedef ResidualDataAbstractTpl<Scalar> ResidualDataAbstract
-
typedef DataCollectorAbstractTpl<Scalar> DataCollectorAbstract
Public Functions
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW CROCODDYL_INNER_DERIVED_CAST (ResidualModelBase, DifferentialActionModelContactInvDynamicsTpl, ResidualModelContact) typedef _Scalar Scalar
Initialize the contact-acceleration residual model.
- Parameters:
state – [in] State of the multibody system
id – [in] Contact frame id
nr – [in] Dimension of the contact-acceleration residual
nc – [in] Dimension of all contacts
-
virtual ~ResidualModelContact() = default
Compute the contact-acceleration residual.
- Parameters:
data – [in] Contact-acceleration residual data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nv+nu}\)
Compute the derivatives of the contact-acceleration residual.
- Parameters:
data – [in] Contact-acceleration residual data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
u – [in] Control input \(\mathbf{u}\in\mathbb{R}^{nu}\)
-
inline virtual std::shared_ptr<ResidualDataAbstract> createData(DataCollectorAbstract *const data) override
Create the contact-acceleration residual data.
- Returns:
contact-acceleration residual data
-
template<typename NewScalar>
inline DifferentialActionModelContactInvDynamicsTpl<NewScalar>::ResidualModelContact cast() const Cast the contact-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:
typename DifferentialActionModelContactInvDynamicsTpl<NewScalar>::ResidualModelContact A residual model with the new scalar type.
-
inline virtual void print(std::ostream &os) const override
Print relevant information of the contact-acceleration residual model.
- Parameters:
os – [out] Output stream object
Protected Attributes
-
std::size_t nr_
Residual vector dimension.
-
std::size_t nu_
Control dimension.
-
std::shared_ptr<StateAbstract> state_
State description.
-
typedef MathBaseTpl<Scalar> MathBase
-
typedef DifferentialActionModelAbstractTpl<Scalar> Base