Template Class ContactModelMultipleTpl
Defined in File multiple-contacts.hpp
Class Documentation
-
template<typename _Scalar>
class ContactModelMultipleTpl 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.
Public Types
-
typedef MathBaseTpl<Scalar> MathBase
-
typedef StateMultibodyTpl<Scalar> StateMultibody
-
typedef ContactDataAbstractTpl<Scalar> ContactDataAbstract
-
typedef ContactDataMultipleTpl<Scalar> ContactDataMultiple
-
typedef ContactModelAbstractTpl<Scalar> ContactModelAbstract
-
typedef ContactItemTpl<Scalar> ContactItem
-
typedef std::map<std::string, std::shared_ptr<ContactItem>> ContactModelContainer
-
typedef std::map<std::string, std::shared_ptr<ContactDataAbstract>> ContactDataContainer
-
typedef pinocchio::container::aligned_vector<pinocchio::ForceTpl<Scalar>>::iterator ForceIterator
Public Functions
Initialize the multi-contact model.
- Parameters:
state – [in] Multibody state
nu – [in] Dimension of control vector
Initialize the multi-contact model.
- Parameters:
state – [in] Multibody state
-
~ContactModelMultipleTpl()
Add contact item.
Note that the memory is allocated for inactive contacts as well.
- Parameters:
name – [in] Contact name
contact – [in] Contact model
active – [in] Contact status (active by default)
-
void removeContact(const std::string &name)
Remove contact item.
- Parameters:
name – [in] Contact name
-
void changeContactStatus(const std::string &name, const bool active)
Change the contact status.
- Parameters:
name – [in] Contact name
active – [in] Contact status (True for active)
Compute the contact Jacobian and contact acceleration.
- Parameters:
data – [in] Multi-contact data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
Compute the derivatives of the contact holonomic constraint.
- Parameters:
data – [in] Multi-contact data
x – [in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)
Update the constrained system acceleration.
- Parameters:
data – [in] Multi-contact data
dv – [in] Constrained system acceleration \(\dot{\mathbf{v}}\in\mathbb{R}^{nv}\)
Update the spatial force defined in frame coordinate.
- Parameters:
data – [in] Multi-contact data
force – [in] Spatial force defined in frame coordinate \({}^o\underline{\boldsymbol{\lambda}}_c\in\mathbb{R}^{nc}\)
Update the Jacobian of the constrained system acceleration.
- Parameters:
data – [in] Multi-contact data
ddv_dx – [in] Jacobian of the system acceleration in generalized coordinates \(\frac{\partial\dot{\mathbf{v}}}{\partial\mathbf{x}}\in\mathbb{R}^{nv\times ndx}\)
Update the Jacobian of the spatial force defined in frame coordinate.
- Parameters:
data – [in] Multi-contact data
df_dx – [in] Jacobian of the spatial impulse defined in frame coordinate \(\frac{\partial{}^o\underline{\boldsymbol{\lambda}}_c}{\partial\mathbf{x}}\in\mathbb{R}^{nc\times{ndx}}\)
df_du – [in] Jacobian of the spatial impulse defined in frame coordinate \(\frac{\partial{}^o\underline{\boldsymbol{\lambda}}_c}{\partial\mathbf{u}}\in\mathbb{R}^{nc\times{nu}}\)
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:
data – [in] Multi-contact data
pinocchio – [in] Pinocchio data
-
std::shared_ptr<ContactDataMultiple> createData(pinocchio::DataTpl<Scalar> *const data)
Create the multi-contact data.
- Parameters:
data – [in] Pinocchio data
- Returns:
the multi-contact data.
-
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:
NewScalar – The new scalar type to cast to.
- Returns:
ContactModelMultipleTpl<NewScalar> A multi-contact model with the new scalar type.
-
const std::shared_ptr<StateMultibody> &get_state() const
Return the multibody state.
-
const ContactModelContainer &get_contacts() const
Return the contact models.
-
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::set<std::string> &get_active_set() const
Return the names of the set of active contacts.
-
const std::set<std::string> &get_inactive_set() const
Return the names of the set of inactive contacts.
-
bool getContactStatus(const std::string &name) const
Return the status of a given contact name.
-
bool getComputeAllContacts() const
Return the type of contact computation.
True for all contacts, otherwise false for active contacts
-
void setComputeAllContacts(const bool status)
Set the tyoe of contact computation: all or active contacts.
- Parameters:
status – Type of contact computation (true for all contacts and false for active contacts)
Public Members
- EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
Friends
-
template<class Scalar>
friend std::ostream &operator<<(std::ostream &os, const ContactModelMultipleTpl<Scalar> &model) Print information on the contact models.
-
typedef MathBaseTpl<Scalar> MathBase