Template Class ImpulseModelMultipleTpl

Class Documentation

template<typename _Scalar>
class ImpulseModelMultipleTpl

Define a stack of impulse models.

The impulse 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 impulse.

Public Types

typedef MathBaseTpl<Scalar> MathBase
typedef StateMultibodyTpl<Scalar> StateMultibody
typedef ImpulseDataAbstractTpl<Scalar> ImpulseDataAbstract
typedef ImpulseDataMultipleTpl<Scalar> ImpulseDataMultiple
typedef ImpulseModelAbstractTpl<Scalar> ImpulseModelAbstract
typedef ImpulseItemTpl<Scalar> ImpulseItem
typedef MathBase::Vector2s Vector2s
typedef MathBase::Vector3s Vector3s
typedef MathBase::VectorXs VectorXs
typedef MathBase::MatrixXs MatrixXs
typedef std::map<std::string, std::shared_ptr<ImpulseItem>> ImpulseModelContainer
typedef std::map<std::string, std::shared_ptr<ImpulseDataAbstract>> ImpulseDataContainer
typedef pinocchio::container::aligned_vector<pinocchio::ForceTpl<Scalar>>::iterator ForceIterator

Public Functions

explicit ImpulseModelMultipleTpl(std::shared_ptr<StateMultibody> state)

Initialize the multi-impulse model.

Parameters:

state[in] Multibody state

~ImpulseModelMultipleTpl()
void addImpulse(const std::string &name, std::shared_ptr<ImpulseModelAbstract> impulse, const bool active = true)

Add impulse item.

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

Parameters:
  • name[in] Impulse name

  • impulse[in] Impulse model

  • active[in] Impulse status (active by default)

void removeImpulse(const std::string &name)

Remove impulse item.

Parameters:

name[in] Impulse name

void changeImpulseStatus(const std::string &name, const bool active)

Change the impulse status.

Parameters:
  • name[in] Impulse name

  • active[in] Impulse status (True for active)

void calc(const std::shared_ptr<ImpulseDataMultiple> &data, const Eigen::Ref<const VectorXs> &x)

Compute the total impulse Jacobian and impulse velocity.

Parameters:
  • data[in] Multi-impulse data

  • x[in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)

void calcDiff(const std::shared_ptr<ImpulseDataMultiple> &data, const Eigen::Ref<const VectorXs> &x)

Compute the derivatives of the impulse holonomic constraint.

Parameters:
  • data[in] Multi-impulse data

  • x[in] State point \(\mathbf{x}\in\mathbb{R}^{ndx}\)

void updateVelocity(const std::shared_ptr<ImpulseDataMultiple> &data, const VectorXs &vnext) const

Update the system velocity after impulse.

Parameters:
  • data[in] Multi-impulse data

  • vnext[in] System velocity after impulse \(\mathbf{v}'\in\mathbb{R}^{nv}\)

void updateForce(const std::shared_ptr<ImpulseDataMultiple> &data, const VectorXs &impulse)

Update the spatial impulse defined in frame coordinate.

Parameters:
  • data[in] Multi-impulse data

  • impulse[in] Spatial impulse defined in frame coordinate \({}^o\underline{\boldsymbol{\Lambda}}_c\in\mathbb{R}^{nc}\)

void updateVelocityDiff(const std::shared_ptr<ImpulseDataMultiple> &data, const MatrixXs &dvnext_dx) const

Update the Jacobian of the system velocity after impulse.

Parameters:
  • data[in] Multi-impulse data

  • dvnext_dx[in] Jacobian of the system velocity after impact in generalized coordinates \(\frac{\partial\dot{\mathbf{v}'}}{\partial\mathbf{x}}\in\mathbb{R}^{nv\times{ndx}}\)

void updateForceDiff(const std::shared_ptr<ImpulseDataMultiple> &data, const MatrixXs &df_dx) const

Update the Jacobian of the spatial impulse 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}}\)

void updateRneaDiff(const std::shared_ptr<ImpulseDataMultiple> &data, pinocchio::DataTpl<Scalar> &pinocchio) const

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

as explained in this document : https://www.overleaf.com/read/tzvrrxxtntwk

Parameters:
  • data[in] Multi-contact data

  • pinocchio[in] Pinocchio data

std::shared_ptr<ImpulseDataMultiple> createData(pinocchio::DataTpl<Scalar> *const data)

Create the multi-impulse data.

Parameters:

data[in] Pinocchio data

Returns:

the multi-impulse data.

template<typename NewScalar>
ImpulseModelMultipleTpl<NewScalar> cast() const

Cast the multi-impulse 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:

ImpulseModelMultipleTpl<NewScalar> A multi-impulse model with the new scalar type.

const std::shared_ptr<StateMultibody> &get_state() const

Return the multibody state.

const ImpulseModelContainer &get_impulses() const

Return the impulse models.

std::size_t get_nc() const

Return the dimension of active impulses.

std::size_t get_nc_total() const

Return the dimension of all impulses.

const std::set<std::string> &get_active_set() const

Return the names of the set of active impulses.

const std::set<std::string> &get_inactive_set() const

Return the names of the set of inactive impulses.

bool getImpulseStatus(const std::string &name) const

Return the status of a given impulse name.

Public Members

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Friends

template<class Scalar>
friend std::ostream &operator<<(std::ostream &os, const ImpulseModelMultipleTpl<Scalar> &model)

Print information on the impulse models.