Crocoddyl
Loading...
Searching...
No Matches
ContactModelMultipleTpl< _Scalar > Class Template Reference

Define a stack of contact models. More...

#include <multiple-contacts.hpp>

Public Types

typedef ContactDataAbstractTpl< Scalar > ContactDataAbstract
typedef std::map< std::string, std::shared_ptr< ContactDataAbstract > > ContactDataContainer
typedef ContactDataMultipleTpl< Scalar > ContactDataMultiple
typedef ContactItemTpl< Scalar > ContactItem
typedef ContactModelAbstractTpl< Scalar > ContactModelAbstract
typedef std::map< std::string, std::shared_ptr< ContactItem > > ContactModelContainer
typedef pinocchio::container::aligned_vector< pinocchio::ForceTpl< Scalar > >::iterator ForceIterator
typedef MathBaseTpl< Scalar > MathBase
typedef MathBase::MatrixXs MatrixXs
typedef StateMultibodyTpl< Scalar > StateMultibody
typedef MathBase::Vector2s Vector2s
typedef MathBase::Vector3s Vector3s
typedef MathBase::VectorXs VectorXs

Public Member Functions

 ContactModelMultipleTpl (std::shared_ptr< StateMultibody > state)
 Initialize the multi-contact model.
 ContactModelMultipleTpl (std::shared_ptr< StateMultibody > state, const std::size_t nu)
 Initialize the multi-contact model.
void addContact (const std::string &name, std::shared_ptr< ContactModelAbstract > contact, const bool active=true)
 Add contact item.
void calc (const std::shared_ptr< ContactDataMultiple > &data, const Eigen::Ref< const VectorXs > &x)
 Compute the contact Jacobian and contact acceleration.
void calcDiff (const std::shared_ptr< ContactDataMultiple > &data, const Eigen::Ref< const VectorXs > &x)
 Compute the derivatives of the contact holonomic constraint.
template<typename NewScalar>
ContactModelMultipleTpl< NewScalar > cast () const
 Cast the multi-contact model to a different scalar type.
void changeContactStatus (const std::string &name, const bool active)
 Change the contact status.
std::shared_ptr< ContactDataMultiplecreateData (pinocchio::DataTpl< Scalar > *const data)
 Create the multi-contact data.
const std::set< std::string > & get_active_set () const
 Return the names of the set of active contacts.
const ContactModelContainer & get_contacts () const
 Return the contact models.
const std::set< std::string > & get_inactive_set () const
 Return the names of the set of inactive contacts.
std::size_t get_nc () const
 Return the dimension of active contacts.
std::size_t get_nc_total () const
 Return the dimension of all contacts.
std::size_t get_nu () const
 Return the dimension of control vector.
const std::shared_ptr< StateMultibody > & get_state () const
 Return the multibody state.
bool getComputeAllContacts () const
 Return the type of contact computation.
bool getContactStatus (const std::string &name) const
 Return the status of a given contact name.
void removeContact (const std::string &name)
 Remove contact item.
void setComputeAllContacts (const bool status)
 Set the tyoe of contact computation: all or active contacts.
void updateAcceleration (const std::shared_ptr< ContactDataMultiple > &data, const VectorXs &dv) const
 Update the constrained system acceleration.
void updateAccelerationDiff (const std::shared_ptr< ContactDataMultiple > &data, const MatrixXs &ddv_dx) const
 Update the Jacobian of the constrained system acceleration.
void updateForce (const std::shared_ptr< ContactDataMultiple > &data, const VectorXs &force)
 Update the spatial force defined in frame coordinate.
void updateForceDiff (const std::shared_ptr< ContactDataMultiple > &data, const MatrixXs &df_dx, const MatrixXs &df_du) const
 Update the Jacobian of the spatial force defined in frame coordinate.
void updateRneaDiff (const std::shared_ptr< ContactDataMultiple > &data, pinocchio::DataTpl< Scalar > &pinocchio) const
 Update the RNEA derivatives dtau_dq by adding the skew term (necessary for contacts expressed in LOCAL_WORLD_ALIGNED / WORLD)

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Friends

template<class Scalar>
std::ostream & operator<< (std::ostream &os, const ContactModelMultipleTpl< Scalar > &model)
 Print information on the contact models.

Detailed Description

template<typename _Scalar>
class crocoddyl::ContactModelMultipleTpl< _Scalar >

Define a stack of contact models.

The contact models can be defined with active and inactive status. The idea behind this design choice is to be able to create a mechanism that allocates the entire data needed for the computations. Then, there are designed routines that update the only active contacts.

Definition at line 61 of file multiple-contacts.hpp.

Member Typedef Documentation

◆ MathBase

template<typename _Scalar>
typedef MathBaseTpl<Scalar> MathBase

Definition at line 66 of file multiple-contacts.hpp.

◆ StateMultibody

template<typename _Scalar>
typedef StateMultibodyTpl<Scalar> StateMultibody

Definition at line 67 of file multiple-contacts.hpp.

◆ ContactDataAbstract

template<typename _Scalar>
typedef ContactDataAbstractTpl<Scalar> ContactDataAbstract

Definition at line 68 of file multiple-contacts.hpp.

◆ ContactDataMultiple

template<typename _Scalar>
typedef ContactDataMultipleTpl<Scalar> ContactDataMultiple

Definition at line 69 of file multiple-contacts.hpp.

◆ ContactModelAbstract

template<typename _Scalar>
typedef ContactModelAbstractTpl<Scalar> ContactModelAbstract

Definition at line 70 of file multiple-contacts.hpp.

◆ ContactItem

template<typename _Scalar>
typedef ContactItemTpl<Scalar> ContactItem

Definition at line 72 of file multiple-contacts.hpp.

◆ Vector2s

template<typename _Scalar>
typedef MathBase::Vector2s Vector2s

Definition at line 74 of file multiple-contacts.hpp.

◆ Vector3s

template<typename _Scalar>
typedef MathBase::Vector3s Vector3s

Definition at line 75 of file multiple-contacts.hpp.

◆ VectorXs

template<typename _Scalar>
typedef MathBase::VectorXs VectorXs

Definition at line 76 of file multiple-contacts.hpp.

◆ MatrixXs

template<typename _Scalar>
typedef MathBase::MatrixXs MatrixXs

Definition at line 77 of file multiple-contacts.hpp.

◆ ContactModelContainer

template<typename _Scalar>
typedef std::map<std::string, std::shared_ptr<ContactItem> > ContactModelContainer

Definition at line 80 of file multiple-contacts.hpp.

◆ ContactDataContainer

template<typename _Scalar>
typedef std::map<std::string, std::shared_ptr<ContactDataAbstract> > ContactDataContainer

Definition at line 82 of file multiple-contacts.hpp.

◆ ForceIterator

template<typename _Scalar>
typedef pinocchio::container::aligned_vector<pinocchio::ForceTpl<Scalar>>::iterator ForceIterator

Definition at line 84 of file multiple-contacts.hpp.

Constructor & Destructor Documentation

◆ ContactModelMultipleTpl() [1/2]

template<typename _Scalar>
ContactModelMultipleTpl(std::shared_ptr< StateMultibody >state,
const std::size_tnu )

Initialize the multi-contact model.

Parameters
[in]stateMultibody state
[in]nuDimension of control vector

◆ ContactModelMultipleTpl() [2/2]

template<typename _Scalar>
ContactModelMultipleTpl(std::shared_ptr< StateMultibody >state)

Initialize the multi-contact model.

Parameters
[in]stateMultibody state

Member Function Documentation

◆ addContact()

template<typename _Scalar>
void addContact(const std::string &name,
std::shared_ptr< ContactModelAbstract >contact,
const boolactive = true )

Add contact item.

Note that the memory is allocated for inactive contacts as well.

Parameters
[in]nameContact name
[in]contactContact model
[in]activeContact status (active by default)

◆ removeContact()

template<typename _Scalar>
void removeContact(const std::string &name)

Remove contact item.

Parameters
[in]nameContact name

◆ changeContactStatus()

template<typename _Scalar>
void changeContactStatus(const std::string &name,
const boolactive )

Change the contact status.

Parameters
[in]nameContact name
[in]activeContact status (True for active)

◆ calc()

template<typename _Scalar>
void calc(const std::shared_ptr< ContactDataMultiple > &data,
const Eigen::Ref< const VectorXs > &x )

Compute the contact Jacobian and contact acceleration.

Parameters
[in]dataMulti-contact data
[in]xState point $\mathbf{x}\in\mathbb{R}^{ndx}$

◆ calcDiff()

template<typename _Scalar>
void calcDiff(const std::shared_ptr< ContactDataMultiple > &data,
const Eigen::Ref< const VectorXs > &x )

Compute the derivatives of the contact holonomic constraint.

Parameters
[in]dataMulti-contact data
[in]xState point $\mathbf{x}\in\mathbb{R}^{ndx}$

◆ updateAcceleration()

template<typename _Scalar>
void updateAcceleration(const std::shared_ptr< ContactDataMultiple > &data,
const VectorXs &dv ) const

Update the constrained system acceleration.

Parameters
[in]dataMulti-contact data
[in]dvConstrained system acceleration $\dot{\mathbf{v}}\in\mathbb{R}^{nv}$

◆ updateForce()

template<typename _Scalar>
void updateForce(const std::shared_ptr< ContactDataMultiple > &data,
const VectorXs &force )

Update the spatial force defined in frame coordinate.

Parameters
[in]dataMulti-contact data
[in]forceSpatial force defined in frame coordinate ${}^o\underline{\boldsymbol{\lambda}}_c\in\mathbb{R}^{nc}$

◆ updateAccelerationDiff()

template<typename _Scalar>
void updateAccelerationDiff(const std::shared_ptr< ContactDataMultiple > &data,
const MatrixXs &ddv_dx ) const

Update the Jacobian of the constrained system acceleration.

Parameters
[in]dataMulti-contact data
[in]ddv_dxJacobian of the system acceleration in generalized coordinates $\frac{\partial\dot{\mathbf{v}}}{\partial\mathbf{x}}\in\mathbb{R}^{nv\times
ndx}$

◆ updateForceDiff()

template<typename _Scalar>
void updateForceDiff(const std::shared_ptr< ContactDataMultiple > &data,
const MatrixXs &df_dx,
const MatrixXs &df_du ) const

Update the Jacobian of the spatial force defined in frame coordinate.

Parameters
[in]dataMulti-contact data
[in]df_dxJacobian of the spatial impulse defined in frame coordinate $\frac{\partial{}^o\underline{\boldsymbol{\lambda}}_c}{\partial\mathbf{x}}\in\mathbb{R}^{nc\times{ndx}}$
[in]df_duJacobian of the spatial impulse defined in frame coordinate $\frac{\partial{}^o\underline{\boldsymbol{\lambda}}_c}{\partial\mathbf{u}}\in\mathbb{R}^{nc\times{nu}}$

◆ updateRneaDiff()

template<typename _Scalar>
void updateRneaDiff(const std::shared_ptr< ContactDataMultiple > &data,
pinocchio::DataTpl< Scalar > &pinocchio ) const

Update the RNEA derivatives dtau_dq by adding the skew term (necessary for contacts expressed in LOCAL_WORLD_ALIGNED / WORLD)

To learn more about the computation of the contact derivatives in different frames see https://hal.science/hal-03758989/document.

Parameters
[in]dataMulti-contact data
[in]pinocchioPinocchio data

◆ createData()

template<typename _Scalar>
std::shared_ptr< ContactDataMultiple > createData(pinocchio::DataTpl< Scalar > *constdata)

Create the multi-contact data.

Parameters
[in]dataPinocchio data
Returns
the multi-contact data.

◆ cast()

template<typename _Scalar>
template<typename NewScalar>
ContactModelMultipleTpl< NewScalar > cast()const

Cast the multi-contact model to a different scalar type.

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

Template Parameters
NewScalarThe new scalar type to cast to.
Returns
ContactModelMultipleTpl<NewScalar> A multi-contact model with the new scalar type.

◆ getComputeAllContacts()

template<typename _Scalar>
bool getComputeAllContacts()const

Return the type of contact computation.

True for all contacts, otherwise false for active contacts

◆ setComputeAllContacts()

template<typename _Scalar>
void setComputeAllContacts(const boolstatus)

Set the tyoe of contact computation: all or active contacts.

Parameters
statusType of contact computation (true for all contacts and false for active contacts)

Member Data Documentation

◆ Scalar

template<typename _Scalar>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Definition at line 65 of file multiple-contacts.hpp.


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