ROSEndEffector
ROS End-Effector package: provides a ROS-based set of standard interfaces to command robotics end-effectors in an agnostic fashion.
Public Types | Public Member Functions | Private Attributes | List of all members
ROSEE::EEInterface Class Reference

Class representing and End-Effector. More...

#include <EEInterface.h>

+ Collaboration diagram for ROSEE::EEInterface:

Public Types

typedef std::shared_ptr< EEInterfacePtr
 
typedef std::shared_ptr< const EEInterfaceConstPtr
 

Public Member Functions

 EEInterface (const ROSEE::Parser &p)
 
virtual ~EEInterface ()
 
const std::vector< std::string > & getFingers ()
 getter for the fingers name in the current End-Effector More...
 
bool isFinger (std::string finger_name)
 check is the requested finger exists More...
 
const std::vector< std::string > & getActuatedJoints ()
 getter for the actuated joints of the end-effector More...
 
bool getActuatedJointsInFinger (std::string finger_name, std::vector< std::string > &actuated_joints)
 getter for the actuated joints of a finger More...
 
int getActuatedJointsNum ()
 getter for the number of actuated joints in the end-effector More...
 
int getActuatedJointsNumInFinger (std::string finger_name)
 getter for the number of actuated joints in the requested finger More...
 
Eigen::VectorXd getUpperPositionLimits ()
 getter for the upper position limits of EE joints as specified in the URDF More...
 
Eigen::VectorXd getLowerPositionLimits ()
 getter for the lower position limits of EE joints as specified in the URDF More...
 
bool getInternalIdsForFinger (std::string finger_name, std::vector< int > &internal_ids)
 getter for the internal ids (position in the EEInterface vectors) of joints in a certain finger More...
 
bool getInternalIdForJoint (std::string joint_name, int &internal_id)
 getter for the internal id of a certain joint More...
 
int getFingersNumber ()
 getter for the number of fingers in the End-Effector More...
 
std::string getName ()
 getter for the EE name More...
 

Private Attributes

std::map< std::string, std::vector< std::string > > _ee_description
 
std::map< std::string, urdf::JointConstSharedPtr > _urdf_joint_map
 
std::map< std::string, std::vector< int > > _finger_joints_internal_id_map
 
std::map< std::string, int > _joints_internal_id_map
 
std::vector< std::string > _fingers_names
 
std::vector< std::string > _actuated_joints
 
Eigen::VectorXd _upper_limits
 
Eigen::VectorXd _lower_limits
 
std::string _ee_name
 
int _joints_num = 0
 

Detailed Description

Class representing and End-Effector.

Definition at line 36 of file EEInterface.h.

Member Typedef Documentation

typedef std::shared_ptr<const EEInterface> ROSEE::EEInterface::ConstPtr

Definition at line 41 of file EEInterface.h.

typedef std::shared_ptr<EEInterface> ROSEE::EEInterface::Ptr

Definition at line 40 of file EEInterface.h.

Constructor & Destructor Documentation

ROSEE::EEInterface::EEInterface ( const ROSEE::Parser p)

Definition at line 20 of file EEInterface.cpp.

20  {
21 
22  // get number of joints from parse and resize dynamic structure
24  _upper_limits.resize(_joints_num);
25  _lower_limits.resize(_joints_num);
26 
27  // get the EE name
29 
30  // get the ee description
32 
33  // get he joints urdf description
35 
36  int id = 0;
37 
38  // save the finger names
39  for( const auto& finger_joints_pair : _ee_description ) {
40 
41  // fingers
42  std::string finger_name = finger_joints_pair.first;
43  _fingers_names.push_back(finger_name);
44 
45  for( const auto& j : finger_joints_pair.second ) {
46 
47  // joint name
48  _actuated_joints.push_back(j);
49 
50  // internal id
52 
53  // finger internal id map
54  _finger_joints_internal_id_map[finger_name].push_back(id);
55 
56  // upper limits
57  _upper_limits[id] = _urdf_joint_map.at(j)->limits->upper;
58 
59  // lower limits
60  _lower_limits[id] = _urdf_joint_map.at(j)->limits->lower;
61 
62  // increase internal id
63  id++;
64  }
65  }
66 
67 }
int getActuatedJointsNumber() const
getter for the total number of actuated joints in the configuration files
Definition: Parser.cpp:420
std::vector< std::string > _fingers_names
Definition: EEInterface.h:149
std::vector< std::string > _actuated_joints
Definition: EEInterface.h:149
std::map< std::string, int > _joints_internal_id_map
Definition: EEInterface.h:147
std::string _ee_name
Definition: EEInterface.h:153
std::map< std::string, std::vector< std::string > > _ee_description
Definition: EEInterface.h:142
std::string getEndEffectorName() const
getter for the configure End-Effector name
Definition: Parser.cpp:450
std::map< std::string, urdf::JointConstSharedPtr > _urdf_joint_map
Definition: EEInterface.h:143
std::map< std::string, urdf::JointConstSharedPtr > getUrdfJointMap() const
getter for the URDF information of the joints of the End-Effector
Definition: Parser.cpp:435
Eigen::VectorXd _lower_limits
Definition: EEInterface.h:151
Eigen::VectorXd _upper_limits
Definition: EEInterface.h:151
std::map< std::string, std::vector< std::string > > getFingerJointMap() const
getter for a description of the End-Effector as a map of finger name, finger joint names...
Definition: Parser.cpp:425
std::map< std::string, std::vector< int > > _finger_joints_internal_id_map
Definition: EEInterface.h:145
ROSEE::EEInterface::~EEInterface ( )
virtual

Definition at line 160 of file EEInterface.cpp.

160  {
161 
162 }

Member Function Documentation

const std::vector< std::string > & ROSEE::EEInterface::getActuatedJoints ( )

getter for the actuated joints of the end-effector

Returns
const std::vector< std::string >& the actuated joint in the End-Effector as a vector of String

Definition at line 122 of file EEInterface.cpp.

122  {
123 
124  return _actuated_joints;
125 }
std::vector< std::string > _actuated_joints
Definition: EEInterface.h:149
bool ROSEE::EEInterface::getActuatedJointsInFinger ( std::string  finger_name,
std::vector< std::string > &  actuated_joints 
)

getter for the actuated joints of a finger

Parameters
finger_namethe name of the finger where to retrieve actuated joints
actuated_joints[out] will be filled with the actuated joints of the finger
Returns
bool true if the requested finger exists, false otherwise

Definition at line 128 of file EEInterface.cpp.

128  {
129 
130  if( !isFinger(finger_name) ) {
131 
132  return false;
133  }
134 
135  actuated_joints = _ee_description.at(finger_name);
136  return true;
137 }
std::map< std::string, std::vector< std::string > > _ee_description
Definition: EEInterface.h:142
bool isFinger(std::string finger_name)
check is the requested finger exists
int ROSEE::EEInterface::getActuatedJointsNum ( )

getter for the number of actuated joints in the end-effector

Returns
int the number of actuated joints in the end effector

Definition at line 139 of file EEInterface.cpp.

139  {
140 
141  return _joints_num;
142 }
int ROSEE::EEInterface::getActuatedJointsNumInFinger ( std::string  finger_name)

getter for the number of actuated joints in the requested finger

Parameters
finger_namethe name of the finger where to retrieve the number of actuated joints
Returns
int the number of actuated joints in finger_name, or -1 if the finger does not exists

Definition at line 144 of file EEInterface.cpp.

144  {
145 
146  if( !isFinger(finger_name) ) {
147 
148  return -1;
149  }
150 
151  return _ee_description.at(finger_name).size();
152 }
std::map< std::string, std::vector< std::string > > _ee_description
Definition: EEInterface.h:142
bool isFinger(std::string finger_name)
check is the requested finger exists
const std::vector< std::string > & ROSEE::EEInterface::getFingers ( )

getter for the fingers name in the current End-Effector

Returns
std::vector<std::string>& existing finger names in the End-Effector

Definition at line 110 of file EEInterface.cpp.

110  {
111 
112  return _fingers_names;
113 }
std::vector< std::string > _fingers_names
Definition: EEInterface.h:149
int ROSEE::EEInterface::getFingersNumber ( )

getter for the number of fingers in the End-Effector

Returns
int the number of fingers in the End-Effector

Definition at line 154 of file EEInterface.cpp.

154  {
155 
156  return _fingers_names.size();
157 }
std::vector< std::string > _fingers_names
Definition: EEInterface.h:149
bool ROSEE::EEInterface::getInternalIdForJoint ( std::string  joint_name,
int &  internal_id 
)

getter for the internal id of a certain joint

Parameters
joint_namethe name of the requested joint
internal_idthe internal id of the requested joint
Returns
bool true if the joint exists, false otherwise

Definition at line 85 of file EEInterface.cpp.

85  {
86 
87  if ( _joints_internal_id_map.count(joint_name) ) {
88 
89  internal_id = _joints_internal_id_map.at(joint_name);
90  return true;
91  }
92 
93  return false;
94 
95 }
std::map< std::string, int > _joints_internal_id_map
Definition: EEInterface.h:147
bool ROSEE::EEInterface::getInternalIdsForFinger ( std::string  finger_name,
std::vector< int > &  internal_ids 
)

getter for the internal ids (position in the EEInterface vectors) of joints in a certain finger

Parameters
finger_namethe name of the requested finger
internal_idsthe internal ids of the joints in the requested finger
Returns
bool true if the finger exists, false otherwise

Definition at line 98 of file EEInterface.cpp.

98  {
99 
100  if ( _finger_joints_internal_id_map.count(finger_name) ) {
101 
102  internal_ids = _finger_joints_internal_id_map.at(finger_name);
103  return true;
104  }
105 
106  return false;
107 
108 }
std::map< std::string, std::vector< int > > _finger_joints_internal_id_map
Definition: EEInterface.h:145
Eigen::VectorXd ROSEE::EEInterface::getLowerPositionLimits ( )

getter for the lower position limits of EE joints as specified in the URDF

Returns
Eigen::VectorXd the lower position limits of EE joints as specified in the URDF

Definition at line 75 of file EEInterface.cpp.

75  {
76 
77  return _lower_limits;
78 }
Eigen::VectorXd _lower_limits
Definition: EEInterface.h:151
std::string ROSEE::EEInterface::getName ( )

getter for the EE name

Returns
std::string the EE name parsed from the given config files of the EE

Definition at line 69 of file EEInterface.cpp.

69  {
70 
71  return _ee_name;
72 }
std::string _ee_name
Definition: EEInterface.h:153
Eigen::VectorXd ROSEE::EEInterface::getUpperPositionLimits ( )

getter for the upper position limits of EE joints as specified in the URDF

Returns
Eigen::VectorXd the upper position limits of EE joints as specified in the URDF

Definition at line 80 of file EEInterface.cpp.

80  {
81 
82  return _upper_limits;
83 }
Eigen::VectorXd _upper_limits
Definition: EEInterface.h:151
bool ROSEE::EEInterface::isFinger ( std::string  finger_name)

check is the requested finger exists

Parameters
finger_namename of the finger to check
Returns
true if the finger exists, false otherwise

Definition at line 115 of file EEInterface.cpp.

115  {
116 
117  return ( _ee_description.count(finger_name) > 0 );
118 }
std::map< std::string, std::vector< std::string > > _ee_description
Definition: EEInterface.h:142

Member Data Documentation

std::vector<std::string> ROSEE::EEInterface::_actuated_joints
private

Definition at line 149 of file EEInterface.h.

std::map<std::string, std::vector<std::string> > ROSEE::EEInterface::_ee_description
private

Definition at line 142 of file EEInterface.h.

std::string ROSEE::EEInterface::_ee_name
private

Definition at line 153 of file EEInterface.h.

std::map<std::string, std::vector<int> > ROSEE::EEInterface::_finger_joints_internal_id_map
private

Definition at line 145 of file EEInterface.h.

std::vector<std::string> ROSEE::EEInterface::_fingers_names
private

Definition at line 149 of file EEInterface.h.

std::map<std::string, int> ROSEE::EEInterface::_joints_internal_id_map
private

Definition at line 147 of file EEInterface.h.

int ROSEE::EEInterface::_joints_num = 0
private

Definition at line 155 of file EEInterface.h.

Eigen::VectorXd ROSEE::EEInterface::_lower_limits
private

Definition at line 151 of file EEInterface.h.

Eigen::VectorXd ROSEE::EEInterface::_upper_limits
private

Definition at line 151 of file EEInterface.h.

std::map<std::string, urdf::JointConstSharedPtr> ROSEE::EEInterface::_urdf_joint_map
private

Definition at line 143 of file EEInterface.h.


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