robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
robotoc::ImpactStatus Class Reference

Impact status of robot model. Wrapper of ContactStatus to treat impacts. More...

#include <impact_status.hpp>

Public Member Functions

 ImpactStatus (const std::vector< ContactType > &contact_types, const std::vector< std::string > &contact_frame_names, const double default_friction_coefficient=0.7)
 Constructor. More...
 
 ImpactStatus ()
 Default constructor. More...
 
 ~ImpactStatus ()=default
 Default destructor. More...
 
 ImpactStatus (const ImpactStatus &)=default
 Default copy constructor. More...
 
ImpactStatusoperator= (const ImpactStatus &)=default
 Default copy assign operator. More...
 
 ImpactStatus (ImpactStatus &&) noexcept=default
 Default move constructor. More...
 
ImpactStatusoperator= (ImpactStatus &&) noexcept=default
 Default move assign operator. More...
 
bool operator== (const ImpactStatus &other) const
 Defines a comparison operator. More...
 
bool operator!= (const ImpactStatus &other) const
 Defines a comparison operator. More...
 
ContactType contactType (const int contact_index) const
 Returns the type of the contact. More...
 
const std::vector< ContactType > & contactTypes () const
 Returns the types of the contacts. More...
 
bool isImpactActive (const int contact_index) const
 Returns true if a contact is active and false if not. More...
 
const std::vector< bool > & isImpactActive () const
 Returns the activity of the impacts. More...
 
bool hasActiveImpact () const
 Returns true if there are active impacts and false if not. More...
 
int dimf () const
 Returns the dimension of the active impact forces. More...
 
int maxNumContacts () const
 Returns the maximum number of the contacts. More...
 
void activateImpact (const int contact_index)
 Activates a impact. More...
 
void deactivateImpact (const int contact_index)
 Deactivates a impact. More...
 
void activateImpacts (const std::vector< int > &impact_indices)
 Activates impacts. More...
 
void deactivateImpacts (const std::vector< int > &impact_indices)
 Deactivates impacts. More...
 
void setContactPlacement (const int contact_index, const Eigen::Vector3d &contact_position)
 Sets a contact placement, that is, the position and rotation of the contact. The contact rotation is set to Eigen::Matrix3d::Identity(), which represents the vertical direction to the ground. For the point contacts, the rotation is only used in the friction cone constraints. For the surface contacts, the rotation represents the rotational contact constraints on the contact frame of the robot. More...
 
void setContactPlacement (const int contact_index, const Eigen::Vector3d &contact_position, const Eigen::Matrix3d &contact_rotation)
 Sets a contact placement, that is, the position and rotation of the contact. For the point contacts, the rotation is only used in the friction cone constraints. For the surface contacts, the rotation represents the rotational contact constraints on the contact frame of the robot. More...
 
void setContactPlacement (const int contact_index, const SE3 &contact_placement)
 Sets a contact placement, that is, the position and rotation of the contact. For the point contacts, the rotation is only used in the friction cone constraints. For the surface contacts, the rotation represents the rotational contact constraints on the contact frame of the robot. More...
 
void setContactPlacements (const std::vector< Eigen::Vector3d > &contact_positions)
 Sets contact placements. The rotation of each contact is set to Eigen::Matrix3d::Identity(), which represents the vertical direction to the ground. More...
 
void setContactPlacements (const std::vector< Eigen::Vector3d > &contact_positions, const std::vector< Eigen::Matrix3d > &contact_rotations)
 Sets contact placements. More...
 
void setContactPlacements (const aligned_vector< SE3 > &contact_placements)
 Sets contact placements. More...
 
const SE3contactPlacement (const int contact_index) const
 Gets the contact placement. More...
 
const Eigen::Vector3d & contactPosition (const int contact_index) const
 Gets the contact position. More...
 
const Eigen::Matrix3d & contactRotation (const int contact_index) const
 Gets the contact rotation. More...
 
const aligned_vector< SE3 > & contactPlacements () const
 Gets the contact placements. More...
 
const std::vector< Eigen::Vector3d > & contactPositions () const
 Gets the contact positions. More...
 
const std::vector< Eigen::Matrix3d > & contactRotations () const
 Gets the contact rotations. More...
 
void setFrictionCoefficient (const int contact_index, const double friction_coefficient)
 Gets the friction coefficint. More...
 
void setFrictionCoefficient (const std::string &contact_frame_name, const double friction_coefficient)
 Gets the friction coefficint. More...
 
void setFrictionCoefficients (const std::vector< double > &friction_coefficients)
 Sets the friction coefficints. More...
 
void setFrictionCoefficients (const std::unordered_map< std::string, double > &friction_coefficients)
 Sets the friction coefficints. More...
 
double frictionCoefficient (const int contact_index) const
 Gets the friction coefficint. Default value is 0.7. More...
 
double frictionCoefficient (const std::string &contact_frame_name) const
 Gets the friction coefficint. Default value is 0.7. More...
 
const std::vector< double > & frictionCoefficients () const
 Gets the friction coefficints. Default value is 0.7. More...
 
void setRandom ()
 Fills impact status randomly. More...
 
void disp (std::ostream &os) const
 Displays the impact status onto a ostream. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const ImpactStatus &impact_status)
 

Detailed Description

Impact status of robot model. Wrapper of ContactStatus to treat impacts.

Constructor & Destructor Documentation

◆ ImpactStatus() [1/4]

robotoc::ImpactStatus::ImpactStatus ( const std::vector< ContactType > &  contact_types,
const std::vector< std::string > &  contact_frame_names,
const double  default_friction_coefficient = 0.7 
)
inline

Constructor.

Parameters
[in]contact_typesTypes of contacts.
[in]contact_frame_namesNames of contact frames.
[in]default_friction_coefficientDefault friction coefficitn. Must be positive. Default is 0.7.

◆ ImpactStatus() [2/4]

robotoc::ImpactStatus::ImpactStatus ( )
inline

Default constructor.

◆ ~ImpactStatus()

robotoc::ImpactStatus::~ImpactStatus ( )
default

Default destructor.

◆ ImpactStatus() [3/4]

robotoc::ImpactStatus::ImpactStatus ( const ImpactStatus )
default

Default copy constructor.

◆ ImpactStatus() [4/4]

robotoc::ImpactStatus::ImpactStatus ( ImpactStatus &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ activateImpact()

void robotoc::ImpactStatus::activateImpact ( const int  contact_index)
inline

Activates a impact.

Parameters
[in]contact_indexIndex of the contact that is activated.

◆ activateImpacts()

void robotoc::ImpactStatus::activateImpacts ( const std::vector< int > &  impact_indices)
inline

Activates impacts.

Parameters
[in]impact_indicesIndices of the impacts that are activated.

◆ contactPlacement()

const SE3 & robotoc::ImpactStatus::contactPlacement ( const int  contact_index) const
inline

Gets the contact placement.

Parameters
[in]contact_indexIndex of the contact .
Returns
const reference to the contact placement.

◆ contactPlacements()

const aligned_vector< SE3 > & robotoc::ImpactStatus::contactPlacements ( ) const
inline

Gets the contact placements.

Returns
const reference to the contact placements.

◆ contactPosition()

const Eigen::Vector3d & robotoc::ImpactStatus::contactPosition ( const int  contact_index) const
inline

Gets the contact position.

Parameters
[in]contact_indexIndex of the contact .
Returns
const reference to the contact position.

◆ contactPositions()

const std::vector< Eigen::Vector3d > & robotoc::ImpactStatus::contactPositions ( ) const
inline

Gets the contact positions.

Returns
const reference to the contact positions.

◆ contactRotation()

const Eigen::Matrix3d & robotoc::ImpactStatus::contactRotation ( const int  contact_index) const
inline

Gets the contact rotation.

Parameters
[in]contact_indexIndex of the contact .
Returns
const reference to the contact rotation.

◆ contactRotations()

const std::vector< Eigen::Matrix3d > & robotoc::ImpactStatus::contactRotations ( ) const
inline

Gets the contact rotations.

Returns
const reference to the contact rotations.

◆ contactType()

ContactType robotoc::ImpactStatus::contactType ( const int  contact_index) const
inline

Returns the type of the contact.

Parameters
[in]contact_indexIndex of a contact of interedted.
Returns
Contact type.

◆ contactTypes()

const std::vector< ContactType > & robotoc::ImpactStatus::contactTypes ( ) const
inline

Returns the types of the contacts.

Returns
Contact types.

◆ deactivateImpact()

void robotoc::ImpactStatus::deactivateImpact ( const int  contact_index)
inline

Deactivates a impact.

Parameters
[in]contact_indexIndex of the contact that is deactivated.

◆ deactivateImpacts()

void robotoc::ImpactStatus::deactivateImpacts ( const std::vector< int > &  impact_indices)
inline

Deactivates impacts.

Parameters
[in]impact_indicesIndices of the impacts that are deactivated.

◆ dimf()

int robotoc::ImpactStatus::dimf ( ) const
inline

Returns the dimension of the active impact forces.

Returns
Dimension of the active impact forces.

◆ disp()

void robotoc::ImpactStatus::disp ( std::ostream &  os) const

Displays the impact status onto a ostream.

◆ frictionCoefficient() [1/2]

double robotoc::ImpactStatus::frictionCoefficient ( const int  contact_index) const
inline

Gets the friction coefficint. Default value is 0.7.

Parameters
[in]contact_indexIndex of the contact.
Returns
Friction coefficient of the contact.

◆ frictionCoefficient() [2/2]

double robotoc::ImpactStatus::frictionCoefficient ( const std::string &  contact_frame_name) const
inline

Gets the friction coefficint. Default value is 0.7.

Parameters
[in]contact_frame_nameName of the contact frame.
Returns
Friction coefficient of the contact.

◆ frictionCoefficients()

const std::vector< double > & robotoc::ImpactStatus::frictionCoefficients ( ) const
inline

Gets the friction coefficints. Default value is 0.7.

Returns
Friction coefficients of the contacts.

◆ hasActiveImpact()

bool robotoc::ImpactStatus::hasActiveImpact ( ) const
inline

Returns true if there are active impacts and false if not.

Returns
true if there are active impacts and false if not.

◆ isImpactActive() [1/2]

const std::vector< bool > & robotoc::ImpactStatus::isImpactActive ( ) const
inline

Returns the activity of the impacts.

Returns
Const reference to the activity of the impacts.

◆ isImpactActive() [2/2]

bool robotoc::ImpactStatus::isImpactActive ( const int  contact_index) const
inline

Returns true if a contact is active and false if not.

Parameters
[in]contact_indexIndex of a contact of interedted.
Returns
true if a contact is active and false if not.

◆ maxNumContacts()

int robotoc::ImpactStatus::maxNumContacts ( ) const
inline

Returns the maximum number of the contacts.

Returns
The maximum number of the contacts.

◆ operator!=()

bool robotoc::ImpactStatus::operator!= ( const ImpactStatus other) const
inline

Defines a comparison operator.

◆ operator=() [1/2]

ImpactStatus & robotoc::ImpactStatus::operator= ( const ImpactStatus )
default

Default copy assign operator.

◆ operator=() [2/2]

ImpactStatus & robotoc::ImpactStatus::operator= ( ImpactStatus &&  )
defaultnoexcept

Default move assign operator.

◆ operator==()

bool robotoc::ImpactStatus::operator== ( const ImpactStatus other) const
inline

Defines a comparison operator.

◆ setContactPlacement() [1/3]

void robotoc::ImpactStatus::setContactPlacement ( const int  contact_index,
const Eigen::Vector3d &  contact_position 
)
inline

Sets a contact placement, that is, the position and rotation of the contact. The contact rotation is set to Eigen::Matrix3d::Identity(), which represents the vertical direction to the ground. For the point contacts, the rotation is only used in the friction cone constraints. For the surface contacts, the rotation represents the rotational contact constraints on the contact frame of the robot.

Parameters
[in]contact_indexIndex of the contact.
[in]contact_positionContact position.

◆ setContactPlacement() [2/3]

void robotoc::ImpactStatus::setContactPlacement ( const int  contact_index,
const Eigen::Vector3d &  contact_position,
const Eigen::Matrix3d &  contact_rotation 
)
inline

Sets a contact placement, that is, the position and rotation of the contact. For the point contacts, the rotation is only used in the friction cone constraints. For the surface contacts, the rotation represents the rotational contact constraints on the contact frame of the robot.

Parameters
[in]contact_indexIndex of the contact.
[in]contact_positionContact position.
[in]contact_rotationContact rotation.

◆ setContactPlacement() [3/3]

void robotoc::ImpactStatus::setContactPlacement ( const int  contact_index,
const SE3 contact_placement 
)
inline

Sets a contact placement, that is, the position and rotation of the contact. For the point contacts, the rotation is only used in the friction cone constraints. For the surface contacts, the rotation represents the rotational contact constraints on the contact frame of the robot.

Parameters
[in]contact_indexIndex of the contact.
[in]contact_placementContact placement.

◆ setContactPlacements() [1/3]

void robotoc::ImpactStatus::setContactPlacements ( const aligned_vector< SE3 > &  contact_placements)
inline

Sets contact placements.

Parameters
[in]contact_placementsContact placements. Size must be ImpactStatus::maxNumContacts().

◆ setContactPlacements() [2/3]

void robotoc::ImpactStatus::setContactPlacements ( const std::vector< Eigen::Vector3d > &  contact_positions)
inline

Sets contact placements. The rotation of each contact is set to Eigen::Matrix3d::Identity(), which represents the vertical direction to the ground.

Parameters
[in]contact_positionsContact positions. Size must be ImpactStatus::maxNumContacts().

◆ setContactPlacements() [3/3]

void robotoc::ImpactStatus::setContactPlacements ( const std::vector< Eigen::Vector3d > &  contact_positions,
const std::vector< Eigen::Matrix3d > &  contact_rotations 
)
inline

Sets contact placements.

Parameters
[in]contact_positionsContact positions. Size must be ImpactStatus::maxNumContacts().
[in]contact_rotationsContact rotations. Size must be ImpactStatus::maxNumContacts().

◆ setFrictionCoefficient() [1/2]

void robotoc::ImpactStatus::setFrictionCoefficient ( const int  contact_index,
const double  friction_coefficient 
)
inline

Gets the friction coefficint.

Parameters
[in]contact_indexIndex of the contact.
[in]friction_coefficientFriction coefficient. Must be positive.

◆ setFrictionCoefficient() [2/2]

void robotoc::ImpactStatus::setFrictionCoefficient ( const std::string &  contact_frame_name,
const double  friction_coefficient 
)
inline

Gets the friction coefficint.

Parameters
[in]contact_frame_nameName of the contact frame.
[in]friction_coefficientFriction coefficient. Must be positive.

◆ setFrictionCoefficients() [1/2]

void robotoc::ImpactStatus::setFrictionCoefficients ( const std::unordered_map< std::string, double > &  friction_coefficients)
inline

Sets the friction coefficints.

Parameters
[in]friction_coefficientsFriction coefficients. Size must be ContactStatus::maxNumContacts() and each element must be positive.

◆ setFrictionCoefficients() [2/2]

void robotoc::ImpactStatus::setFrictionCoefficients ( const std::vector< double > &  friction_coefficients)
inline

Sets the friction coefficints.

Parameters
[in]friction_coefficientsFriction coefficients. Size must be ContactStatus::maxNumContacts() and each element must be positive.

◆ setRandom()

void robotoc::ImpactStatus::setRandom ( )
inline

Fills impact status randomly.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const ImpactStatus impact_status 
)
friend

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