iCub-main
Public Member Functions | Protected Attributes | List of all members
iCub::skinDynLib::skinContact Class Reference

#include <skinContact.h>

+ Inheritance diagram for iCub::skinDynLib::skinContact:

Public Member Functions

 skinContact ()
 Empty contructor. More...
 
 skinContact (const dynContact &c)
 Create a skinContact starting from a dynContact. More...
 
 skinContact (const BodyPart &_bodyPart, const SkinPart &_skinPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP, const yarp::sig::Vector &_geoCenter, unsigned int _activeTaxels, double _pressure)
 Constructor. More...
 
 skinContact (const BodyPart &_bodyPart, const SkinPart &_skinPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP, const yarp::sig::Vector &_geoCenter, std::vector< unsigned int > _taxelList, double _pressure)
 Constructor with list of active taxels. More...
 
 skinContact (const BodyPart &_bodyPart, const SkinPart &_skinPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP, const yarp::sig::Vector &_geoCenter, unsigned int _activeTaxels, double _pressure, const yarp::sig::Vector &_normalDir)
 Constructor with contact surface normal. More...
 
 skinContact (const BodyPart &_bodyPart, const SkinPart &_skinPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP, const yarp::sig::Vector &_geoCenter, std::vector< unsigned int > _taxelList, double _pressure, const yarp::sig::Vector &_normalDir)
 Constructor with contact surface normal and list of active taxels. More...
 
 skinContact (const BodyPart &_bodyPart, const SkinPart &_skinPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP, const yarp::sig::Vector &_geoCenter, std::vector< unsigned int > _taxelList, double _pressure, const yarp::sig::Vector &_normalDir, const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
 Constructor with contact surface normal, list of active taxels, direction of contact force, and moment applied at this contact. More...
 
const yarp::sig::Vector & getGeoCenter () const
 Get the contact geometric center, expressed in the link reference frame. More...
 
const yarp::sig::Vector & getNormalDir () const
 Get the direction normal to the contact area, expressed in the link reference frame. More...
 
double getPressure () const
 Get the average pressure measured at this contact. More...
 
unsigned int getActiveTaxels () const
 Get the number of active taxels. More...
 
SkinPart getSkinPart () const
 Get the skin part on which this contact is applied. More...
 
std::string getSkinPartName () const
 Get the name of the skin part on which this contact is applied. More...
 
std::vector< unsigned int > getTaxelList () const
 Get the list of id's of the taxels activated by this contact. More...
 
bool setGeoCenter (const yarp::sig::Vector &_geoCenter)
 Set the geometric center of the contact area (link reference frame). More...
 
bool setNormalDir (const yarp::sig::Vector &_normalDir)
 Set the normal direction of the contact area, expressed in link reference frame. More...
 
bool setPressure (double _pressure)
 Set the average contact pressure. More...
 
void setActiveTaxels (unsigned int _activeTaxels)
 Set the number of active taxels. More...
 
void setSkinPart (SkinPart _skinPart)
 Set the skin part on which this contact is applied. More...
 
void setTaxelList (const std::vector< unsigned int > &list)
 Set the list of taxels that are activated by this contact. More...
 
virtual bool read (yarp::os::ConnectionReader &connection) override
 
virtual bool write (yarp::os::ConnectionWriter &connection) const override
 Write this skinContact to a connection. More...
 
virtual yarp::sig::Vector toVector () const
 Convert this skinContact to a vector. More...
 
virtual bool fromVector (const yarp::sig::Vector &v)
 Convert the specified vector into a skinContact. More...
 
virtual std::string toString (int precision=-1) const override
 Convert this skinContact into a string. More...
 
- Public Member Functions inherited from iCub::skinDynLib::dynContact
 dynContact ()
 Default constructor. More...
 
 dynContact (const BodyPart &_bodyPart, unsigned int _linkNumber, const yarp::sig::Vector &_CoP)
 Constructor with unknown moment and force direction. More...
 
 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. More...
 
 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. More...
 
virtual yarp::sig::Vector getForceMoment () const
 Get the contact force and moment in a single (6x1) vector. More...
 
virtual const yarp::sig::Vector & getForce () const
 Get the contact force. More...
 
virtual const yarp::sig::Vector & getForceDirection () const
 Get the contact force direction. More...
 
virtual double getForceModule () const
 Get the contact force module. More...
 
virtual const yarp::sig::Vector & getMoment () const
 Get the contact moment. More...
 
virtual const yarp::sig::Vector & getCoP () const
 Get the contact center of pressure expressed in the link reference frame. More...
 
virtual unsigned int getLinkNumber () const
 Get the link number (where 0 is the first link of the chain). More...
 
virtual BodyPart getBodyPart () const
 Get the body part of the contact. More...
 
virtual std::string getBodyPartName () const
 Get the name of the contact body part. More...
 
virtual unsigned long getId () const
 Get the id of this contact. More...
 
virtual bool isMomentKnown () const
 Get true if the moment applied at this contact is known a-priori. More...
 
virtual bool isForceDirectionKnown () const
 Get true if the direction of the force applied at this contact is known a-priori. More...
 
virtual bool setForce (const yarp::sig::Vector &_F)
 Set the contact force. More...
 
virtual bool setForceModule (double _Fmodule)
 Set the contact force module. More...
 
virtual bool setForceDirection (const yarp::sig::Vector &_Fdir)
 Set the direction of the contact force. More...
 
virtual bool setMoment (const yarp::sig::Vector &_Mu)
 Set the contact moment. More...
 
virtual bool setForceMoment (const yarp::sig::Vector &_F, const yarp::sig::Vector &_Mu)
 Set the contact force and moment. More...
 
virtual bool setForceMoment (const yarp::sig::Vector &_FMu)
 Set the contact force and moment as a single (6x1) vector. More...
 
virtual bool setCoP (const yarp::sig::Vector &_CoP)
 Set the contact center of pressure in link reference frame. More...
 
virtual void setLinkNumber (unsigned int _linkNum)
 Set the contact link number (0 is the first link) More...
 
virtual void setBodyPart (BodyPart _bodyPart)
 Set the body part of this contact. More...
 
virtual bool fixForceDirection (const yarp::sig::Vector &_Fdir)
 Fix the direction of the contact force. More...
 
virtual bool fixMoment ()
 Equivalent to calling fixMoment(zeros(3)). More...
 
virtual bool fixMoment (const yarp::sig::Vector &_Mu)
 Fix the contact moment. More...
 
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. More...
 
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. More...
 
virtual void setVerbose (unsigned int verb=VERBOSE)
 Set the verbosity level of comments during operations. More...
 

Protected Attributes

SkinPart skinPart
 
double pressure
 
yarp::sig::Vector geoCenter
 
yarp::sig::Vector normalDir
 
unsigned int activeTaxels
 
std::vector< unsigned int > taxelList
 
- Protected Attributes inherited from iCub::skinDynLib::dynContact
unsigned long contactId
 
BodyPart bodyPart
 part of the body of the robot where the contact is applied More...
 
unsigned int linkNumber
 number of the link where the contact is applied More...
 
yarp::sig::Vector CoP
 center of pressure of the contact expressed w.r.t. the reference frame of the link More...
 
yarp::sig::Vector Fdir
 contact force direction (unit vector) More...
 
yarp::sig::Vector F
 contact force More...
 
double Fmodule
 contact force module More...
 
yarp::sig::Vector Mu
 contact moment More...
 
bool muKnown
 True if the moment applied at the contact point is known. More...
 
bool fDirKnown
 True if the direction of the force applied at the contact point is known. More...
 
unsigned int verbose
 verbosity flag More...
 

Additional Inherited Members

- Protected Member Functions inherited from iCub::skinDynLib::dynContact
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="")
 
- Static Protected Attributes inherited from iCub::skinDynLib::dynContact
static unsigned long ID = 1
 

Detailed Description

Class representing an external contact acting on the iCub' skin.

Definition at line 49 of file skinContact.h.

Constructor & Destructor Documentation

◆ skinContact() [1/7]

skinContact::skinContact ( )

Empty contructor.

Definition at line 57 of file skinContact.cpp.

◆ skinContact() [2/7]

skinContact::skinContact ( const dynContact c)

Create a skinContact starting from a dynContact.

Definition at line 25 of file skinContact.cpp.

◆ skinContact() [3/7]

skinContact::skinContact ( const BodyPart _bodyPart,
const SkinPart _skinPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP,
const yarp::sig::Vector &  _geoCenter,
unsigned int  _activeTaxels,
double  _pressure 
)

Constructor.

Parameters
_bodyPartthe part of the body
_skinPartthe part of the skin
_linkNumberthe link number relative to the specified body part
_CoPthe center of pressure (link reference frame)
_geoCenterthe geometric center of the contact area (link reference frame)
_activeTaxelsnumber of taxels activated
_pressureaverage pressure applied on the contact area

Definition at line 28 of file skinContact.cpp.

◆ skinContact() [4/7]

skinContact::skinContact ( const BodyPart _bodyPart,
const SkinPart _skinPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP,
const yarp::sig::Vector &  _geoCenter,
std::vector< unsigned int >  _taxelList,
double  _pressure 
)

Constructor with list of active taxels.

Parameters
_bodyPartthe part of the body
_skinPartthe part of the skin
_linkNumberthe link number relative to the specified body part
_CoPthe center of pressure (link reference frame)
_geoCenterthe geometric center of the contact area (link reference frame)
_taxelListlist of activated taxels
_pressureaverage pressure applied on the contact area

Definition at line 38 of file skinContact.cpp.

◆ skinContact() [5/7]

iCub::skinDynLib::skinContact::skinContact ( const BodyPart _bodyPart,
const SkinPart _skinPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP,
const yarp::sig::Vector &  _geoCenter,
unsigned int  _activeTaxels,
double  _pressure,
const yarp::sig::Vector &  _normalDir 
)

Constructor with contact surface normal.

Parameters
_bodyPartthe part of the body
_skinPartthe part of the skin
_linkNumberthe link number relative to the specified body part
_CoPthe center of pressure (link reference frame)
_geoCenterthe geometric center of the contact area (link reference frame)
_activeTaxelsnumber of taxels activated
_pressureaverage pressure applied on the contact area
_normalDircontact area normal direction (link reference frame)

◆ skinContact() [6/7]

iCub::skinDynLib::skinContact::skinContact ( const BodyPart _bodyPart,
const SkinPart _skinPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP,
const yarp::sig::Vector &  _geoCenter,
std::vector< unsigned int >  _taxelList,
double  _pressure,
const yarp::sig::Vector &  _normalDir 
)

Constructor with contact surface normal and list of active taxels.

Parameters
_bodyPartthe part of the body
_skinPartthe part of the skin
_linkNumberthe link number relative to the specified body part
_CoPthe center of pressure (link reference frame)
_geoCenterthe geometric center of the contact area (link reference frame)
_taxelListlist of activated taxels
_pressureaverage pressure applied on the contact area
_normalDircontact area normal direction (link reference frame)

◆ skinContact() [7/7]

skinContact::skinContact ( const BodyPart _bodyPart,
const SkinPart _skinPart,
unsigned int  _linkNumber,
const yarp::sig::Vector &  _CoP,
const yarp::sig::Vector &  _geoCenter,
std::vector< unsigned int >  _taxelList,
double  _pressure,
const yarp::sig::Vector &  _normalDir,
const yarp::sig::Vector &  _F,
const yarp::sig::Vector &  _Mu 
)

Constructor with contact surface normal, list of active taxels, direction of contact force, and moment applied at this contact.

Parameters
_bodyPartthe part of the body
_skinPartthe part of the skin
_linkNumberthe link number relative to the specified body part
_CoPthe center of pressure (link reference frame)
_geoCenterthe geometric center of the contact area (link reference frame)
_taxelListlist of activated taxels
_pressureaverage pressure applied on the contact area
_normalDircontact area normal direction (link reference frame)
_Fforce applied at contact, expressed in link reference frame
_Muthe moment applied at this contact, expressed in link reference frame

Definition at line 48 of file skinContact.cpp.

Member Function Documentation

◆ fromVector()

bool skinContact::fromVector ( const yarp::sig::Vector &  v)
virtual

Convert the specified vector into a skinContact.

The vector has to contain the following data, in this specific order: 0: contactId; 1: body part id; 2: link number; 3: skin part; 4-6: center of pressure; 7-9: force; 10-12: moment; 13-15: geometric center; 16-18: surface normal direction; 19: number of active taxels; 20-?: list of the id's of the activated taxels; ?: pressure;

Parameters
vthe vector to convert into a skinContact
Returns
true iff operation succeeded, false otherwise

Definition at line 240 of file skinContact.cpp.

◆ getActiveTaxels()

unsigned int iCub::skinDynLib::skinContact::getActiveTaxels ( ) const
inline

Get the number of active taxels.

Returns
the number of taxels activated by this contact

Definition at line 174 of file skinContact.h.

◆ getGeoCenter()

const yarp::sig::Vector& iCub::skinDynLib::skinContact::getGeoCenter ( ) const
inline

Get the contact geometric center, expressed in the link reference frame.

Returns
a 3-dim vector

Definition at line 159 of file skinContact.h.

◆ getNormalDir()

const yarp::sig::Vector& iCub::skinDynLib::skinContact::getNormalDir ( ) const
inline

Get the direction normal to the contact area, expressed in the link reference frame.

Returns
a 3-dim vector

Definition at line 164 of file skinContact.h.

◆ getPressure()

double iCub::skinDynLib::skinContact::getPressure ( ) const
inline

Get the average pressure measured at this contact.

Returns
the contact pressure

Definition at line 169 of file skinContact.h.

◆ getSkinPart()

SkinPart iCub::skinDynLib::skinContact::getSkinPart ( ) const
inline

Get the skin part on which this contact is applied.

Returns
the skin part

Definition at line 179 of file skinContact.h.

◆ getSkinPartName()

std::string iCub::skinDynLib::skinContact::getSkinPartName ( ) const
inline

Get the name of the skin part on which this contact is applied.

Returns
the skin part name

Definition at line 184 of file skinContact.h.

◆ getTaxelList()

std::vector<unsigned int> iCub::skinDynLib::skinContact::getTaxelList ( ) const
inline

Get the list of id's of the taxels activated by this contact.

Returns
the list of taxels' id's

Definition at line 189 of file skinContact.h.

◆ read()

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

Reimplemented from iCub::skinDynLib::dynContact.

Definition at line 155 of file skinContact.cpp.

◆ setActiveTaxels()

void skinContact::setActiveTaxels ( unsigned int  _activeTaxels)

Set the number of active taxels.

Parameters
_activeTaxelsthe number of taxels activated by this contact
Returns
true if the operation succeeded, false otherwise

Definition at line 83 of file skinContact.cpp.

◆ setGeoCenter()

bool skinContact::setGeoCenter ( const yarp::sig::Vector &  _geoCenter)

Set the geometric center of the contact area (link reference frame).

Parameters
_geoCentera 3-dim vector containing the geometric center of this contact area
Returns
true if the operation succeeded, false otherwise

Definition at line 62 of file skinContact.cpp.

◆ setNormalDir()

bool skinContact::setNormalDir ( const yarp::sig::Vector &  _normalDir)

Set the normal direction of the contact area, expressed in link reference frame.

Parameters
_normalDira 3-dim vector containing the normal to the contact area
Returns
true if the operation succeeded, false otherwise

Definition at line 69 of file skinContact.cpp.

◆ setPressure()

bool skinContact::setPressure ( double  _pressure)

Set the average contact pressure.

Parameters
_pressurethe mean contact pressure
Returns
true if the operation succeeded, false otherwise

Definition at line 76 of file skinContact.cpp.

◆ setSkinPart()

void skinContact::setSkinPart ( SkinPart  _skinPart)

Set the skin part on which this contact is applied.

Parameters
_skinPartthe skin part
Returns
true if the operation succeeded, false otherwise

Definition at line 88 of file skinContact.cpp.

◆ setTaxelList()

void skinContact::setTaxelList ( const std::vector< unsigned int > &  list)

Set the list of taxels that are activated by this contact.

Parameters
listlist of id's of the active taxels associated to this contact
Returns
true if the operation succeeded, false otherwise

Definition at line 92 of file skinContact.cpp.

◆ toString()

string skinContact::toString ( int  precision = -1) const
overridevirtual

Convert this skinContact 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

Reimplemented from iCub::skinDynLib::dynContact.

Definition at line 264 of file skinContact.cpp.

◆ toVector()

Vector skinContact::toVector ( ) const
virtual

Convert this skinContact to a vector.

The size of the vector is 21 plus the number of active taxels. The vector contains this data, in this order: 0: contactId; 1: body part id; 2: link number; 3: skin part; 4-6: center of pressure; 7-9: force; 10-12: moment; 13-15: geometric center; 16-18: surface normal direction; 19: number of active taxels; 20-?: list of the id's of the activated taxels; ?: pressure;

Returns
a Vector representation of this skinContact

Definition at line 220 of file skinContact.cpp.

◆ write()

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

Write this skinContact to a connection.

The skinContact is represented as a list of 8 elements that are:

  • a list of 4 int, i.e. contactId, bodyPart, linkNumber, skinPart
  • a list of 3 double, i.e. the CoP
  • a list of 3 double, i.e. the force
  • a list of 3 double, i.e. the moment
  • a list of 3 double, i.e. the geometric center
  • a list of 3 double, i.e. the normal direction
  • a list of N int, i.e. the active taxel ids
  • a double, i.e. the pressure
    Parameters
    connectionconnection to write to
    Returns
    true iff a skinContact was written correctly

Reimplemented from iCub::skinDynLib::dynContact.

Definition at line 99 of file skinContact.cpp.

Member Data Documentation

◆ activeTaxels

unsigned int iCub::skinDynLib::skinContact::activeTaxels
protected

Definition at line 62 of file skinContact.h.

◆ geoCenter

yarp::sig::Vector iCub::skinDynLib::skinContact::geoCenter
protected

Definition at line 58 of file skinContact.h.

◆ normalDir

yarp::sig::Vector iCub::skinDynLib::skinContact::normalDir
protected

Definition at line 60 of file skinContact.h.

◆ pressure

double iCub::skinDynLib::skinContact::pressure
protected

Definition at line 56 of file skinContact.h.

◆ skinPart

SkinPart iCub::skinDynLib::skinContact::skinPart
protected

Definition at line 53 of file skinContact.h.

◆ taxelList

std::vector<unsigned int> iCub::skinDynLib::skinContact::taxelList
protected

Definition at line 64 of file skinContact.h.


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