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

#include <XBotInterface.h>

+ Inheritance diagram for XBot::XBotInterface:
+ Collaboration diagram for XBot::XBotInterface:

Public Types

typedef std::shared_ptr< XBotInterfacePtr
 
typedef std::shared_ptr< const XBotInterfaceConstPtr
 

Public Member Functions

 XBotInterface ()
 
 XBotInterface (const XBotInterface &other)
 
XBotInterfaceoperator= (const XBotInterface &rhs)
 
virtual ~XBotInterface ()
 
bool init (const std::string &path_to_cfg)
 
bool init (const ConfigOptions &options)
 
const ConfigOptionsgetConfigOptions () const
 Gets the configuration struct that has been used to build the XBotInterface. More...
 
const std::string & getPathToConfig () const
 Gets the path to the YAML config file used to build the XBotInterface. More...
 
const urdf::ModelInterface & getUrdf () const
 Getter for the robot URDF model corresponding to the URDF xml file specified in the YAML config file. More...
 
const std::string & getUrdfPath () const
 getUrdfPath Getter for the path to the URDF model More...
 
const srdf_advr::Model & getSrdf () const
 Getter fot the robot SRDF model corresponding to the SRDF xml file specified in the YAML config file. More...
 
const std::string & getSrdfPath () const
 getSrdfPath Getter for the path to the SRDF model More...
 
const std::string & getUrdfString () const
 Returns the robot URDF xml as a string. More...
 
const std::string & getSrdfString () const
 Returns the robot SRDF xml as a string. More...
 
bool getRobotState (const std::string &state_name, Eigen::VectorXd &q) const
 Gets the robot joints group state configuration as specified in the robot SRDF. More...
 
bool getRobotState (const std::string &state_name, JointIdMap &q) const
 Gets the robot joints group state configuration as specified in the robot SRDF. More...
 
bool getRobotState (const std::string &state_name, JointNameMap &q) const
 Gets the robot joints group state configuration as specified in the robot SRDF. More...
 
std::vector< std::string > getChainNames () const
 Return a vector of available chain names as strings. More...
 
bool hasChain (const std::string &chain_name) const
 A method for determining if a chain with name "chain_name" is defined inside the interface. More...
 
int legs () const
 Returns the number of legs defined inside the interface. More...
 
int arms () const
 Returns the number of arms defined inside the interface. More...
 
const std::vector< std::string > & getEnabledJointNames () const
 Returns a vector of enabled joint names. More...
 
const std::vector< int > & getEnabledJointId () const
 Returns a vector of enabled joint IDs. More...
 
bool hasJoint (const std::string &joint_name) const
 Checks that a joint with name "joint_name" is defined as an enabled joint inside the interface. More...
 
bool hasJoint (int joint_id) const
 Checks that a joint with ID "joint_id" is defined as an enabled joint inside the interface. More...
 
int getJointNum () const
 Getter for the number of enabled joints. More...
 
XBot::Joint::ConstPtr getJointByName (const std::string &joint_name) const
 Gets the joint with name "joint_name" if it is defined as enabled. More...
 
XBot::Joint::ConstPtr getJointByID (int joint_id) const
 Gets the joint with ID "joint_id" if it is defined as enabled. More...
 
XBot::Joint::ConstPtr getJointByDofIndex (int idx) const
 Gets the joint with the required dof index. More...
 
int getDofIndex (const std::string &joint_name) const
 Gets the Eigen ID of the joint with name "joint_name". More...
 
int getDofIndex (int joint_id) const
 Gets the Eigen ID of the joint with ID "joint_id". More...
 
bool getDofIndex (const std::string &chain_name, std::vector< int > &ids) const
 Gets dof indices of all joints inside chain "chain_name". More...
 
void initLog (MatLogger2::Ptr logger, int buffer_size=-1, int interleave=1, std::string prefix="")
 Pre-allocates memory for logging the robot state to a mat file. More...
 
void log (MatLogger2::Ptr logger, double timestamp, const std::string &prefix="") const
 Logs the current robot state. More...
 
std::map< std::string, ForceTorqueSensor::ConstPtrgetForceTorque () const
 Getter for the force-torque sensor map pertaining to the whole robot. More...
 
ForceTorqueSensor::ConstPtr getForceTorque (const std::string &parent_link_name) const
 Returns a force-torque sensor given its parent-link name. More...
 
ForceTorqueSensor::ConstPtr getForceTorque (int ft_id) const
 Returns a force-torque sensor given its sensor ID. More...
 
std::map< std::string, ImuSensor::ConstPtrgetImu ()
 Getter for the IMU sensor map pertaining to the chain. More...
 
ImuSensor::ConstPtr getImu (const std::string &parent_link_name) const
 Returns an IMU sensor given its parent-link name. More...
 
ImuSensor::ConstPtr getImu (int imu_id) const
 Returns an IMU sensor given its sensor ID. More...
 
std::map< std::string, Hand::PtrgetHand ()
 Getter for the hands map pertaining to the whole robot. More...
 
Hand::Ptr getHand (int hand_id) const
 Returns a hand given its hand ID. More...
 
bool eigenToMap (const Eigen::VectorXd &vector, JointNameMap &name_map) const
 Converts a state vector for the whole robot to its JointNameMap representation. More...
 
bool eigenToMap (const Eigen::VectorXd &vector, JointIdMap &id_map) const
 Converts a state vector for the whole robot to its JointIdMap representation. More...
 
bool mapToEigen (const JointNameMap &map, Eigen::VectorXd &vector) const
 Converts a state vector for an arbitrary subset of the robot state (specified as a JointNameMap) to its Eigen representation. More...
 
bool mapToEigen (const JointIdMap &map, Eigen::VectorXd &vector) const
 Converts a state vector for an arbitrary subset of the robot state (specified as a JointIdMap) to its Eigen representation. More...
 
bool getJointPosition (Eigen::VectorXd &q) const
 Gets the robot joint positions as an Eigen vector. More...
 
bool getMotorPosition (Eigen::VectorXd &q) const
 Gets the robot motor positions as an Eigen vector. More...
 
bool getJointVelocity (Eigen::VectorXd &qdot) const
 Gets the robot joint velocities as an Eigen vector. More...
 
bool getMotorVelocity (Eigen::VectorXd &qdot) const
 Gets the robot motor velocities as an Eigen vector. More...
 
bool getJointAcceleration (Eigen::VectorXd &qddot) const
 Gets the robot joint accelerations as an Eigen vector. More...
 
bool getJointEffort (Eigen::VectorXd &tau) const
 Gets the robot joint efforts as an Eigen vector. More...
 
bool getTemperature (Eigen::VectorXd &temp) const
 Gets the robot joint temperatures as an Eigen vector. More...
 
bool getJointPosition (JointIdMap &q) const
 Gets the robot joint positions as a JointIdMap, i.e. More...
 
bool getMotorPosition (JointIdMap &q) const
 Gets the robot motor positions as a JointIdMap, i.e. More...
 
bool getJointVelocity (JointIdMap &qdot) const
 Gets the robot joint velocities as a JointIdMap, i.e. More...
 
bool getMotorVelocity (JointIdMap &qdot) const
 Gets the robot motor velocities as a JointIdMap, i.e. More...
 
bool getJointAcceleration (JointIdMap &qddot) const
 Gets the robot joint accelerations as a JointIdMap, i.e. More...
 
bool getJointEffort (JointIdMap &tau) const
 Gets the robot joint efforts as a JointIdMap, i.e. More...
 
bool getTemperature (JointIdMap &temp) const
 Gets the robot joint temperatures as a JointIdMap, i.e. More...
 
bool getJointPosition (JointNameMap &q) const
 Gets the robot joint postions as a JointNameMap, i.e. More...
 
bool getMotorPosition (JointNameMap &q) const
 Gets the robot motor postions as a JointNameMap, i.e. More...
 
bool getJointVelocity (JointNameMap &qdot) const
 Gets the robot joint velocities as a JointNameMap, i.e. More...
 
bool getMotorVelocity (JointNameMap &qdot) const
 Gets the robot motor velocities as a JointNameMap, i.e. More...
 
bool getJointAcceleration (JointNameMap &qddot) const
 Gets the robot joint accelerations as a JointNameMap, i.e. More...
 
bool getJointEffort (JointNameMap &tau) const
 Gets the robot joint efforts as a JointNameMap, i.e. More...
 
bool getTemperature (JointNameMap &temp) const
 Gets the robot joint temperatures as a JointNameMap, i.e. More...
 
bool setJointPosition (const Eigen::VectorXd &q)
 Sets the XBotInterface internal joint positions according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setMotorPosition (const Eigen::VectorXd &q)
 Sets the XBotInterface internal motor positions according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setJointVelocity (const Eigen::VectorXd &qdot)
 Sets the XBotInterface internal joint velocities according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setMotorVelocity (const Eigen::VectorXd &qdot)
 Sets the XBotInterface internal motor velocities according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setJointAcceleration (const Eigen::VectorXd &qddot)
 Sets the XBotInterface internal joint accelerations according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setJointEffort (const Eigen::VectorXd &tau)
 Sets the XBotInterface internal joint efforts according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setTemperature (const Eigen::VectorXd &temp)
 Sets the XBotInterface internal joint temperatures according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setJointPosition (const JointIdMap &q)
 Sets the XBotInterface internal joint positions according to the input JointIdMap (i.e. More...
 
bool setMotorPosition (const JointIdMap &q)
 Sets the XBotInterface internal motor positions according to the input JointIdMap (i.e. More...
 
bool setJointVelocity (const JointIdMap &qdot)
 Sets the XBotInterface internal joint velocities according to the input JointIdMap (i.e. More...
 
bool setMotorVelocity (const JointIdMap &qdot)
 Sets the XBotInterface internal motor velocities according to the input JointIdMap (i.e. More...
 
bool setJointAcceleration (const JointIdMap &qddot)
 Sets the XBotInterface internal joint accelerations according to the input JointIdMap (i.e. More...
 
bool setJointEffort (const JointIdMap &tau)
 Sets the XBotInterface internal joint efforts according to the input JointIdMap (i.e. More...
 
bool setTemperature (const JointIdMap &temp)
 Sets the XBotInterface internal motor temperatures according to the input JointIdMap (i.e. More...
 
bool setJointPosition (const JointNameMap &q)
 Sets the XBotInterface internal joint positions according to the input JointNameMap (i.e. More...
 
bool setMotorPosition (const JointNameMap &q)
 Sets the XBotInterface internal motor positions according to the input JointNameMap (i.e. More...
 
bool setJointVelocity (const JointNameMap &qdot)
 Sets the XBotInterface internal joint velocities according to the input JointNameMap (i.e. More...
 
bool setMotorVelocity (const JointNameMap &qdot)
 Sets the XBotInterface internal motor velocities according to the input JointNameMap (i.e. More...
 
bool setJointAcceleration (const JointNameMap &qddot)
 Sets the XBotInterface internal joint accelerations according to the input JointNameMap (i.e. More...
 
bool setJointEffort (const JointNameMap &tau)
 Sets the XBotInterface internal joint efforts according to the input JointNameMap (i.e. More...
 
bool setTemperature (const JointNameMap &temp)
 Sets the XBotInterface internal joint temperatures according to the input JointNameMap (i.e. More...
 
bool getPositionReference (Eigen::VectorXd &q) const
 Gets the robot position references as an Eigen vector. More...
 
bool getVelocityReference (Eigen::VectorXd &qdot) const
 Gets the robot velocity references as an Eigen vector. More...
 
bool getEffortReference (Eigen::VectorXd &tau) const
 Gets the robot effort references as an Eigen vector. More...
 
bool getStiffness (Eigen::VectorXd &K) const
 Gets the robot stiffness as an Eigen vector. More...
 
bool getDamping (Eigen::VectorXd &D) const
 Gets the robot damping as an Eigen vector. More...
 
bool getPositionReference (JointIdMap &q) const
 Gets the robot position references as a JointIdMap, i.e. More...
 
bool getVelocityReference (JointIdMap &qdot) const
 Gets the robot velocity references as a JointIdMap, i.e. More...
 
bool getEffortReference (JointIdMap &tau) const
 Gets the robot effort references as a JointIdMap, i.e. More...
 
bool getStiffness (JointIdMap &K) const
 Gets the robot stiffness as a JointIdMap, i.e. More...
 
bool getDamping (JointIdMap &D) const
 Gets the robot damping as a JointIdMap, i.e. More...
 
bool getPositionReference (JointNameMap &q) const
 Gets the robot postion references as a JointNameMap, i.e. More...
 
bool getVelocityReference (JointNameMap &qdot) const
 Gets the robot velocity references as a JointNameMap, i.e. More...
 
bool getEffortReference (JointNameMap &tau) const
 Gets the robot effort references as a JointNameMap, i.e. More...
 
bool getStiffness (JointNameMap &K) const
 Gets the robot stiffness as a JointNameMap, i.e. More...
 
bool getDamping (JointNameMap &D) const
 Gets the robot damping as a JointNameMap, i.e. More...
 
bool setPositionReference (const Eigen::VectorXd &q)
 Sets the XBotInterface internal joint position references according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setVelocityReference (const Eigen::VectorXd &qdot)
 Sets the XBotInterface internal joint velocity references according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setEffortReference (const Eigen::VectorXd &tau)
 Sets the XBotInterface internal joint effort references according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setStiffness (const Eigen::VectorXd &K)
 Sets the XBotInterface internal joint stiffness according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setDamping (const Eigen::VectorXd &D)
 Sets the XBotInterface internal joint damping according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods. More...
 
bool setPositionReference (const JointIdMap &q)
 Sets the XBotInterface internal joint position references according to the input JointIdMap (i.e. More...
 
bool setVelocityReference (const JointIdMap &qdot)
 Sets the XBotInterface internal joint velocity references according to the input JointIdMap (i.e. More...
 
bool setEffortReference (const JointIdMap &tau)
 Sets the XBotInterface internal joint effort references according to the input JointIdMap (i.e. More...
 
bool setStiffness (const JointIdMap &K)
 Sets the XBotInterface internal joint stiffness according to the input JointIdMap (i.e. More...
 
bool setDamping (const JointIdMap &D)
 Sets the XBotInterface internal joint damping according to the input JointIdMap (i.e. More...
 
bool setPositionReference (const JointNameMap &q)
 Sets the XBotInterface internal joint position references according to the input JointNameMap (i.e. More...
 
bool setVelocityReference (const JointNameMap &qdot)
 Sets the XBotInterface internal joint velocity references according to the input JointNameMap (i.e. More...
 
bool setEffortReference (const JointNameMap &tau)
 Sets the XBotInterface internal joint effort references according to the input JointNameMap (i.e. More...
 
bool setStiffness (const JointNameMap &K)
 Sets the XBotInterface internal joint stiffness according to the input JointNameMap (i.e. More...
 
bool setDamping (const JointNameMap &D)
 Sets the XBotInterface internal joint damping according to the input JointNameMap (i.e. More...
 
void getJointLimits (Eigen::VectorXd &q_min, Eigen::VectorXd &q_max) const
 Gets a vector of the robot joint limits, as specified in the URDF file. More...
 
void getVelocityLimits (Eigen::VectorXd &qdot_max) const
 Gets a vector of the robot joint velocity limits, as specified in the URDF file. More...
 
void getEffortLimits (Eigen::VectorXd &tau_max) const
 Gets a vector of the robot joint effort limits, as specified in the URDF file. More...
 
bool checkJointLimits (const Eigen::VectorXd &q, std::vector< std::string > &violating_joints) const
 Check the input joint position vector against joint limits. More...
 
bool checkVelocityLimits (const Eigen::VectorXd &qdot, std::vector< std::string > &violating_joints) const
 Check the input joint velocity vector against joint limits. More...
 
bool checkEffortLimits (const Eigen::VectorXd &tau, std::vector< std::string > &violating_joints) const
 Check the input joint effort vector against joint limits. More...
 
bool checkJointLimits (const Eigen::VectorXd &q) const
 Check the input joint position vector against joint limits. More...
 
bool checkVelocityLimits (const Eigen::VectorXd &qdot) const
 Check the input joint velocity vector against joint limits. More...
 
bool checkEffortLimits (const Eigen::VectorXd &tau) const
 Check the input joint effort vector against joint limits. More...
 
bool enforceJointLimits (JointIdMap &q) const
 Modifies the input joint position map by enforcing joint limits. More...
 
bool enforceJointLimits (JointNameMap &q) const
 Modifies the input joint position map by enforcing joint limits. More...
 
bool enforceJointLimits (Eigen::VectorXd &q) const
 Modifies the input joint position vector by enforcing joint limits. More...
 
bool enforceEffortLimit (Eigen::VectorXd &tau) const
 Modifies the input joint effort vector by enforcing effort limits. More...
 
bool enforceVelocityLimit (Eigen::VectorXd &qdot) const
 Modifies the input joint velcoity vector by enforcing joint limits. More...
 
template<typename... SyncFlags>
bool sync (const XBotInterface &other, SyncFlags... flags)
 Synchronize the current XBotInterface with another XBotInterface object: only the common chains will be taken into account. More...
 
const std::map< std::string, XBot::KinematicChain::Ptr > & getChainMap () const
 Getter for the chain map inside the XBotInterface. More...
 
void print () const
 Print a pretty table about the robot state. More...
 
void printTracking () const
 Print a pretty table about the robot tracking. More...
 

Protected Member Functions

Joint::Ptr getJointByNameInternal (const std::string &joint_name) const
 
Joint::Ptr getJointByIdInternal (int joint_id) const
 
Joint::Ptr getJointByDofIndexInternal (int dof_index) const
 
const std::map< std::string, ForceTorqueSensor::Ptr > & getForceTorqueInternal () const
 
const std::map< std::string, ImuSensor::Ptr > & getImuInternal () const
 
virtual bool init_internal (const ConfigOptions &config)
 
virtual bool post_init ()
 
const std::vector< std::string > & getModelOrderedChainName () const
 

Protected Attributes

XBotCoreModel _XBotModel
 
std::map< std::string, XBot::KinematicChain::Ptr_chain_map
 
std::vector< Joint::Ptr_ordered_joint_vector
 
std::vector< Joint::Ptr_joint_vector
 
std::map< std::string, ForceTorqueSensor::Ptr_ft_map
 
std::map< int, ForceTorqueSensor::Ptr_ft_id_map
 
std::map< std::string, ImuSensor::Ptr_imu_map
 
std::map< int, ImuSensor::Ptr_imu_id_map
 
std::map< std::string, Hand::Ptr_hand_map
 
std::map< int, Hand::Ptr_hand_id_map
 
std::vector< std::string > _ordered_chain_names
 
std::map< int, int > _joint_id_to_eigen_id
 
std::map< std::string, int > _joint_name_to_eigen_id
 

Friends

std::ostream & operator<< (std::ostream &os, const XBot::XBotInterface &robot)
 

Member Typedef Documentation

◆ ConstPtr

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

◆ Ptr

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

Constructor & Destructor Documentation

◆ XBotInterface() [1/2]

XBot::XBotInterface::XBotInterface ( )

◆ XBotInterface() [2/2]

XBot::XBotInterface::XBotInterface ( const XBotInterface other)

◆ ~XBotInterface()

XBot::XBotInterface::~XBotInterface ( )
virtual

Member Function Documentation

◆ arms()

int XBot::XBotInterface::arms ( ) const

Returns the number of arms defined inside the interface.

This equals the number of elements of the "arms" group inside the SRDF which was provided in the YAML config file.

Returns
The number of defined arms.

◆ checkEffortLimits() [1/2]

bool XBot::XBotInterface::checkEffortLimits ( const Eigen::VectorXd &  tau) const

Check the input joint effort vector against joint limits.

Parameters
tauA joint effort vector to be checked against joint limits.
Returns
True if all joints are within their limits.

◆ checkEffortLimits() [2/2]

bool XBot::XBotInterface::checkEffortLimits ( const Eigen::VectorXd &  tau,
std::vector< std::string > &  violating_joints 
) const

Check the input joint effort vector against joint limits.

The names of joints violating the limits are pushed into the violating_joints vector (which is not cleared before being filled)

Parameters
tauA joint position vector to be checked against joint limits.
violating_jointsThe vector of the names of joints violating the limits. Note that this is not cleared before use.
Returns
True if all joints are within their limits.

◆ checkJointLimits() [1/2]

bool XBot::XBotInterface::checkJointLimits ( const Eigen::VectorXd &  q) const

Check the input joint position vector against joint limits.

Parameters
qA joint position vector to be checked against joint limits.
Returns
True if all joints are within their limits.

◆ checkJointLimits() [2/2]

bool XBot::XBotInterface::checkJointLimits ( const Eigen::VectorXd &  q,
std::vector< std::string > &  violating_joints 
) const

Check the input joint position vector against joint limits.

The names of joints violating the limits are pushed into the violating_joints vector (which is not cleared before being filled)

Parameters
qA joint position vector to be checked against joint limits.
violating_jointsThe vector of the names of joints violating the limits. Note that this is not cleared before use.
Returns
True if all joints are within their limits.

◆ checkVelocityLimits() [1/2]

bool XBot::XBotInterface::checkVelocityLimits ( const Eigen::VectorXd &  qdot) const

Check the input joint velocity vector against joint limits.

Parameters
qdotA joint velocity vector to be checked against joint limits.
Returns
True if all joints are within their limits.

◆ checkVelocityLimits() [2/2]

bool XBot::XBotInterface::checkVelocityLimits ( const Eigen::VectorXd &  qdot,
std::vector< std::string > &  violating_joints 
) const

Check the input joint velocity vector against joint limits.

The names of joints violating the limits are pushed into the violating_joints vector (which is not cleared before being filled)

Parameters
qdotA joint position vector to be checked against joint limits.
violating_jointsThe vector of the names of joints violating the limits. Note that this is not cleared before use.
Returns
True if all joints are within their limits.

◆ eigenToMap() [1/2]

bool XBot::XBotInterface::eigenToMap ( const Eigen::VectorXd &  vector,
XBot::JointIdMap id_map 
) const

Converts a state vector for the whole robot to its JointIdMap representation.

Note that the output map is not cleared before it is filled. It is the responsibility of the user to do so if required.

Parameters
vectorA state vector for the whole robot (its size must match getJointNum())
id_mapThe output map to be filled
Returns
True if the input vector is valid.

◆ eigenToMap() [2/2]

bool XBot::XBotInterface::eigenToMap ( const Eigen::VectorXd &  vector,
XBot::JointNameMap name_map 
) const

Converts a state vector for the whole robot to its JointNameMap representation.

Note that the output map is not cleared before it is filled. It is the responsibility of the user to do so if required.

Parameters
vectorA state vector for the whole robot (its size must match getJointNum())
name_mapThe output map to be filled
Returns
True if the input vector is valid.

◆ enforceEffortLimit()

bool XBot::XBotInterface::enforceEffortLimit ( Eigen::VectorXd &  tau) const

Modifies the input joint effort vector by enforcing effort limits.

Parameters
tauThe input joint effort vector. Out-of-range components are set to the closest joint limit.
Returns
True if the provided vector has the correct size.

◆ enforceJointLimits() [1/3]

bool XBot::XBotInterface::enforceJointLimits ( Eigen::VectorXd &  q) const

Modifies the input joint position vector by enforcing joint limits.

Parameters
qThe input joint position vector. Out-of-range components are set to the closest joint limit.
Returns
True if the provided vector has the correct size.

◆ enforceJointLimits() [2/3]

bool XBot::XBotInterface::enforceJointLimits ( XBot::JointIdMap q) const

Modifies the input joint position map by enforcing joint limits.

Parameters
qThe input joint position map. Out-of-range components are set to the closest joint limit.
Returns
True if the provided vector has the correct size.

◆ enforceJointLimits() [3/3]

bool XBot::XBotInterface::enforceJointLimits ( XBot::JointNameMap q) const

Modifies the input joint position map by enforcing joint limits.

Parameters
qThe input joint position map. Out-of-range components are set to the closest joint limit.
Returns
True if the provided vector has the correct size.

◆ enforceVelocityLimit()

bool XBot::XBotInterface::enforceVelocityLimit ( Eigen::VectorXd &  qdot) const

Modifies the input joint velcoity vector by enforcing joint limits.

Parameters
qdotThe input joint velocity vector. Out-of-range components are set to the closest joint limit.
Returns
True if the provided vector has the correct size.

◆ getChainMap()

const std::map< std::string, XBot::KinematicChain::Ptr > & XBot::XBotInterface::getChainMap ( ) const

Getter for the chain map inside the XBotInterface.

Returns
the chain map inside the XBotInterface

◆ getChainNames()

std::vector< std::string > XBot::XBotInterface::getChainNames ( ) const

Return a vector of available chain names as strings.

Returns
A vector of available chain names.

◆ getConfigOptions()

const XBot::ConfigOptions & XBot::XBotInterface::getConfigOptions ( ) const

Gets the configuration struct that has been used to build the XBotInterface.

Returns
ConfigOptions struct

◆ getDamping() [1/3]

bool XBot::XBotInterface::getDamping ( Eigen::VectorXd &  D) const

Gets the robot damping as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
DA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getDamping() [2/3]

bool XBot::XBotInterface::getDamping ( JointIdMap D) const

Gets the robot damping as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
DA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getDamping() [3/3]

bool XBot::XBotInterface::getDamping ( JointNameMap D) const

Gets the robot damping as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
DA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getDofIndex() [1/3]

bool XBot::XBotInterface::getDofIndex ( const std::string &  chain_name,
std::vector< int > &  ids 
) const

Gets dof indices of all joints inside chain "chain_name".

Parameters
chain_nameThe name of the requested chain.
idsThe output vector of dof indices.
Returns
True if chain_name is a valid chain name.

◆ getDofIndex() [2/3]

int XBot::XBotInterface::getDofIndex ( const std::string &  joint_name) const

Gets the Eigen ID of the joint with name "joint_name".

This means that the i-th entry of all Eigen vectors which are taken as arguments by XBotInterface methods refers to the joint namd "joint_name".

Parameters
joint_nameThe name of the required joint.
Returns
The Eigen index of the required joint. A value of -1 is returned when joint_name is not valid.

◆ getDofIndex() [3/3]

int XBot::XBotInterface::getDofIndex ( int  joint_id) const

Gets the Eigen ID of the joint with ID "joint_id".

This means that the i-th entry of all Eigen vectors which are taken as arguments by XBotInterface methods refers to the joint with the given ID.

Parameters
joint_idThe ID of the required joint.
Returns
The Eigen index of the required joint. A value of -1 is returned when joint_id is not valid.

◆ getEffortLimits()

void XBot::XBotInterface::getEffortLimits ( Eigen::VectorXd &  tau_max) const

Gets a vector of the robot joint effort limits, as specified in the URDF file.

Parameters
qdot_maxThe output vector of the chain joints effort limits
Returns
void

◆ getEffortReference() [1/3]

bool XBot::XBotInterface::getEffortReference ( Eigen::VectorXd &  tau) const

Gets the robot effort references as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
tauA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getEffortReference() [2/3]

bool XBot::XBotInterface::getEffortReference ( JointIdMap tau) const

Gets the robot effort references as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
tauA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getEffortReference() [3/3]

bool XBot::XBotInterface::getEffortReference ( JointNameMap tau) const

Gets the robot effort references as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
tauA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getEnabledJointId()

const std::vector< int > & XBot::XBotInterface::getEnabledJointId ( ) const

Returns a vector of enabled joint IDs.

Returns
A const reference to the vector of enabled joint IDs.

◆ getEnabledJointNames()

const std::vector< std::string > & XBot::XBotInterface::getEnabledJointNames ( ) const

Returns a vector of enabled joint names.

Returns
A const reference to the vector of enabled joint names.

◆ getForceTorque() [1/3]

std::map< std::string, XBot::ForceTorqueSensor::ConstPtr > XBot::XBotInterface::getForceTorque ( ) const

Getter for the force-torque sensor map pertaining to the whole robot.

Returns
A map whose key is the sensor name (i.e. the name of the sensor link inside the URDF) and whose value is a shared pointer to the force torque sensor.

◆ getForceTorque() [2/3]

XBot::ForceTorqueSensor::ConstPtr XBot::XBotInterface::getForceTorque ( const std::string &  parent_link_name) const

Returns a force-torque sensor given its parent-link name.

Parameters
parent_link_nameName of the link to which the sensor is attached
Returns
A shared pointer to the required force-torque sensor. The returned pointer is null if the robot either does not contain a link named "parent_link_name" or such a link does not contain any FT.

◆ getForceTorque() [3/3]

XBot::ForceTorqueSensor::ConstPtr XBot::XBotInterface::getForceTorque ( int  ft_id) const

Returns a force-torque sensor given its sensor ID.

Parameters
ft_idSensor ID as given by ForceTorqueSensor::getSensorId(). If the sensor fixed joint is listed inside the joint id map, then the sensor id is the one specified inside such a file.
Returns
A shared pointer to the required force-torque sensor. The returned pointer is null if the robot does not have an ft with the requested id.

◆ getForceTorqueInternal()

const std::map< std::string, XBot::ForceTorqueSensor::Ptr > & XBot::XBotInterface::getForceTorqueInternal ( ) const
protected

◆ getHand() [1/2]

std::map< std::string, XBot::Hand::Ptr > XBot::XBotInterface::getHand ( )

Getter for the hands map pertaining to the whole robot.

Returns
A map whose key is the hand name (i.e. the name of the fixed hand joint in the URDF) and whose value is a shared pointer to the hand.

◆ getHand() [2/2]

XBot::Hand::Ptr XBot::XBotInterface::getHand ( int  hand_id) const

Returns a hand given its hand ID.

Parameters
hand_idhand ID as given by Hand::getHandId(). If the hand fixed joint is listed inside the joint id map, then the hand id is the one specified inside such a file.
Returns
A shared pointer to the required hand. The returned pointer is null if the robot does not have an hand with the requested id.

◆ getImu() [1/3]

std::map< std::string, XBot::ImuSensor::ConstPtr > XBot::XBotInterface::getImu ( )

Getter for the IMU sensor map pertaining to the chain.

Returns
A map whose key is the sensor name (i.e. the name of the sensor link inside the URDF) and whose value is a shared pointer to the IMU sensor.

◆ getImu() [2/3]

XBot::ImuSensor::ConstPtr XBot::XBotInterface::getImu ( const std::string &  parent_link_name) const

Returns an IMU sensor given its parent-link name.

Parameters
parent_link_nameName of the link to which the sensor is attached
Returns
A shared pointer to the required IMU sensor. The returned pointer is null if the chain either does not contain a link named "parent_link_name" or such a link does not contain any IMU.

◆ getImu() [3/3]

XBot::ImuSensor::ConstPtr XBot::XBotInterface::getImu ( int  imu_id) const

Returns an IMU sensor given its sensor ID.

Parameters
imu_idSensor ID as given by ImuSensor::getSensorId(). If the sensor fixed joint is listed inside the joint id map, then the sensor id is the one specified inside such a file.
Returns
A shared pointer to the required IMU sensor. The returned pointer is null if the robot does not have an imu with the requested id.

◆ getImuInternal()

const std::map< std::string, XBot::ImuSensor::Ptr > & XBot::XBotInterface::getImuInternal ( ) const
protected

◆ getJointAcceleration() [1/3]

bool XBot::XBotInterface::getJointAcceleration ( Eigen::VectorXd &  qddot) const

Gets the robot joint accelerations as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
qddotA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getJointAcceleration() [2/3]

bool XBot::XBotInterface::getJointAcceleration ( JointIdMap qddot) const

Gets the robot joint accelerations as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
qddotA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getJointAcceleration() [3/3]

bool XBot::XBotInterface::getJointAcceleration ( JointNameMap qddot) const

Gets the robot joint accelerations as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
qddotA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getJointByDofIndex()

XBot::Joint::ConstPtr XBot::XBotInterface::getJointByDofIndex ( int  idx) const

Gets the joint with the required dof index.

This means that the idx-th entry of all Eigen vectors which are taken as arguments by XBotInterface methods refers to the returned joint.

Parameters
idxThe dof index of the required joint. Valid indices span from 0 to getJointNum()-1.
Returns
A const shared pointer to the required joint. A null pointer is returned if idx is not a valid index.

◆ getJointByDofIndexInternal()

XBot::Joint::Ptr XBot::XBotInterface::getJointByDofIndexInternal ( int  dof_index) const
protected

◆ getJointByID()

XBot::Joint::ConstPtr XBot::XBotInterface::getJointByID ( int  joint_id) const

Gets the joint with ID "joint_id" if it is defined as enabled.

Otherwise, a null pointer is returned and an error is printed to screen. Joint IDs are defined inside a YAML file which is specified in the config file which is used to initialize the interface.

Parameters
joint_idThe ID of the required joint.
Returns
A const shared pointer to the required joint. A null pointer is returned if a joint with the requested ID is not defined as enabled.

◆ getJointByIdInternal()

XBot::Joint::Ptr XBot::XBotInterface::getJointByIdInternal ( int  joint_id) const
protected

◆ getJointByName()

XBot::Joint::ConstPtr XBot::XBotInterface::getJointByName ( const std::string &  joint_name) const

Gets the joint with name "joint_name" if it is defined as enabled.

Otherwise, a null pointer is returned and an error is printed to screen.

Parameters
joint_nameThe name of the required joint.
Returns
A const shared pointer to the required joint. A null pointer is returned if joint_name is not defined as enabled.

◆ getJointByNameInternal()

XBot::Joint::Ptr XBot::XBotInterface::getJointByNameInternal ( const std::string &  joint_name) const
protected

◆ getJointEffort() [1/3]

bool XBot::XBotInterface::getJointEffort ( Eigen::VectorXd &  tau) const

Gets the robot joint efforts as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
tauA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getJointEffort() [2/3]

bool XBot::XBotInterface::getJointEffort ( JointIdMap tau) const

Gets the robot joint efforts as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
tauA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getJointEffort() [3/3]

bool XBot::XBotInterface::getJointEffort ( JointNameMap tau) const

Gets the robot joint efforts as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
tauA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getJointLimits()

void XBot::XBotInterface::getJointLimits ( Eigen::VectorXd &  q_min,
Eigen::VectorXd &  q_max 
) const

Gets a vector of the robot joint limits, as specified in the URDF file.

Parameters
q_minThe output vector of the chain joints lower limits.
q_maxThe output vector of the chain joints upper limits.
Returns
void

◆ getJointNum()

int XBot::XBotInterface::getJointNum ( ) const

Getter for the number of enabled joints.

Returns
The number of enabled joints.

◆ getJointPosition() [1/3]

bool XBot::XBotInterface::getJointPosition ( Eigen::VectorXd &  q) const

Gets the robot joint positions as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
qA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getJointPosition() [2/3]

bool XBot::XBotInterface::getJointPosition ( JointIdMap q) const

Gets the robot joint positions as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
qA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getJointPosition() [3/3]

bool XBot::XBotInterface::getJointPosition ( JointNameMap q) const

Gets the robot joint postions as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
qA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getJointVelocity() [1/3]

bool XBot::XBotInterface::getJointVelocity ( Eigen::VectorXd &  qdot) const

Gets the robot joint velocities as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
qdotA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getJointVelocity() [2/3]

bool XBot::XBotInterface::getJointVelocity ( JointIdMap qdot) const

Gets the robot joint velocities as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
qdotA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getJointVelocity() [3/3]

bool XBot::XBotInterface::getJointVelocity ( JointNameMap qdot) const

Gets the robot joint velocities as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
qdotA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getModelOrderedChainName()

const std::vector< std::string > & XBot::XBotInterface::getModelOrderedChainName ( ) const
protected

◆ getMotorPosition() [1/3]

bool XBot::XBotInterface::getMotorPosition ( Eigen::VectorXd &  q) const

Gets the robot motor positions as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
qA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getMotorPosition() [2/3]

bool XBot::XBotInterface::getMotorPosition ( JointIdMap q) const

Gets the robot motor positions as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
qA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getMotorPosition() [3/3]

bool XBot::XBotInterface::getMotorPosition ( JointNameMap q) const

Gets the robot motor postions as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
qA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getMotorVelocity() [1/3]

bool XBot::XBotInterface::getMotorVelocity ( Eigen::VectorXd &  qdot) const

Gets the robot motor velocities as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
qdotA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getMotorVelocity() [2/3]

bool XBot::XBotInterface::getMotorVelocity ( JointIdMap qdot) const

Gets the robot motor velocities as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
qdotA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getMotorVelocity() [3/3]

bool XBot::XBotInterface::getMotorVelocity ( JointNameMap qdot) const

Gets the robot motor velocities as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
qdotA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getPathToConfig()

const std::string & XBot::XBotInterface::getPathToConfig ( ) const

Gets the path to the YAML config file used to build the XBotInterface.

Returns
Path to config file.

◆ getPositionReference() [1/3]

bool XBot::XBotInterface::getPositionReference ( Eigen::VectorXd &  q) const

Gets the robot position references as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
qA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getPositionReference() [2/3]

bool XBot::XBotInterface::getPositionReference ( JointIdMap q) const

Gets the robot position references as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
qA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getPositionReference() [3/3]

bool XBot::XBotInterface::getPositionReference ( JointNameMap q) const

Gets the robot postion references as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
qA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getRobotState() [1/3]

bool XBot::XBotInterface::getRobotState ( const std::string &  state_name,
Eigen::VectorXd &  q 
) const

Gets the robot joints group state configuration as specified in the robot SRDF.

Parameters
state_nameThe name of the requested group state.
qThe chain joint configuration as Eigen vector of joint positions, This is an output parameter; any contents present in the vector will be overwritten in this function.
Returns
True if the state_name exists in the SRDF, false otherwise.

◆ getRobotState() [2/3]

bool XBot::XBotInterface::getRobotState ( const std::string &  state_name,
JointIdMap q 
) const

Gets the robot joints group state configuration as specified in the robot SRDF.

Parameters
state_nameThe name of the requested group state.
qThe robot joint configuration as a map with key representing the joint ID (i.e. numerical name of the joint) and value representing joint positions. This is an output parameter; it will not be cleared before being filled.
Returns
True if the state_name exists in the SRDF, false otherwise.

◆ getRobotState() [3/3]

bool XBot::XBotInterface::getRobotState ( const std::string &  state_name,
JointNameMap q 
) const

Gets the robot joints group state configuration as specified in the robot SRDF.

Parameters
state_nameThe name of the requested group state.
qThe robot joint configuration as a map with key representing the joint name and value representing joint positions. This is an output parameter; it will not be cleared before being filled.
Returns
True if the state_name exists in the SRDF, false otherwise.

◆ getSrdf()

const srdf_advr::Model & XBot::XBotInterface::getSrdf ( ) const

Getter fot the robot SRDF model corresponding to the SRDF xml file specified in the YAML config file.

Returns
A reference to const srdf_advd::Model

◆ getSrdfPath()

const std::string & XBot::XBotInterface::getSrdfPath ( ) const

getSrdfPath Getter for the path to the SRDF model

Returns
a reference to std::string

◆ getSrdfString()

const std::string & XBot::XBotInterface::getSrdfString ( ) const

Returns the robot SRDF xml as a string.

The SRDF file is specified inside the YAML config file.

Returns
A const reference to the required string.

◆ getStiffness() [1/3]

bool XBot::XBotInterface::getStiffness ( Eigen::VectorXd &  K) const

Gets the robot stiffness as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
KA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getStiffness() [2/3]

bool XBot::XBotInterface::getStiffness ( JointIdMap K) const

Gets the robot stiffness as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
KA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getStiffness() [3/3]

bool XBot::XBotInterface::getStiffness ( JointNameMap K) const

Gets the robot stiffness as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
KA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getTemperature() [1/3]

bool XBot::XBotInterface::getTemperature ( Eigen::VectorXd &  temp) const

Gets the robot joint temperatures as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
tempA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getTemperature() [2/3]

bool XBot::XBotInterface::getTemperature ( JointIdMap temp) const

Gets the robot joint temperatures as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
tempA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getTemperature() [3/3]

bool XBot::XBotInterface::getTemperature ( JointNameMap temp) const

Gets the robot joint temperatures as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
tempA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getUrdf()

const urdf::ModelInterface & XBot::XBotInterface::getUrdf ( ) const

Getter for the robot URDF model corresponding to the URDF xml file specified in the YAML config file.

Returns
A reference to const urdf::ModelInterface

◆ getUrdfPath()

const std::string & XBot::XBotInterface::getUrdfPath ( ) const

getUrdfPath Getter for the path to the URDF model

Returns
a reference to std::string

◆ getUrdfString()

const std::string & XBot::XBotInterface::getUrdfString ( ) const

Returns the robot URDF xml as a string.

The URDF file is specified inside the YAML config file.

Returns
A const reference to the required string.

◆ getVelocityLimits()

void XBot::XBotInterface::getVelocityLimits ( Eigen::VectorXd &  qdot_max) const

Gets a vector of the robot joint velocity limits, as specified in the URDF file.

Parameters
qdot_maxThe output vector of the chain joints velocity limits
Returns
void

◆ getVelocityReference() [1/3]

bool XBot::XBotInterface::getVelocityReference ( Eigen::VectorXd &  qdot) const

Gets the robot velocity references as an Eigen vector.

The joint order inside the vector can be queried by calling the getEnabledJointNames/getEnabledJointId methods.

Parameters
qdotA reference to an Eigen vector to be filled with the requested joint state. If the provided vector has wrong size it is resized automatically.
Returns
bool

◆ getVelocityReference() [2/3]

bool XBot::XBotInterface::getVelocityReference ( JointIdMap qdot) const

Gets the robot velocity references as a JointIdMap, i.e.

a map whose key represents the joint ID and whose value represents the required joint state.

Parameters
qdotA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ getVelocityReference() [3/3]

bool XBot::XBotInterface::getVelocityReference ( JointNameMap qdot) const

Gets the robot velocity references as a JointNameMap, i.e.

a map whose key represents the joint human-readable name and whose value represents the required joint state.

Parameters
qdotA reference to a JointIdMap to be filled with the requested joint state. It is the user responsibility to clear the map before it is filled (if required).
Returns
bool

◆ hasChain()

bool XBot::XBotInterface::hasChain ( const std::string &  chain_name) const

A method for determining if a chain with name "chain_name" is defined inside the interface.

Parameters
chain_nameThe name of the chain whose existence has to be checked.
Returns
True if the required chain exists.

◆ hasJoint() [1/2]

bool XBot::XBotInterface::hasJoint ( const std::string &  joint_name) const

Checks that a joint with name "joint_name" is defined as an enabled joint inside the interface.

Parameters
joint_nameThe name of the joint we want to check existence for.
Returns
True if the required joint is defined and enabled.

◆ hasJoint() [2/2]

bool XBot::XBotInterface::hasJoint ( int  joint_id) const

Checks that a joint with ID "joint_id" is defined as an enabled joint inside the interface.

Parameters
joint_idThe ID of the joint we want to check existence for.
Returns
True if the required joint is defined and enabled.

◆ init() [1/2]

bool XBot::XBotInterface::init ( const ConfigOptions options)

◆ init() [2/2]

bool XBot::XBotInterface::init ( const std::string &  path_to_cfg)

◆ init_internal()

virtual bool XBot::XBotInterface::init_internal ( const ConfigOptions config)
inlineprotectedvirtual

Reimplemented in XBot::ModelInterface.

◆ initLog()

void XBot::XBotInterface::initLog ( MatLogger2::Ptr  logger,
int  buffer_size = -1,
int  interleave = 1,
std::string  prefix = "" 
)

Pre-allocates memory for logging the robot state to a mat file.

Parameters
loggerShared pointer to MatLogger where logging data has to be saved.
buffer_sizeThe number of log elements after which old data are overwritten.
interleaveData are actually logged every interleave calls to log().
prefixPrefix which will be preponed to all logged variables (empty by default).

◆ legs()

int XBot::XBotInterface::legs ( ) const

Returns the number of legs defined inside the interface.

This equals the number of elements of the "legs" group inside the SRDF which was provided in the YAML config file.

Returns
The number of defined legs.

◆ log()

void XBot::XBotInterface::log ( MatLogger2::Ptr  logger,
double  timestamp,
const std::string &  prefix = "" 
) const

Logs the current robot state.

Parameters
loggerShared pointer to MatLogger where logging data has to be saved.
timestampTime stamp for current robot state.
prefixPrefix which will be preponed to all logged variables (empty by default).
Returns
void

◆ mapToEigen() [1/2]

bool XBot::XBotInterface::mapToEigen ( const JointIdMap map,
Eigen::VectorXd &  vector 
) const

Converts a state vector for an arbitrary subset of the robot state (specified as a JointIdMap) to its Eigen representation.

Note that the output vector is resized and set to zero if its size does not match the number of joints. Otherwise, unspecified components are left untouched.

Parameters
mapA JointIdMap contaning the state of the robot (or a part of it)
vectorThe output vector to be filled.
Returns
True if the input map contains valid joints.

◆ mapToEigen() [2/2]

bool XBot::XBotInterface::mapToEigen ( const JointNameMap map,
Eigen::VectorXd &  vector 
) const

Converts a state vector for an arbitrary subset of the robot state (specified as a JointNameMap) to its Eigen representation.

Note that the output vector is resized and set to zero if its size does not match the number of joints. Otherwise, unspecified components are left untouched.

Parameters
mapA JointNameMap contaning the state of the robot (or a part of it)
vectorThe output vector to be filled.
Returns
True if the input map contains valid joints.

◆ operator=()

XBot::XBotInterface & XBot::XBotInterface::operator= ( const XBotInterface rhs)

◆ post_init()

virtual bool XBot::XBotInterface::post_init ( )
inlineprotectedvirtual

Reimplemented in XBot::RobotInterface.

◆ print()

void XBot::XBotInterface::print ( ) const

Print a pretty table about the robot state.

Returns
void

◆ printTracking()

void XBot::XBotInterface::printTracking ( ) const

Print a pretty table about the robot tracking.

Returns
void

◆ setDamping() [1/3]

bool XBot::XBotInterface::setDamping ( const Eigen::VectorXd &  D)

Sets the XBotInterface internal joint damping according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
DThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setDamping() [2/3]

bool XBot::XBotInterface::setDamping ( const JointIdMap D)

Sets the XBotInterface internal joint damping according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
KThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setDamping() [3/3]

bool XBot::XBotInterface::setDamping ( const JointNameMap D)

Sets the XBotInterface internal joint damping according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
DThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setEffortReference() [1/3]

bool XBot::XBotInterface::setEffortReference ( const Eigen::VectorXd &  tau)

Sets the XBotInterface internal joint effort references according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
tauThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setEffortReference() [2/3]

bool XBot::XBotInterface::setEffortReference ( const JointIdMap tau)

Sets the XBotInterface internal joint effort references according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
tauThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setEffortReference() [3/3]

bool XBot::XBotInterface::setEffortReference ( const JointNameMap tau)

Sets the XBotInterface internal joint effort references according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
tauThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setJointAcceleration() [1/3]

bool XBot::XBotInterface::setJointAcceleration ( const Eigen::VectorXd &  qddot)

Sets the XBotInterface internal joint accelerations according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
qddotThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setJointAcceleration() [2/3]

bool XBot::XBotInterface::setJointAcceleration ( const JointIdMap qddot)

Sets the XBotInterface internal joint accelerations according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qddotThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setJointAcceleration() [3/3]

bool XBot::XBotInterface::setJointAcceleration ( const JointNameMap qddot)

Sets the XBotInterface internal joint accelerations according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qddotThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setJointEffort() [1/3]

bool XBot::XBotInterface::setJointEffort ( const Eigen::VectorXd &  tau)

Sets the XBotInterface internal joint efforts according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
tauThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setJointEffort() [2/3]

bool XBot::XBotInterface::setJointEffort ( const JointIdMap tau)

Sets the XBotInterface internal joint efforts according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
tauThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setJointEffort() [3/3]

bool XBot::XBotInterface::setJointEffort ( const JointNameMap tau)

Sets the XBotInterface internal joint efforts according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
tauThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setJointPosition() [1/3]

bool XBot::XBotInterface::setJointPosition ( const Eigen::VectorXd &  q)

Sets the XBotInterface internal joint positions according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
qThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setJointPosition() [2/3]

bool XBot::XBotInterface::setJointPosition ( const JointIdMap q)

Sets the XBotInterface internal joint positions according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setJointPosition() [3/3]

bool XBot::XBotInterface::setJointPosition ( const JointNameMap q)

Sets the XBotInterface internal joint positions according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setJointVelocity() [1/3]

bool XBot::XBotInterface::setJointVelocity ( const Eigen::VectorXd &  qdot)

Sets the XBotInterface internal joint velocities according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
qdotThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setJointVelocity() [2/3]

bool XBot::XBotInterface::setJointVelocity ( const JointIdMap qdot)

Sets the XBotInterface internal joint velocities according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qdotThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setJointVelocity() [3/3]

bool XBot::XBotInterface::setJointVelocity ( const JointNameMap qdot)

Sets the XBotInterface internal joint velocities according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qdotThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setMotorPosition() [1/3]

bool XBot::XBotInterface::setMotorPosition ( const Eigen::VectorXd &  q)

Sets the XBotInterface internal motor positions according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
qThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setMotorPosition() [2/3]

bool XBot::XBotInterface::setMotorPosition ( const JointIdMap q)

Sets the XBotInterface internal motor positions according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setMotorPosition() [3/3]

bool XBot::XBotInterface::setMotorPosition ( const JointNameMap q)

Sets the XBotInterface internal motor positions according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setMotorVelocity() [1/3]

bool XBot::XBotInterface::setMotorVelocity ( const Eigen::VectorXd &  qdot)

Sets the XBotInterface internal motor velocities according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
qdotThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setMotorVelocity() [2/3]

bool XBot::XBotInterface::setMotorVelocity ( const JointIdMap qdot)

Sets the XBotInterface internal motor velocities according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qdotThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setMotorVelocity() [3/3]

bool XBot::XBotInterface::setMotorVelocity ( const JointNameMap qdot)

Sets the XBotInterface internal motor velocities according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qdotThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setPositionReference() [1/3]

bool XBot::XBotInterface::setPositionReference ( const Eigen::VectorXd &  q)

Sets the XBotInterface internal joint position references according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
qThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setPositionReference() [2/3]

bool XBot::XBotInterface::setPositionReference ( const JointIdMap q)

Sets the XBotInterface internal joint position references according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setPositionReference() [3/3]

bool XBot::XBotInterface::setPositionReference ( const JointNameMap q)

Sets the XBotInterface internal joint position references according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setStiffness() [1/3]

bool XBot::XBotInterface::setStiffness ( const Eigen::VectorXd &  K)

Sets the XBotInterface internal joint stiffness according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
KThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setStiffness() [2/3]

bool XBot::XBotInterface::setStiffness ( const JointIdMap K)

Sets the XBotInterface internal joint stiffness according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
KThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setStiffness() [3/3]

bool XBot::XBotInterface::setStiffness ( const JointNameMap K)

Sets the XBotInterface internal joint stiffness according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
KThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setTemperature() [1/3]

bool XBot::XBotInterface::setTemperature ( const Eigen::VectorXd &  temp)

Sets the XBotInterface internal joint temperatures according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
tempThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setTemperature() [2/3]

bool XBot::XBotInterface::setTemperature ( const JointIdMap temp)

Sets the XBotInterface internal motor temperatures according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
tempThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setTemperature() [3/3]

bool XBot::XBotInterface::setTemperature ( const JointNameMap temp)

Sets the XBotInterface internal joint temperatures according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
tempThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setVelocityReference() [1/3]

bool XBot::XBotInterface::setVelocityReference ( const Eigen::VectorXd &  qdot)

Sets the XBotInterface internal joint velocity references according to the provided vector, which must be ordered as specified by the getEnabledJointNames/getEnabledJointId methods.

Parameters
qdotThe vector of input joint states.
Returns
True if the size of the provided vector matches getJointNum().

◆ setVelocityReference() [2/3]

bool XBot::XBotInterface::setVelocityReference ( const JointIdMap qdot)

Sets the XBotInterface internal joint velocity references according to the input JointIdMap (i.e.

a map whose key represents the joint ID and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qdotThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ setVelocityReference() [3/3]

bool XBot::XBotInterface::setVelocityReference ( const JointNameMap qdot)

Sets the XBotInterface internal joint velocity references according to the input JointNameMap (i.e.

a map whose key represents the joint name and whose value represents the joint state), which can include joint states for an arbitrary subset of the whole robot.

Parameters
qdotThe input JointIdMap
Returns
True if all joint IDs inside the provided map are valid.

◆ sync()

template<typename... SyncFlags>
bool XBot::XBotInterface::sync ( const XBotInterface other,
SyncFlags...  flags 
)

Synchronize the current XBotInterface with another XBotInterface object: only the common chains will be taken into account.

Parameters
flags...
otherThe XBotInterface object from which we synchronize the current object
Returns
Always true because we support synchronization btw XBotInterfaces with different chains.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const XBot::XBotInterface robot 
)
friend

Member Data Documentation

◆ _chain_map

std::map<std::string, XBot::KinematicChain::Ptr> XBot::XBotInterface::_chain_map
protected

◆ _ft_id_map

std::map<int, ForceTorqueSensor::Ptr> XBot::XBotInterface::_ft_id_map
protected

◆ _ft_map

std::map<std::string, ForceTorqueSensor::Ptr> XBot::XBotInterface::_ft_map
protected

◆ _hand_id_map

std::map<int, Hand::Ptr> XBot::XBotInterface::_hand_id_map
protected

◆ _hand_map

std::map<std::string, Hand::Ptr> XBot::XBotInterface::_hand_map
protected

◆ _imu_id_map

std::map<int, ImuSensor::Ptr> XBot::XBotInterface::_imu_id_map
protected

◆ _imu_map

std::map<std::string, ImuSensor::Ptr> XBot::XBotInterface::_imu_map
protected

◆ _joint_id_to_eigen_id

std::map<int, int> XBot::XBotInterface::_joint_id_to_eigen_id
protected

◆ _joint_name_to_eigen_id

std::map<std::string, int> XBot::XBotInterface::_joint_name_to_eigen_id
protected

◆ _joint_vector

std::vector<Joint::Ptr> XBot::XBotInterface::_joint_vector
protected

◆ _ordered_chain_names

std::vector<std::string> XBot::XBotInterface::_ordered_chain_names
protected

◆ _ordered_joint_vector

std::vector<Joint::Ptr> XBot::XBotInterface::_ordered_joint_vector
protected

◆ _XBotModel

XBotCoreModel XBot::XBotInterface::_XBotModel
protected

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