XBotInterface  2.4.1
XBotInterface provides a generic API to model and control a robot.
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
XBot::Joint Class Reference

Container for the Joint state and information. More...

#include <Joint.h>

+ Collaboration diagram for XBot::Joint:

Public Types

typedef std::shared_ptr< JointPtr
 
typedef std::shared_ptr< const JointConstPtr
 

Public Member Functions

 Joint ()
 Default constructor. More...
 
 Joint (const std::string &joint_name, int joint_id, urdf::JointConstSharedPtr urdf_joint, const std::string &chain_name)
 Construct using the joint name, joint id, urdf joint and chain name. More...
 
const std::string & getJointName () const
 Getter for the joint name. More...
 
int getJointId () const
 Getter for the joint id. More...
 
const std::string & getChainName () const
 Getter for the parent chain name. More...
 
void getJointLimits (double &qmin, double &qmax) const
 Getter for the joint position limits in the urdf. More...
 
void getVelocityLimit (double &qdot_max) const
 Getter for the joint velocity limit in the urdf. More...
 
void getEffortLimit (double &tau_max) const
 Getter for the joint effort limit in the urdf. More...
 
bool checkJointLimits (double q) const
 check that the param q is inside the position limits More...
 
bool checkVelocityLimit (double qdot) const
 check that the param qdot is below the joint velocity limit More...
 
bool checkEffortLimit (double tau) const
 check that the param tau is below the joint effort limit More...
 
void enforceJointLimits (double &q) const
 
void enforceVelocityLimit (double &qdot) const
 
void enforceEffortLimit (double &tau) const
 
urdf::JointConstSharedPtr getUrdfJoint () const
 Getter for the urdf Joint object. More...
 
void print () const
 Prints a pretty table about joint state. More...
 
void printTracking () const
 Prints a pretty table about joint tracking error. More...
 
bool isFixedControlledJoint () const
 return true if the joint is specified fixed in the model, but inside the controlled_joints group of the SRDF e.g. More...
 
void setJointPosition (double link_pos)
 Setter for the link side encoder reading. More...
 
void setMotorPosition (double motor_pos)
 setter for the motor side encoder reading More...
 
void setJointVelocity (double link_vel)
 setter for the link side velocity More...
 
void setMotorVelocity (double motor_vel)
 setter for the motor side velocity More...
 
void setJointAcceleration (double link_acc)
 setter for the link side acceleration More...
 
void setJointEffort (double effort)
 setter for the joint effort (generalized force) More...
 
void setTemperature (double temperature)
 setter for the joint temperature More...
 
double getJointPosition () const
 getter for the link side encoder reading More...
 
double getMotorPosition () const
 getter for the motor side encoder reading More...
 
double getJointVelocity () const
 getter for the link side velocity More...
 
double getMotorVelocity () const
 getter for the motor side velocity More...
 
double getJointAcceleration () const
 getter for the link side acceleration More...
 
double getJointEffort () const
 getter for the joint effort (generalized force) More...
 
double getTemperature () const
 getter for the joint temperature More...
 
void setPositionReference (double pos_ref)
 setter for the motor position reference More...
 
void setVelocityReference (double vel_ref)
 setter for the velocity reference More...
 
void setEffortReference (double effort_ref)
 setter for the effort (generalized force) reference More...
 
void setStiffness (double stiffness)
 set the joint stiffness More...
 
void setDamping (double damping)
 set the joint damping More...
 
double getPositionReference () const
 getter for the commanded motor position reference More...
 
double getVelocityReference () const
 getter for the commanded velocity reference More...
 
double getEffortReference () const
 getter for the commanded effort (generalized force) reference More...
 
double getStiffness () const
 get the commanded joint stiffness More...
 
double getDamping () const
 get the commanded joint damping More...
 
void setControlMode (const ControlMode &control_mode)
 
void getControlMode (ControlMode &control_mode) const
 

Protected Member Functions

void setJointName (const std::string &joint_name)
 Setter for the joint name. More...
 
void setJointId (int joint_id)
 Setter for the joint id. More...
 
template<typename... SyncFlags>
bool syncFrom (const Joint &other, SyncFlags... flags)
 Synchronize the current Joint with another Joint object. More...
 
template<typename... SyncFlags>
bool setReferenceFrom (const Joint &other, SyncFlags... flags)
 Set the joint references (TX) from other joint state (RX) More...
 
const XBot::Jointoperator<< (const XBot::Joint &from)
 operator << to synchronize the current Joint with another Joint object More...
 
bool isVirtualJoint () const
 return true if the joint is virtual More...
 

Friends

std::ostream & operator<< (std::ostream &os, const XBot::Joint &j)
 ostream operator << for a Joint object More...
 

Detailed Description

Container for the Joint state and information.

Member Typedef Documentation

◆ ConstPtr

typedef std::shared_ptr<const Joint> XBot::Joint::ConstPtr

◆ Ptr

typedef std::shared_ptr<Joint> XBot::Joint::Ptr

Constructor & Destructor Documentation

◆ Joint() [1/2]

XBot::Joint::Joint ( )

Default constructor.

◆ Joint() [2/2]

XBot::Joint::Joint ( const std::string &  joint_name,
int  joint_id,
urdf::JointConstSharedPtr  urdf_joint,
const std::string &  chain_name 
)

Construct using the joint name, joint id, urdf joint and chain name.

Parameters
joint_namethe joint name
joint_idthe joint id
urdf_jointshared pointer to urdf::Joint struct
joint_namethe parent chain name

Member Function Documentation

◆ checkEffortLimit()

bool XBot::Joint::checkEffortLimit ( double  tau) const

check that the param tau is below the joint effort limit

Parameters
tauthe effort to check
Returns
true if the param tau is below the joint effort limit

◆ checkJointLimits()

bool XBot::Joint::checkJointLimits ( double  q) const

check that the param q is inside the position limits

Parameters
qthe position to check
Returns
true if the param q is inside the joint position limits

◆ checkVelocityLimit()

bool XBot::Joint::checkVelocityLimit ( double  qdot) const

check that the param qdot is below the joint velocity limit

Parameters
qdotthe velocity to check
Returns
true if the param qdot is below the joint velocity limit

◆ enforceEffortLimit()

void XBot::Joint::enforceEffortLimit ( double &  tau) const

◆ enforceJointLimits()

void XBot::Joint::enforceJointLimits ( double &  q) const

◆ enforceVelocityLimit()

void XBot::Joint::enforceVelocityLimit ( double &  qdot) const

◆ getChainName()

const std::string & XBot::Joint::getChainName ( ) const

Getter for the parent chain name.

Returns
const std::string& parent chain name

◆ getControlMode()

void XBot::Joint::getControlMode ( XBot::ControlMode control_mode) const

◆ getDamping()

double XBot::Joint::getDamping ( ) const

get the commanded joint damping

Returns
the commanded joint damping

◆ getEffortLimit()

void XBot::Joint::getEffortLimit ( double &  tau_max) const

Getter for the joint effort limit in the urdf.

Parameters
tau_maxjoint effort limit
Returns
void

◆ getEffortReference()

double XBot::Joint::getEffortReference ( ) const

getter for the commanded effort (generalized force) reference

Returns
the commanded effort (generalized force) reference

◆ getJointAcceleration()

double XBot::Joint::getJointAcceleration ( ) const

getter for the link side acceleration

Returns
the link side acceleration

◆ getJointEffort()

double XBot::Joint::getJointEffort ( ) const

getter for the joint effort (generalized force)

Returns
double the joint effort (generalized force)

◆ getJointId()

int XBot::Joint::getJointId ( ) const

Getter for the joint id.

Returns
int joint id

◆ getJointLimits()

void XBot::Joint::getJointLimits ( double &  qmin,
double &  qmax 
) const

Getter for the joint position limits in the urdf.

Parameters
qminlower position limit of the joint
qmaxupper position limit of the joint
Returns
void

◆ getJointName()

const std::string & XBot::Joint::getJointName ( ) const

Getter for the joint name.

Returns
const std::string& joint name

◆ getJointPosition()

double XBot::Joint::getJointPosition ( ) const

getter for the link side encoder reading

Returns
the link side encoder reading

◆ getJointVelocity()

double XBot::Joint::getJointVelocity ( ) const

getter for the link side velocity

Returns
the link side velocity

◆ getMotorPosition()

double XBot::Joint::getMotorPosition ( ) const

getter for the motor side encoder reading

Returns
the motor side encoder reading

◆ getMotorVelocity()

double XBot::Joint::getMotorVelocity ( ) const

getter for the motor side velocity

Returns
the motor side velocity

◆ getPositionReference()

double XBot::Joint::getPositionReference ( ) const

getter for the commanded motor position reference

Returns
the commanded motor position reference

◆ getStiffness()

double XBot::Joint::getStiffness ( ) const

get the commanded joint stiffness

Returns
the commanded joint stiffness

◆ getTemperature()

double XBot::Joint::getTemperature ( ) const

getter for the joint temperature

Returns
the joint temperature

◆ getUrdfJoint()

urdf::JointConstSharedPtr XBot::Joint::getUrdfJoint ( ) const

Getter for the urdf Joint object.

Returns
a (boost) shared pointer to a const urdf Joint object

◆ getVelocityLimit()

void XBot::Joint::getVelocityLimit ( double &  qdot_max) const

Getter for the joint velocity limit in the urdf.

Parameters
qdot_maxjoint velocity limit
Returns
void

◆ getVelocityReference()

double XBot::Joint::getVelocityReference ( ) const

getter for the commanded velocity reference

Returns
the commanded velocity reference

◆ isFixedControlledJoint()

bool XBot::Joint::isFixedControlledJoint ( ) const

return true if the joint is specified fixed in the model, but inside the controlled_joints group of the SRDF e.g.

Hands

Returns
true if the joint is fixed and controlled

◆ isVirtualJoint()

bool XBot::Joint::isVirtualJoint ( ) const
protected

return true if the joint is virtual

Returns
true if the joint is virtual. False otherwise

◆ operator<<()

const XBot::Joint & XBot::Joint::operator<< ( const XBot::Joint from)
protected

operator << to synchronize the current Joint with another Joint object

Parameters
fromthe Joint object from which we synchronize the current object
Returns
const XBot::Joint& the current synchornized object

◆ print()

void XBot::Joint::print ( ) const

Prints a pretty table about joint state.

Returns
void

◆ printTracking()

void XBot::Joint::printTracking ( ) const

Prints a pretty table about joint tracking error.

Returns
void

◆ setControlMode()

void XBot::Joint::setControlMode ( const ControlMode control_mode)

◆ setDamping()

void XBot::Joint::setDamping ( double  damping)

set the joint damping

Parameters
dampingthe joint damping to set
Returns
void

◆ setEffortReference()

void XBot::Joint::setEffortReference ( double  effort_ref)

setter for the effort (generalized force) reference

Parameters
effort_refthe effort (generalized force) reference to set
Returns
void

◆ setJointAcceleration()

void XBot::Joint::setJointAcceleration ( double  link_acc)

setter for the link side acceleration

Parameters
link_accthe link side velocity to set
Returns
void

◆ setJointEffort()

void XBot::Joint::setJointEffort ( double  effort)

setter for the joint effort (generalized force)

Parameters
effortthe joint effort (generalized force) to set
Returns
void

◆ setJointId()

void XBot::Joint::setJointId ( int  joint_id)
protected

Setter for the joint id.

Parameters
joint_idthe joint id to set
Returns
void

◆ setJointName()

void XBot::Joint::setJointName ( const std::string &  joint_name)
protected

Setter for the joint name.

Parameters
joint_namethe joint name to set
Returns
void

◆ setJointPosition()

void XBot::Joint::setJointPosition ( double  link_pos)

Setter for the link side encoder reading.

Parameters
link_posthe link side encoder reading to set
Returns
void

◆ setJointVelocity()

void XBot::Joint::setJointVelocity ( double  link_vel)

setter for the link side velocity

Parameters
link_velthe link side velocity to set
Returns
void

◆ setMotorPosition()

void XBot::Joint::setMotorPosition ( double  motor_pos)

setter for the motor side encoder reading

Parameters
motor_posthe motor side encoder reading to set
Returns
void

◆ setMotorVelocity()

void XBot::Joint::setMotorVelocity ( double  motor_vel)

setter for the motor side velocity

Parameters
motor_velthe motor side velocity to set
Returns
void

◆ setPositionReference()

void XBot::Joint::setPositionReference ( double  pos_ref)

setter for the motor position reference

Parameters
pos_refthe motor position reference to set
Returns
void

◆ setReferenceFrom()

template<typename... SyncFlags>
bool XBot::Joint::setReferenceFrom ( const Joint other,
SyncFlags...  flags 
)
protected

Set the joint references (TX) from other joint state (RX)

Parameters
otherThe Joint object which references are read from
flagsFlags to specify what part of the state must be synchronized. By default (i.e. if this argument is omitted) the whole state is synchronized. Otherwise, an arbitrary number of flags can be specified in order to select a subset of the state. The flags must be of the enum type XBot::Sync, which can take the following values:
Returns
True if the synchronization is feasible ( i.e. the two Joint object have exactly the same names/ids). False * otherwise.

◆ setStiffness()

void XBot::Joint::setStiffness ( double  stiffness)

set the joint stiffness

Parameters
stiffnessthe joint stiffness to set
Returns
void

◆ setTemperature()

void XBot::Joint::setTemperature ( double  temperature)

setter for the joint temperature

Parameters
temperaturethe joint temperature
Returns
void

◆ setVelocityReference()

void XBot::Joint::setVelocityReference ( double  vel_ref)

setter for the velocity reference

Parameters
vel_refthe velocity reference to set
Returns
void

◆ syncFrom()

template<typename... SyncFlags>
bool XBot::Joint::syncFrom ( const Joint other,
SyncFlags...  flags 
)
protected

Synchronize the current Joint with another Joint object.

Parameters
otherThe Joint object from which we synchronize the current object
flagsFlags to specify what part of the state must be synchronized. By default (i.e. if this argument is omitted) the whole state is synchronized. Otherwise, an arbitrary number of flags can be specified in order to select a subset of the state. The flags must be of the enum type XBot::Sync, which can take the following values:
Returns
True if the synchronization is feasible ( i.e. the two Joint object have exactly the same names/ids). False * otherwise

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const XBot::Joint j 
)
friend

ostream operator << for a Joint object

Parameters
osostream
jthe Joint object to print using ostream
Returns
std::ostream& result ostream

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