sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar > Class Template Reference

Differential action model for contact forward dynamics in multibody systems. More...

#include <sobec/crocomplements/contact/contact-fwddyn.hpp>

Inheritance diagram for sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >:
Collaboration diagram for sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >:

Public Types

typedef crocoddyl::DifferentialActionModelContactFwdDynamicsTpl< ScalarBase
 
typedef crocoddyl::DifferentialActionDataContactFwdDynamicsTpl< ScalarData
 
typedef crocoddyl::MathBaseTpl< ScalarMathBase
 
typedef crocoddyl::CostModelSumTpl< ScalarCostModelSum
 
typedef crocoddyl::StateMultibodyTpl< ScalarStateMultibody
 
typedef crocoddyl::ContactModelMultipleTpl< ScalarcrocoContactModelMultiple
 
typedef crocoddyl::ActuationModelAbstractTpl< ScalarActuationModelAbstract
 
typedef crocoddyl::DifferentialActionDataAbstractTpl< ScalarDifferentialActionDataAbstract
 
typedef MathBase::VectorXs VectorXs
 
typedef MathBase::MatrixXs MatrixXs
 

Public Member Functions

 DifferentialActionModelContactFwdDynamicsTpl (boost::shared_ptr< StateMultibody > state, boost::shared_ptr< ActuationModelAbstract > actuation, boost::shared_ptr< crocoContactModelMultiple > contacts, boost::shared_ptr< CostModelSum > costs, const Scalar JMinvJt_damping=Scalar(0.), const bool enable_force=false)
 Initialize the contact forward-dynamics action model. More...
 
virtual ~DifferentialActionModelContactFwdDynamicsTpl ()
 
virtual void calcDiff (const boost::shared_ptr< DifferentialActionDataAbstract > &data, const Eigen::Ref< const VectorXs > &x, const Eigen::Ref< const VectorXs > &u)
 Compute the derivatives of the contact dynamics, and cost function. More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
 

Detailed Description

template<typename _Scalar>
class sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >

Differential action model for contact forward dynamics in multibody systems.

This class is derived from crocoddyl::DifferentialActionModelContactFwdDynamicsTpl with the additional feature that it allows to compute the contact forward dynamics under sobec contact models (1D & 3D), which can be expressed in the LOCAL or LOCAL_WORLD_ALIGNED / WORLD reference frame. It amounts to add in calcDiff some terms to the RNEA derivatives (and to the contact force derivatives if a contact force cost is defined). The maths of these modifications are detailed here : https://www.overleaf.com/read/tzvrrxxtntwk

This class implements contact forward dynamics given a stack of rigid-contacts described in ContactModelMultipleTpl, i.e.,

\[ \left[\begin{matrix}\dot{\mathbf{v}} \\ -\boldsymbol{\lambda}\end{matrix}\right] = \left[\begin{matrix}\mathbf{M} & \mathbf{J}^{\top}_c \\ {\mathbf{J}_{c}} & \mathbf{0} \end{matrix}\right]^{-1} \left[\begin{matrix}\boldsymbol{\tau}_b \\ -\mathbf{a}_0 \\\end{matrix}\right], \]

where \(\mathbf{q}\in Q\), \(\mathbf{v}\in\mathbb{R}^{nv}\) are the configuration point and generalized velocity (its tangent vector), respectively; \(\boldsymbol{\tau}_b=\boldsymbol{\tau} - \mathbf{h}(\mathbf{q},\mathbf{v})\) is the bias forces that depends on the torque inputs \(\boldsymbol{\tau}\) and the Coriolis effect and gravity field \(\mathbf{h}(\mathbf{q},\mathbf{v})\); \(\mathbf{J}_c\in\mathbb{R}^{nc\times nv}\) is the contact Jacobian expressed in the local frame; and \(\mathbf{a}_0\in\mathbb{R}^{nc}\) is the desired acceleration in the constraint space. To improve stability in the numerical integration, we define PD gains that are similar in spirit to Baumgarte stabilization:

\[ \mathbf{a}_0 = \mathbf{a}_{\lambda(c)} - \alpha \,^oM^{ref}_{\lambda(c)}\ominus\,^oM_{\lambda(c)} - \beta\mathbf{v}_{\lambda(c)}, \]

where \(\mathbf{v}_{\lambda(c)}\), \(\mathbf{a}_{\lambda(c)}\) are the spatial velocity and acceleration at the parent body of the contact \(\lambda(c)\), respectively; \(\alpha\) and \(\beta\) are the stabilization gains; \(\,^oM^{ref}_{\lambda(c)}\ominus\,^oM_{\lambda(c)}\) is the \(\mathbb{SE}(3)\) inverse composition between the reference contact placement and the current one.

The derivatives of the system acceleration and contact forces are computed efficiently based on the analytical derivatives of Recursive Newton Euler Algorithm (RNEA) as described in [mastalli-icra20]. Note that the algorithm for computing the RNEA derivatives is described in [carpentier-rss18].

The stack of cost functions is implemented in CostModelSumTpl. The computation of the contact dynamics and its derivatives are carrying out inside calc() and calcDiff() functions, respectively. It is also important to remark that calcDiff() computes the derivatives using the latest stored values by calc(). Thus, we need to run calc() first.

See also
DifferentialActionModelAbstractTpl, calc(), calcDiff(), createData()

Member Typedef Documentation

◆ ActuationModelAbstract

template<typename _Scalar >
typedef crocoddyl::ActuationModelAbstractTpl<Scalar> sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::ActuationModelAbstract

◆ Base

template<typename _Scalar >
typedef crocoddyl::DifferentialActionModelContactFwdDynamicsTpl<Scalar> sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::Base

◆ CostModelSum

template<typename _Scalar >
typedef crocoddyl::CostModelSumTpl<Scalar> sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::CostModelSum

◆ crocoContactModelMultiple

template<typename _Scalar >
typedef crocoddyl::ContactModelMultipleTpl<Scalar> sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::crocoContactModelMultiple

◆ Data

template<typename _Scalar >
typedef crocoddyl::DifferentialActionDataContactFwdDynamicsTpl<Scalar> sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::Data

◆ DifferentialActionDataAbstract

template<typename _Scalar >
typedef crocoddyl::DifferentialActionDataAbstractTpl<Scalar> sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::DifferentialActionDataAbstract

◆ MathBase

template<typename _Scalar >
typedef crocoddyl::MathBaseTpl<Scalar> sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::MathBase

◆ MatrixXs

template<typename _Scalar >
typedef MathBase::MatrixXs sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::MatrixXs

◆ StateMultibody

template<typename _Scalar >
typedef crocoddyl::StateMultibodyTpl<Scalar> sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::StateMultibody

◆ VectorXs

template<typename _Scalar >
typedef MathBase::VectorXs sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::VectorXs

Constructor & Destructor Documentation

◆ DifferentialActionModelContactFwdDynamicsTpl()

template<typename Scalar >
sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< Scalar >::DifferentialActionModelContactFwdDynamicsTpl ( boost::shared_ptr< StateMultibody state,
boost::shared_ptr< ActuationModelAbstract actuation,
boost::shared_ptr< crocoContactModelMultiple contacts,
boost::shared_ptr< CostModelSum costs,
const Scalar  JMinvJt_damping = Scalar(0.),
const bool  enable_force = false 
)

Initialize the contact forward-dynamics action model.

It describes the dynamics evolution of a multibody system under rigid-contact constraints defined by ContactModelMultipleTpl. It computes the cost described in CostModelSumTpl.

Parameters
[in]stateState of the multibody system
[in]actuationActuation model
[in]contactsStack of rigid contact
[in]costsStack of cost functions
[in]JMinvJt_dampingDamping term used in operational space inertia matrix (default 0.)
[in]enable_forceEnable the computation of the contact force derivatives (default false)

◆ ~DifferentialActionModelContactFwdDynamicsTpl()

Member Function Documentation

◆ calcDiff()

template<typename Scalar >
void sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< Scalar >::calcDiff ( const boost::shared_ptr< DifferentialActionDataAbstract > &  data,
const Eigen::Ref< const VectorXs > &  x,
const Eigen::Ref< const VectorXs > &  u 
)
virtual

Compute the derivatives of the contact dynamics, and cost function.

Parameters
[in]dataContact forward-dynamics data
[in]xState point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
[in]uControl input \(\mathbf{u}\in\mathbb{R}^{nu}\)

Member Data Documentation

◆ Scalar

template<typename _Scalar >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar sobec::newcontacts::DifferentialActionModelContactFwdDynamicsTpl< _Scalar >::Scalar

The documentation for this class was generated from the following files: