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

Define a stack of impulse models. More...

#include <multiple-impulses.hpp>

Public Types

typedef pinocchio::container::aligned_vector< pinocchio::ForceTpl< Scalar > >::iterator ForceIterator
typedef ImpulseDataAbstractTpl< Scalar > ImpulseDataAbstract
typedef std::map< std::string, std::shared_ptr< ImpulseDataAbstract > > ImpulseDataContainer
typedef ImpulseDataMultipleTpl< Scalar > ImpulseDataMultiple
typedef ImpulseItemTpl< Scalar > ImpulseItem
typedef ImpulseModelAbstractTpl< Scalar > ImpulseModelAbstract
typedef std::map< std::string, std::shared_ptr< ImpulseItem > > ImpulseModelContainer
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

 ImpulseModelMultipleTpl (std::shared_ptr< StateMultibody > state)
 Initialize the multi-impulse model.
void addImpulse (const std::string &name, std::shared_ptr< ImpulseModelAbstract > impulse, const bool active=true)
 Add impulse item.
void calc (const std::shared_ptr< ImpulseDataMultiple > &data, const Eigen::Ref< const VectorXs > &x)
 Compute the total impulse Jacobian and impulse velocity.
void calcDiff (const std::shared_ptr< ImpulseDataMultiple > &data, const Eigen::Ref< const VectorXs > &x)
 Compute the derivatives of the impulse holonomic constraint.
template<typename NewScalar>
ImpulseModelMultipleTpl< NewScalar > cast () const
 Cast the multi-impulse model to a different scalar type.
void changeImpulseStatus (const std::string &name, const bool active)
 Change the impulse status.
std::shared_ptr< ImpulseDataMultiplecreateData (pinocchio::DataTpl< Scalar > *const data)
 Create the multi-impulse data.
const std::set< std::string > & get_active_set () const
 Return the names of the set of active impulses.
const ImpulseModelContainer & get_impulses () const
 Return the impulse models.
const std::set< std::string > & get_inactive_set () const
 Return the names of the set of inactive impulses.
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::shared_ptr< StateMultibody > & get_state () const
 Return the multibody state.
bool getImpulseStatus (const std::string &name) const
 Return the status of a given impulse name.
void removeImpulse (const std::string &name)
 Remove impulse item.
void updateForce (const std::shared_ptr< ImpulseDataMultiple > &data, const VectorXs &impulse)
 Update the spatial impulse defined in frame coordinate.
void updateForceDiff (const std::shared_ptr< ImpulseDataMultiple > &data, const MatrixXs &df_dx) const
 Update the Jacobian of the spatial impulse defined in frame coordinate.
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)
void updateVelocity (const std::shared_ptr< ImpulseDataMultiple > &data, const VectorXs &vnext) const
 Update the system velocity after impulse.
void updateVelocityDiff (const std::shared_ptr< ImpulseDataMultiple > &data, const MatrixXs &dvnext_dx) const
 Update the Jacobian of the system velocity after impulse.

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Friends

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

Detailed Description

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

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.

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

Member Typedef Documentation

◆ MathBase

template<typename _Scalar>
typedef MathBaseTpl<Scalar> MathBase

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

◆ StateMultibody

template<typename _Scalar>
typedef StateMultibodyTpl<Scalar> StateMultibody

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

◆ ImpulseDataAbstract

template<typename _Scalar>
typedef ImpulseDataAbstractTpl<Scalar> ImpulseDataAbstract

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

◆ ImpulseDataMultiple

template<typename _Scalar>
typedef ImpulseDataMultipleTpl<Scalar> ImpulseDataMultiple

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

◆ ImpulseModelAbstract

template<typename _Scalar>
typedef ImpulseModelAbstractTpl<Scalar> ImpulseModelAbstract

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

◆ ImpulseItem

template<typename _Scalar>
typedef ImpulseItemTpl<Scalar> ImpulseItem

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

◆ Vector2s

template<typename _Scalar>
typedef MathBase::Vector2s Vector2s

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

◆ Vector3s

template<typename _Scalar>
typedef MathBase::Vector3s Vector3s

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

◆ VectorXs

template<typename _Scalar>
typedef MathBase::VectorXs VectorXs

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

◆ MatrixXs

template<typename _Scalar>
typedef MathBase::MatrixXs MatrixXs

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

◆ ImpulseModelContainer

template<typename _Scalar>
typedef std::map<std::string, std::shared_ptr<ImpulseItem> > ImpulseModelContainer

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

◆ ImpulseDataContainer

template<typename _Scalar>
typedef std::map<std::string, std::shared_ptr<ImpulseDataAbstract> > ImpulseDataContainer

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

◆ ForceIterator

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

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

Constructor & Destructor Documentation

◆ ImpulseModelMultipleTpl()

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

Initialize the multi-impulse model.

Parameters
[in]stateMultibody state

Member Function Documentation

◆ addImpulse()

template<typename _Scalar>
void addImpulse(const std::string &name,
std::shared_ptr< ImpulseModelAbstract >impulse,
const boolactive = true )

Add impulse item.

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

Parameters
[in]nameImpulse name
[in]impulseImpulse model
[in]activeImpulse status (active by default)

◆ removeImpulse()

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

Remove impulse item.

Parameters
[in]nameImpulse name

◆ changeImpulseStatus()

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

Change the impulse status.

Parameters
[in]nameImpulse name
[in]activeImpulse status (True for active)

◆ calc()

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

Compute the total impulse Jacobian and impulse velocity.

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

◆ calcDiff()

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

Compute the derivatives of the impulse holonomic constraint.

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

◆ updateVelocity()

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

Update the system velocity after impulse.

Parameters
[in]dataMulti-impulse data
[in]vnextSystem velocity after impulse $\mathbf{v}'\in\mathbb{R}^{nv}$

◆ updateForce()

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

Update the spatial impulse defined in frame coordinate.

Parameters
[in]dataMulti-impulse data
[in]impulseSpatial impulse defined in frame coordinate ${}^o\underline{\boldsymbol{\Lambda}}_c\in\mathbb{R}^{nc}$

◆ updateVelocityDiff()

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

Update the Jacobian of the system velocity after impulse.

Parameters
[in]dataMulti-impulse data
[in]dvnext_dxJacobian of the system velocity after impact 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< ImpulseDataMultiple > &data,
const MatrixXs &df_dx ) const

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

◆ updateRneaDiff()

template<typename _Scalar>
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
[in]dataMulti-contact data
[in]pinocchioPinocchio data

◆ createData()

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

Create the multi-impulse data.

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

◆ cast()

template<typename _Scalar>
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
NewScalarThe new scalar type to cast to.
Returns
ImpulseModelMultipleTpl<NewScalar> A multi-impulse model with the new scalar type.

Member Data Documentation

◆ Scalar

template<typename _Scalar>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

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


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