20 #define CHAIN_PER_GROUP 1 34 std::string finger_name
40 _finger_joint_map.insert(std::make_pair(finger_name, std::vector<std::string>()));
47 for (
int i = 0; i < segments_num; i++ ) {
52 bool is_valid_joint =
false;
55 is_valid_joint = actual_joint.
getTypeName() ==
"RotAxis";
60 bool is_mimic_joint = (urdf_joint->mimic ==
nullptr) ?
false :
true;
64 if ( is_valid_joint && (!is_mimic_joint) ) {
78 ROS_ERROR_STREAM (
"chain from base_link " << base_link <<
" to tip_link " << tip_link <<
" not found in the URDF" );
95 if ( srdf_end_effectors.size() != 1 ) {
100 ROS_INFO_STREAM (
"ros_end_effector Parser found end_effector: " << srdf_end_effectors.at ( 0 ).name_ );
109 int group_num = srdf_groups.size();
111 std::string end_effector_group_name = srdf_end_effectors.at ( 0 ).component_group_;
112 for (
int i = 0; i < group_num; i++ ) {
113 if ( srdf_groups[i].name_ == end_effector_group_name ) {
114 fingers_group = srdf_groups[i];
115 ROS_INFO_STREAM (
"ros_end_effector Parser found group: " << end_effector_group_name <<
" in the SRDF with the following fingers: " );
129 for (
int j = 0; j < group_num; j++ ) {
144 ROS_ERROR_STREAM (
"for the finger chain groups you can specify only one chain per group in your SRDF check " <<
145 current_finger_group.
name_.c_str() <<
" group" );
151 current_finger_group.
chains_[0].second,
152 current_finger_group.
name_ 164 std::stringstream buffer_srdf;
165 buffer_srdf << t_srdf.rdbuf();
176 if (it.second->mimic ==
nullptr) {
178 if (it.second->type == urdf::Joint::CONTINUOUS ||
179 it.second->type == urdf::Joint::REVOLUTE ) {
200 for (
auto passiveJoint : passiveJointList) {
211 if (it->compare(passiveJoint.name_) == 0 ) {
228 std::fstream xml_file (
_urdf_path.c_str(), std::fstream::in );
229 if ( xml_file.is_open() ) {
231 while ( xml_file.good() ) {
234 std::getline ( xml_file, line );
235 xml_string += ( line +
"\n" );
250 std::stringstream buffer_urdf;
251 buffer_urdf << t_urdf.rdbuf();
375 ROS_ERROR_STREAM (
"in " << __func__ <<
" : '_urdf_path' and/or '_srdf_path' and/or 'actions_folder_path' not found on ROS parameter server" );
380 bool ROSEE::Parser::init (
const std::string& urdf_path,
const std::string& srdf_path,
const std::string& action_path ) {
399 int nJointInFinger = chain_joints.second.size();
401 if ( nJointInFinger == 0 ) {
407 for (
int i = 0; i < nJointInFinger ; i++ ) {
416 ROS_ERROR_STREAM (
"in " << __func__ <<
" : ROSEE::Parser needs to be initialized. Call init() frist." );
std::vector< std::string > subgroups_
const std::vector< PassiveJoint > & getPassiveJoints() const
KDL_PARSER_PUBLIC bool treeFromUrdfModel(const urdf::ModelInterface &robot_model, KDL::Tree &tree)
std::vector< std::pair< std::string, std::string > > chains_
bool initFile(const urdf::ModelInterface &urdf_model, const std::string &filename)
std::vector< int > _fingers_group_id
unsigned int getNrOfSegments() const
bool configure()
configure the ROSEE parser based on the configration files requested
std::map< std::string, std::string > _joint_finger_map
const Segment & getSegment(unsigned int nr) const
bool init()
Initialization function using the ROS param ROSEEConfigPath.
urdf::ModelInterfaceSharedPtr _urdf_model
const std::string getTypeName() const
const Joint & getJoint() const
std::string getEndEffectorName() const
getter for the configure End-Effector name
bool removePassiveJoints()
Function to remove the passive joints from the filled maps.
std::string getUrdfString() const
get the whole urdf file parsed as a string
std::map< std::string, std::vector< std::string > > _finger_joint_map
bool parseSRDF()
Function responsible to parse the SRDF data.
bool getParam(const std::string &key, std::string &s) const
int getActuatedJointsNumber() const
getter for the total number of actuated joints in the configuration files
void addNotInFingerJoints()
bool getChain(const std::string &chain_root, const std::string &chain_tip, Chain &chain) const
void printEndEffectorFingerJointsMap() const
Utility to print the mapping between the End Effector finger chains and the related actuated joints...
def xml_string(rootXml, addHeader=True)
std::string getActionPath() const
get the path where emit and parse grasping actions
Parser(const ros::NodeHandle &nh)
const std::vector< Group > & getGroups() const
std::map< std::string, urdf::JointConstSharedPtr > getUrdfJointMap() const
getter for the URDF information of the joints of the End-Effector
bool parseURDF()
Function responsible to get the file needed to fill the internal data structure of the Parser with da...
std::map< std::string, std::string > getJointFingerMap() const
getter for a description of the End-Effector as a map of joint name, finger name
#define ROS_INFO_STREAM(args)
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...
std::vector< std::string > _fingers_names
const std::string & getName() const
const std::vector< EndEffector > & getEndEffectors() const
std::map< std::string, urdf::JointConstSharedPtr > _urdf_joint_map
bool getJointsInFinger(std::string base_link, std::string tip_link, std::string finger_name)
fill a data structure related with the revolute/prismatic joints included in between base_link and ti...
#define ROS_ERROR_STREAM(args)
std::string getSrdfString() const
get the whole srdf file parsed as a string