iCub-main
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
iCub::skinDynLib::dynContact Class Reference

Class representing an external contact acting on a link of the robot body. More...

#include <dynContact.h>

+ Inheritance diagram for iCub::skinDynLib::dynContact:

Public Member Functions

 dynContact ()
 Default constructor.
 
 dynContact (const BodyPart &_bodyPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP)
 Constructor with unknown moment and force direction.
 
 dynContact (const BodyPart &_bodyPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP, const yarp::sig::Vector &_Mu)
 Constructor with known moment (usually zero) and unknown force direction.
 
 dynContact (const BodyPart &_bodyPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP, const yarp::sig::Vector &_Mu, const yarp::sig::Vector &_Fdir)
 Constructor with known moment (usually zero) and known force direction.
 
virtual yarp::sig::Vector getForceMoment () const
 Get the contact force and moment in a single (6x1) vector.
 
virtual const yarp::sig::Vector & getForce () const
 Get the contact force.
 
virtual const yarp::sig::Vector & getForceDirection () const
 Get the contact force direction.
 
virtual double getForceModule () const
 Get the contact force module.
 
virtual const yarp::sig::Vector & getMoment () const
 Get the contact moment.
 
virtual const yarp::sig::Vector & getCoP () const
 Get the contact center of pressure expressed in the link reference frame.
 
virtual unsigned int getLinkNumber () const
 Get the link number (where 0 is the first link of the chain).
 
virtual BodyPart getBodyPart () const
 Get the body part of the contact.
 
virtual std::string getBodyPartName () const
 Get the name of the contact body part.
 
virtual unsigned long getId () const
 Get the id of this contact.
 
virtual bool isMomentKnown () const
 Get true if the moment applied at this contact is known a-priori.
 
virtual bool isForceDirectionKnown () const
 Get true if the direction of the force applied at this contact is known a-priori.
 
virtual bool setForce (const yarp::sig::Vector &_F)
 Set the contact force.
 
virtual bool setForceModule (double _Fmodule)
 Set the contact force module.
 
virtual bool setForceDirection (const yarp::sig::Vector &_Fdir)
 Set the direction of the contact force.
 
virtual bool setMoment (const yarp::sig::Vector &_Mu)
 Set the contact moment.
 
virtual bool setForceMoment (const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
 Set the contact force and moment.
 
virtual bool setForceMoment (const yarp::sig::Vector &_FMu)
 Set the contact force and moment as a single (6x1) vector.
 
virtual bool setCoP (const yarp::sig::Vector &_CoP)
 Set the contact center of pressure in link reference frame.
 
virtual void setLinkNumber (unsigned int _linkNum)
 Set the contact link number (0 is the first link)
 
virtual void setBodyPart (BodyPart _bodyPart)
 Set the body part of this contact.
 
virtual bool fixForceDirection (const yarp::sig::Vector &_Fdir)
 Fix the direction of the contact force.
 
virtual bool fixMoment ()
 Equivalent to calling fixMoment(zeros(3)).
 
virtual bool fixMoment (const yarp::sig::Vector &_Mu)
 Fix the contact moment.
 
virtual void unfixForceDirection ()
 Set the flag fDirKnown to false so that when estimating the contact wrenches the solver estimates also the force direction and does not consider it as known a-priori.
 
virtual void unfixMoment ()
 Set the flag muKnown to false so that when estimating the contact wrenches the solver estimates also the contact moment and does not consider it as known a-priori.
 
virtual bool read (yarp::os::ConnectionReader &connection) override
 
virtual bool write (yarp::os::ConnectionWriter &connection) const override
 Write dynContact to a connection as a list of 4 elements, that are:
 
virtual std::string toString (int precision=-1) const
 Convert this contact into a string.
 
virtual void setVerbose (unsigned int verb=VERBOSE)
 Set the verbosity level of comments during operations.
 

Protected Member Functions

void init (const BodyPart &_bodyPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP, const yarp::sig::Vector &_Mu=yarp::sig::Vector(0), const yarp::sig::Vector &_Fdir=yarp::sig::Vector(0))
 
bool checkVectorDim (const yarp::sig::Vector &v, unsigned int dim, const std::string &descr="")
 

Protected Attributes

unsigned long contactId
 
BodyPart bodyPart
 part of the body of the robot where the contact is applied
 
unsigned int linkNumber
 number of the link where the contact is applied
 
yarp::sig::Vector CoP
 center of pressure of the contact expressed w.r.t. the reference frame of the link
 
yarp::sig::Vector Fdir
 contact force direction (unit vector)
 
yarp::sig::Vector F
 contact force
 
double Fmodule
 contact force module
 
yarp::sig::Vector Mu
 contact moment
 
bool muKnown
 True if the moment applied at the contact point is known.
 
bool fDirKnown
 True if the direction of the force applied at the contact point is known.
 
unsigned int verbose
 verbosity flag
 

Static Protected Attributes

static unsigned long ID = 1
 

Detailed Description

Class representing an external contact acting on a link of the robot body.

A contact is identified by a unique id, a robot body part, a link number, the center of pressure (CoP), the contact force and moment. All the vectors (i.e. CoP, force, moment) are expressed w.r.t. the reference frame of the link.

This class is used in the process of estimating the contact wrenches. In the estimation process the link number and the contact position are supposed to be known. The force direction and the moment may be either known or unknown, depending on the sensor data.

Definition at line 51 of file dynContact.h.

Constructor & Destructor Documentation

◆ dynContact() [1/4]

dynContact::dynContact ( )

Default constructor.

Definition at line 33 of file dynContact.cpp.

◆ dynContact() [2/4]

iCub::skinDynLib::dynContact::dynContact ( const BodyPart _bodyPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP 
)

Constructor with unknown moment and force direction.

Parameters
_bodyPartthe body part associated to this contact
_linkNumberthe number of the link on which this contact is applied
_CoPthe 3-dim center of pressure of this contact in link reference frame

◆ dynContact() [3/4]

iCub::skinDynLib::dynContact::dynContact ( const BodyPart _bodyPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP,
const yarp::sig::Vector &  _Mu 
)

Constructor with known moment (usually zero) and unknown force direction.

Parameters
_bodyPartthe body part associated to this contact
_linkNumberthe number of the link on which this contact is applied
_CoPthe 3-dim center of pressure of this contact in link reference frame
_Muthe moment applied at this contact, expressed in link reference frame

◆ dynContact() [4/4]

iCub::skinDynLib::dynContact::dynContact ( const BodyPart _bodyPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP,
const yarp::sig::Vector &  _Mu,
const yarp::sig::Vector &  _Fdir 
)

Constructor with known moment (usually zero) and known force direction.

Parameters
_bodyPartthe body part associated to this contact
_linkNumberthe number of the link on which this contact is applied
_CoPthe 3-dim center of pressure of this contact in link reference frame
_Muthe moment applied at this contact, expressed in link reference frame
_Fdirthe direction of the contact force, expressed in link reference frame

Member Function Documentation

◆ checkVectorDim()

bool dynContact::checkVectorDim ( const yarp::sig::Vector &  v,
unsigned int  dim,
const std::string &  descr = "" 
)
protected

Definition at line 274 of file dynContact.cpp.

◆ fixForceDirection()

bool dynContact::fixForceDirection ( const yarp::sig::Vector &  _Fdir)
virtual

Fix the direction of the contact force.

Differently from the method setForceDirection, this method also sets the flag 'fDirKnown' to true, so when estimating the contact wrenches the solver considers the force direction of this contact as known a-priori.

Parameters
_Fdirthe contact force direction
Returns
true iff operation succeeded, false otherwise

Definition at line 167 of file dynContact.cpp.

◆ fixMoment() [1/2]

bool dynContact::fixMoment ( )
virtual

Equivalent to calling fixMoment(zeros(3)).

Definition at line 175 of file dynContact.cpp.

◆ fixMoment() [2/2]

virtual bool iCub::skinDynLib::dynContact::fixMoment ( const yarp::sig::Vector &  _Mu)
virtual

Fix the contact moment.

Differently from the method setMoment, this method also sets the flag 'muKnown' to true, so when estimating the contact wrenches the solver considers the moment of this contact as known a-priori.

Parameters
_Muthe contact moment
Returns
true iff operation succeeded, false otherwise

◆ getBodyPart()

BodyPart dynContact::getBodyPart ( ) const
virtual

Get the body part of the contact.

Returns
the contact body part

Definition at line 86 of file dynContact.cpp.

◆ getBodyPartName()

string dynContact::getBodyPartName ( ) const
virtual

Get the name of the contact body part.

Returns
the name of the contact body part

Definition at line 88 of file dynContact.cpp.

◆ getCoP()

const Vector & dynContact::getCoP ( ) const
virtual

Get the contact center of pressure expressed in the link reference frame.

Returns
a 3-dim vector

Definition at line 82 of file dynContact.cpp.

◆ getForce()

const Vector & dynContact::getForce ( ) const
virtual

Get the contact force.

Returns
a 3-dim vector

Definition at line 74 of file dynContact.cpp.

◆ getForceDirection()

const Vector & dynContact::getForceDirection ( ) const
virtual

Get the contact force direction.

Returns
a 3-dim vector with norm equal to one

Definition at line 76 of file dynContact.cpp.

◆ getForceModule()

double dynContact::getForceModule ( ) const
virtual

Get the contact force module.

Returns
the intensity of the contact force

Definition at line 78 of file dynContact.cpp.

◆ getForceMoment()

Vector dynContact::getForceMoment ( ) const
virtual

Get the contact force and moment in a single (6x1) vector.

Returns
a 6x1 vector where 0:2=force 3:5=moment

Definition at line 72 of file dynContact.cpp.

◆ getId()

unsigned long dynContact::getId ( ) const
virtual

Get the id of this contact.

Returns
the contact id

Definition at line 90 of file dynContact.cpp.

◆ getLinkNumber()

unsigned int dynContact::getLinkNumber ( ) const
virtual

Get the link number (where 0 is the first link of the chain).

Returns
the link number

Definition at line 84 of file dynContact.cpp.

◆ getMoment()

const Vector & dynContact::getMoment ( ) const
virtual

Get the contact moment.

Returns
a 3-dim vector

Definition at line 80 of file dynContact.cpp.

◆ init()

void dynContact::init ( const BodyPart _bodyPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP,
const yarp::sig::Vector &  _Mu = yarp::sig::Vector(0),
const yarp::sig::Vector &  _Fdir = yarp::sig::Vector(0) 
)
protected

Definition at line 49 of file dynContact.cpp.

◆ isForceDirectionKnown()

bool dynContact::isForceDirectionKnown ( ) const
virtual

Get true if the direction of the force applied at this contact is known a-priori.

Returns
true if the force direction is known, false otherwise.

Definition at line 97 of file dynContact.cpp.

◆ isMomentKnown()

bool dynContact::isMomentKnown ( ) const
virtual

Get true if the moment applied at this contact is known a-priori.

Returns
true if the moment is known, false otherwise.

Definition at line 95 of file dynContact.cpp.

◆ read()

bool dynContact::read ( yarp::os::ConnectionReader &  connection)
overridevirtual

Reimplemented in iCub::skinDynLib::skinContact.

Definition at line 229 of file dynContact.cpp.

◆ setBodyPart()

void dynContact::setBodyPart ( BodyPart  _bodyPart)
virtual

Set the body part of this contact.

Parameters
_bodyPartthe contact body part
Returns
true if the operation succeeded, false otherwise

Definition at line 161 of file dynContact.cpp.

◆ setCoP()

bool dynContact::setCoP ( const yarp::sig::Vector &  _CoP)
virtual

Set the contact center of pressure in link reference frame.

Parameters
_CoPa 3x1 vector
Returns
true if the operation succeeded, false otherwise

Definition at line 150 of file dynContact.cpp.

◆ setForce()

bool dynContact::setForce ( const yarp::sig::Vector &  _F)
virtual

Set the contact force.

Parameters
_Fa 3-dim vector containing the contact force
Returns
true if the operation succeeded, false otherwise

Definition at line 101 of file dynContact.cpp.

◆ setForceDirection()

bool dynContact::setForceDirection ( const yarp::sig::Vector &  _Fdir)
virtual

Set the direction of the contact force.

Parameters
_Fdira 3-dim vector containing the direction of the contact force
Returns
true if the operation succeeded, false otherwise
Note
If norm(_Fdir) is not 1 then _Fdir is normalized so that its norm is 1

Definition at line 122 of file dynContact.cpp.

◆ setForceModule()

bool dynContact::setForceModule ( double  _Fmodule)
virtual

Set the contact force module.

Parameters
_Fmodulethe module of the contact force
Returns
true if the operation succeeded, false otherwise

Definition at line 111 of file dynContact.cpp.

◆ setForceMoment() [1/2]

bool dynContact::setForceMoment ( const yarp::sig::Vector &  _F,
const yarp::sig::Vector &  _Mu 
)
virtual

Set the contact force and moment.

Parameters
_Fa 3-dim vector containing the contact force
_Mua 3-dim vector containing the contact moment
Returns
true if the operation succeeded, false otherwise

Definition at line 139 of file dynContact.cpp.

◆ setForceMoment() [2/2]

bool dynContact::setForceMoment ( const yarp::sig::Vector &  _FMu)
virtual

Set the contact force and moment as a single (6x1) vector.

Parameters
_FMua 6x1 vector where 0:2=force 3:5=moment
Returns
true if the operation succeeded, false otherwise

Definition at line 143 of file dynContact.cpp.

◆ setLinkNumber()

void dynContact::setLinkNumber ( unsigned int  _linkNum)
virtual

Set the contact link number (0 is the first link)

Parameters
_linkNumthe link number
Returns
true if the operation succeeded, false otherwise

Definition at line 157 of file dynContact.cpp.

◆ setMoment()

bool dynContact::setMoment ( const yarp::sig::Vector &  _Mu)
virtual

Set the contact moment.

Parameters
_Mua 3-dim vector containing the contact moment
Returns
true if the operation succeeded, false otherwise

Definition at line 132 of file dynContact.cpp.

◆ setVerbose()

void dynContact::setVerbose ( unsigned int  verb = VERBOSE)
virtual

Set the verbosity level of comments during operations.

Parameters
verblevel of verbosity

Definition at line 270 of file dynContact.cpp.

◆ toString()

string dynContact::toString ( int  precision = -1) const
virtual

Convert this contact into a string.

Useful to print some information.

Parameters
precisionnumber of decimal digits to use in the string representation
Returns
a string representation of this contact in this format: "Contact id: "<< contactId<< "Body part: "<< bodyPartName<< ", link: "<< linkNumber<< ", CoP: "<< CoP<< ", F: "<< F<< ", M: "<< Mu

Reimplemented in iCub::skinDynLib::skinContact.

Definition at line 263 of file dynContact.cpp.

◆ unfixForceDirection()

void dynContact::unfixForceDirection ( )
virtual

Set the flag fDirKnown to false so that when estimating the contact wrenches the solver estimates also the force direction and does not consider it as known a-priori.

Definition at line 187 of file dynContact.cpp.

◆ unfixMoment()

void dynContact::unfixMoment ( )
virtual

Set the flag muKnown to false so that when estimating the contact wrenches the solver estimates also the contact moment and does not consider it as known a-priori.

Definition at line 189 of file dynContact.cpp.

◆ write()

bool dynContact::write ( yarp::os::ConnectionWriter &  connection) const
overridevirtual

Write dynContact to a connection as a list of 4 elements, that are:

  • a list of 3 int, containing contactId, bodyPart, linkNumber
  • a list of 3 double, containing the CoP
  • a list of 3 double, containing the force
  • a list of 3 double, containing the moment
    Parameters
    connectionthe connection to write to
    Returns
    true iff the dynContact was written correctly

Reimplemented in iCub::skinDynLib::skinContact.

Definition at line 194 of file dynContact.cpp.

Member Data Documentation

◆ bodyPart

BodyPart iCub::skinDynLib::dynContact::bodyPart
protected

part of the body of the robot where the contact is applied

Definition at line 60 of file dynContact.h.

◆ contactId

unsigned long iCub::skinDynLib::dynContact::contactId
protected

Definition at line 57 of file dynContact.h.

◆ CoP

yarp::sig::Vector iCub::skinDynLib::dynContact::CoP
protected

center of pressure of the contact expressed w.r.t. the reference frame of the link

Definition at line 64 of file dynContact.h.

◆ F

yarp::sig::Vector iCub::skinDynLib::dynContact::F
protected

contact force

Definition at line 68 of file dynContact.h.

◆ Fdir

yarp::sig::Vector iCub::skinDynLib::dynContact::Fdir
protected

contact force direction (unit vector)

Definition at line 66 of file dynContact.h.

◆ fDirKnown

bool iCub::skinDynLib::dynContact::fDirKnown
protected

True if the direction of the force applied at the contact point is known.

Definition at line 77 of file dynContact.h.

◆ Fmodule

double iCub::skinDynLib::dynContact::Fmodule
protected

contact force module

Definition at line 70 of file dynContact.h.

◆ ID

unsigned long dynContact::ID = 1
staticprotected

Definition at line 55 of file dynContact.h.

◆ linkNumber

unsigned int iCub::skinDynLib::dynContact::linkNumber
protected

number of the link where the contact is applied

Definition at line 62 of file dynContact.h.

◆ Mu

yarp::sig::Vector iCub::skinDynLib::dynContact::Mu
protected

contact moment

Definition at line 72 of file dynContact.h.

◆ muKnown

bool iCub::skinDynLib::dynContact::muKnown
protected

True if the moment applied at the contact point is known.

Definition at line 75 of file dynContact.h.

◆ verbose

unsigned int iCub::skinDynLib::dynContact::verbose
protected

verbosity flag

Definition at line 80 of file dynContact.h.


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