ROSEndEffector
ROS End-Effector package: provides a ROS-based set of standard interfaces to command robotics end-effectors in an agnostic fashion.
|
class to parse urdf and srdf with moveit classes and to give information about the model parsed More...
#include <ParserMoveIt.h>
Public Types | |
typedef std::shared_ptr< ParserMoveIt > | Ptr |
typedef std::shared_ptr< const ParserMoveIt > | ConstPtr |
Public Member Functions | |
ParserMoveIt () | |
~ParserMoveIt () | |
bool | init (std::string robot_description, bool verbose=true) |
Init the parser, fill the structures. More... | |
std::string | getHandName () const |
unsigned int | getNFingers () const |
std::vector< std::string > | getFingertipNames () const |
std::vector< std::string > | getActiveJointNames () const |
getter for all active (actuated) joints' names. More... | |
std::vector< const moveit::core::JointModel * > | getActiveJointModels () const |
getter for all active (actuated) joints. More... | |
std::vector< std::string > | getPassiveJointNames () const |
getter for all the passive joints (defined in this way in the srdf file) Not all the not-actuated joint are passive (a mimic joint can also be not defined as passive in srdf) More... | |
std::map< std::string, std::vector< const moveit::core::LinkModel * > > | getDescendantLinksOfJoint () const |
getter for descendandsLinksOfJoint. More... | |
std::map< std::string, std::vector< const moveit::core::JointModel * > > | getDescendantJointsOfJoint () const |
getter for descendandsJointsOfJoint. More... | |
const robot_model::RobotModelPtr | getRobotModel () const |
the robot model can't be modified, if you want it to modify, use getCopyModel to get a copy. More... | |
std::map< std::string, std::vector< std::string > > | getFingertipsOfJointMap () const |
std::map< std::string, std::vector< std::string > > | getJointsOfFingertipMap () const |
std::map< std::string, std::string > | getFingerOfFingertipMap () const |
std::map< std::string, std::string > | getFingertipOfFingerMap () const |
std::string | getFingerOfFingertip (std::string tipName) const |
This function returns the name of the finger which the passed tipName belongs to. More... | |
std::string | getFingertipOfFinger (std::string fingerName) const |
This function returns the name of the fingertip that belongs to the passed fingerName . More... | |
robot_model::RobotModelPtr | getCopyModel () const |
This function reload another model, same as the one loaded in init but this one can be modified externally, because it will not affect the internal structures of this class. More... | |
std::vector< std::string > | getGroupOfLink (std::string linkName) |
This function explores all groups of srdf and says to which ones the linkName belongs to. More... | |
bool | groupIsChain (const std::string groupName) const |
check if a group (defined in srdf file) is a chain. More... | |
bool | groupIsChain (const moveit::core::JointModelGroup *group) const |
check if a group (defined in srdf file) is a chain. More... | |
bool | checkIfContinuosJoint (const std::string jointName) const |
check if the passed joint is continuos (i.e. More... | |
bool | checkIfContinuosJoint (const moveit::core::JointModel *joint) const |
check if the passed joint is continuos (i.e. More... | |
std::vector< double > | getBiggerBoundFromZero (std::string jointName) const |
For each DOF of a joint, find the limit which is farther from 0 position. More... | |
std::vector< double > | getBiggerBoundFromZero (const moveit::core::JointModel *joint) const |
For each DOF of a joint, find the limit which is farther from 0 position. More... | |
std::vector< double > | getSmallerBoundFromZero (std::string jointName) const |
For each DOF of a joint, find the limit which is nearer from 0 position. More... | |
std::vector< double > | getSmallerBoundFromZero (const moveit::core::JointModel *joint) const |
For each DOF of a joint, find the limit which is nearer from 0 position. More... | |
unsigned int | getNExclusiveJointsOfTip (std::string tipName, bool continuosIncluded) const |
Given a fingertip link, this function return the number of the joint that affect only the position of this fingertip and not any other fingertips (obviously the joints can affect different other links that are not fingertips (e.g. More... | |
std::string | getFirstActuatedParentJoint (std::string linkName, bool includeContinuos) const |
starting from the given link, we explore the parents joint, until we found the first actuated. More... | |
std::string | getFirstActuatedJointInFinger (std::string linkName) const |
Given the linkName, this function returns the actuated joint that is a parent of this link and it is the first joint of the chain which the link belongs to. More... | |
void | parseNonLinearMimicRelations (std::string xml) |
std::pair< std::string, std::string > | getMimicNLFatherOfJoint (std::string mimicNLJointName) const |
gets for the maps of non linear mimic joints More... | |
std::map< std::string, std::pair< std::string, std::string > > | getMimicNLFatherOfJointMap () const |
std::string | getMimicNLJointOfFather (std::string mimicNLFatherName, std::string mimicNLJointName) const |
std::map< std::string, std::string > | getMimicNLJointsOfFather (std::string mimicNLFatherName) const |
std::map< std::string, std::map< std::string, std::string > > | getMimicNLJointsOfFatherMap () const |
Private Member Functions | |
void | lookForFingertips (bool verbose=true) |
This function explore the robot_model (which was built from urdf and srdf files), and fills the fingerTipNames vector. More... | |
void | lookForActiveJoints () |
This function look for all active joints in the model (i.e. More... | |
void | lookForPassiveJoints () |
This function looks for all passive joints, defined so in the srdf file. More... | |
void | lookJointsTipsCorrelation () |
Here, we find for each tip, which are all the joints (active) that can modifies its position It is easier to start from each joint and see which tips has as its descendands, because there is the getDescendantLinkModels() function in moveit that gives ALL the child links. More... | |
void | lookForDescendants () |
Function to explore the kinematic tree from each actuated joint. More... | |
void | getRealDescendantLinkModelsRecursive (const moveit::core::LinkModel *link, std::vector< const moveit::core::LinkModel * > &linksVect, const moveit::core::JointModel *joint, std::vector< const moveit::core::JointModel * > &jointsVect) const |
Recursive function, support for lookForDescendants, to explore the urdf tree. More... | |
Private Attributes | |
std::string | handName |
robot_model::RobotModelPtr | robot_model |
std::vector< std::string > | fingertipNames |
std::vector< std::string > | activeJointNames |
std::vector< std::string > | passiveJointNames |
std::vector< const moveit::core::JointModel * > | activeJointModels |
std::string | robot_description |
unsigned int | nFingers |
std::map< std::string, std::vector< const moveit::core::LinkModel * > > | descendantLinksOfJoint |
Map containing info about descendants links of a joint see lookForDescendants function for more info. More... | |
std::map< std::string, std::vector< const moveit::core::JointModel * > > | descendantJointsOfJoint |
Map containing info about descendants joints of a joint see lookForDescendants function for more info. More... | |
std::map< std::string, std::vector< std::string > > | jointsOfFingertipMap |
The map with as key the name of the fingertip and as value all the joints (actuated) that can modify its pose. More... | |
std::map< std::string, std::vector< std::string > > | fingertipsOfJointMap |
The map with as key the name of the actuated joint and as value all the fingertips which pose can be modified by the joint. More... | |
std::map< std::string, std::string > | fingerOfFingertipMap |
The map with as key the name of the finger (defined in srdf file) and as value the fingertip (the last (not virtual) link of the joint) More... | |
std::map< std::string, std::string > | fingertipOfFingerMap |
The map with as key the name of the fingertip (the last (not virtual) link of a finger) and as value the finger name (defined in the srdf) More... | |
std::map< std::string, std::pair< std::string, std::string > > | mimicNLFatherOfJointMap |
This map contain as key the name of the mimic joint which position follows a non linear relationship with a father joint. More... | |
std::map< std::string, std::map< std::string, std::string > > | mimicNLJointsOfFatherMap |
inverse map of previous, even if the function is replicated, this is anyway useful, at the cost of having 2 copy of a string type. More... | |
class to parse urdf and srdf with moveit classes and to give information about the model parsed
Definition at line 36 of file ParserMoveIt.h.
typedef std::shared_ptr<const ParserMoveIt> ROSEE::ParserMoveIt::ConstPtr |
Definition at line 41 of file ParserMoveIt.h.
typedef std::shared_ptr<ParserMoveIt> ROSEE::ParserMoveIt::Ptr |
Definition at line 40 of file ParserMoveIt.h.
ROSEE::ParserMoveIt::ParserMoveIt | ( | ) |
Definition at line 19 of file ParserMoveIt.cpp.
ROSEE::ParserMoveIt::~ParserMoveIt | ( | ) |
Definition at line 23 of file ParserMoveIt.cpp.
bool ROSEE::ParserMoveIt::checkIfContinuosJoint | ( | const std::string | jointName | ) | const |
check if the passed joint is continuos (i.e.
a revolute one with sum of bounds greater than 2*PI)
jointName | the name of the joint |
Definition at line 244 of file ParserMoveIt.cpp.
bool ROSEE::ParserMoveIt::checkIfContinuosJoint | ( | const moveit::core::JointModel * | joint | ) | const |
check if the passed joint is continuos (i.e.
a revolute one with sum of bounds greater than 2*PI)
joint | pointer to the joint model |
Definition at line 253 of file ParserMoveIt.cpp.
std::vector< const moveit::core::JointModel * > ROSEE::ParserMoveIt::getActiveJointModels | ( | ) | const |
getter for all active (actuated) joints.
The analogous moveit function returns also the "passive" ones (defined in srdf), this one exclude the passive
Definition at line 73 of file ParserMoveIt.cpp.
std::vector< std::string > ROSEE::ParserMoveIt::getActiveJointNames | ( | ) | const |
getter for all active (actuated) joints' names.
The analogous moveit function returns also the "passive" ones (defined in srdf)
Definition at line 69 of file ParserMoveIt.cpp.
std::vector< double > ROSEE::ParserMoveIt::getBiggerBoundFromZero | ( | std::string | jointName | ) | const |
For each DOF of a joint, find the limit which is farther from 0 position.
jointName | the name of the joint |
Definition at line 274 of file ParserMoveIt.cpp.
std::vector< double > ROSEE::ParserMoveIt::getBiggerBoundFromZero | ( | const moveit::core::JointModel * | joint | ) | const |
For each DOF of a joint, find the limit which is farther from 0 position.
joint | pointer to the joint model |
Definition at line 284 of file ParserMoveIt.cpp.
robot_model::RobotModelPtr ROSEE::ParserMoveIt::getCopyModel | ( | ) | const |
This function reload another model, same as the one loaded in init but this one can be modified externally, because it will not affect the internal structures of this class.
Definition at line 187 of file ParserMoveIt.cpp.
std::map< std::string, std::vector< const moveit::core::JointModel * > > ROSEE::ParserMoveIt::getDescendantJointsOfJoint | ( | ) | const |
getter for descendandsJointsOfJoint.
"Descendants" is intended in a slightly different way respect to moveit (see lookForDescendants doc)
Definition at line 85 of file ParserMoveIt.cpp.
std::map< std::string, std::vector< const moveit::core::LinkModel * > > ROSEE::ParserMoveIt::getDescendantLinksOfJoint | ( | ) | const |
getter for descendandsLinksOfJoint.
"Descendants" is intended in a slightly different way respect to moveit (see lookForDescendants doc)
Definition at line 81 of file ParserMoveIt.cpp.
std::string ROSEE::ParserMoveIt::getFingerOfFingertip | ( | std::string | tipName | ) | const |
This function returns the name of the finger which the passed tipName
belongs to.
tipName | the name of the tip |
tipName
is not in the map Definition at line 109 of file ParserMoveIt.cpp.
std::map< std::string, std::string > ROSEE::ParserMoveIt::getFingerOfFingertipMap | ( | ) | const |
Definition at line 105 of file ParserMoveIt.cpp.
std::vector< std::string > ROSEE::ParserMoveIt::getFingertipNames | ( | ) | const |
Definition at line 65 of file ParserMoveIt.cpp.
std::string ROSEE::ParserMoveIt::getFingertipOfFinger | ( | std::string | fingerName | ) | const |
This function returns the name of the fingertip that belongs to the passed fingerName
.
fingerName | the name of the tip |
fingerName
is not in the map Definition at line 125 of file ParserMoveIt.cpp.
std::map< std::string, std::string > ROSEE::ParserMoveIt::getFingertipOfFingerMap | ( | ) | const |
Definition at line 121 of file ParserMoveIt.cpp.
std::map< std::string, std::vector< std::string > > ROSEE::ParserMoveIt::getFingertipsOfJointMap | ( | ) | const |
Definition at line 97 of file ParserMoveIt.cpp.
std::string ROSEE::ParserMoveIt::getFirstActuatedJointInFinger | ( | std::string | linkName | ) | const |
Given the linkName, this function returns the actuated joint that is a parent of this link and it is the first joint of the chain which the link belongs to.
E.G. given a fingertip, it returns the first actuated joint of the finger (e.g. the joint that moves the firsts phalanges, if present) From the linkName given, this function explores the parent links until we found a link with more than 1 child joint. This means that we have found the "base" of the kinematic chain, so we can go forward to find the first actuated joint
linkName | the name of the link which is part of the chain where we have to look in |
Definition at line 409 of file ParserMoveIt.cpp.
std::string ROSEE::ParserMoveIt::getFirstActuatedParentJoint | ( | std::string | linkName, |
bool | includeContinuos | ||
) | const |
starting from the given link, we explore the parents joint, until we found the first actuated.
This ones will be the interesting joint
linkName | the name of the link for which look for the parent joint |
includeContinuos | a bool set to true if we want to include continuos joint in the search |
Definition at line 379 of file ParserMoveIt.cpp.
std::vector< std::string > ROSEE::ParserMoveIt::getGroupOfLink | ( | std::string | linkName | ) |
This function explores all groups of srdf and says to which ones the linkName belongs to.
Returns a vector because a link can be part of more group.
linkName | the name on the link for which look the group |
Definition at line 192 of file ParserMoveIt.cpp.
std::string ROSEE::ParserMoveIt::getHandName | ( | ) | const |
Definition at line 61 of file ParserMoveIt.cpp.
std::map< std::string, std::vector< std::string > > ROSEE::ParserMoveIt::getJointsOfFingertipMap | ( | ) | const |
Definition at line 101 of file ParserMoveIt.cpp.
std::pair< std::string, std::string > ROSEE::ParserMoveIt::getMimicNLFatherOfJoint | ( | std::string | mimicNLJointName | ) | const |
gets for the maps of non linear mimic joints
Definition at line 137 of file ParserMoveIt.cpp.
std::map< std::string, std::pair< std::string, std::string > > ROSEE::ParserMoveIt::getMimicNLFatherOfJointMap | ( | ) | const |
Definition at line 149 of file ParserMoveIt.cpp.
std::string ROSEE::ParserMoveIt::getMimicNLJointOfFather | ( | std::string | mimicNLFatherName, |
std::string | mimicNLJointName | ||
) | const |
Definition at line 155 of file ParserMoveIt.cpp.
std::map< std::string, std::string > ROSEE::ParserMoveIt::getMimicNLJointsOfFather | ( | std::string | mimicNLFatherName | ) | const |
Definition at line 168 of file ParserMoveIt.cpp.
std::map< std::string, std::map< std::string, std::string > > ROSEE::ParserMoveIt::getMimicNLJointsOfFatherMap | ( | ) | const |
Definition at line 180 of file ParserMoveIt.cpp.
unsigned int ROSEE::ParserMoveIt::getNExclusiveJointsOfTip | ( | std::string | tipName, |
bool | continuosIncluded | ||
) | const |
Given a fingertip link, this function return the number of the joint that affect only the position of this fingertip and not any other fingertips (obviously the joints can affect different other links that are not fingertips (e.g.
middles phalanges) )
tipName | the name of the fingertip link |
continuosIncluded | a bool set to true if we want to count also the possible present continuos joints |
Definition at line 334 of file ParserMoveIt.cpp.
unsigned int ROSEE::ParserMoveIt::getNFingers | ( | ) | const |
Definition at line 89 of file ParserMoveIt.cpp.
std::vector< std::string > ROSEE::ParserMoveIt::getPassiveJointNames | ( | ) | const |
getter for all the passive joints (defined in this way in the srdf file) Not all the not-actuated joint are passive (a mimic joint can also be not defined as passive in srdf)
Definition at line 77 of file ParserMoveIt.cpp.
|
private |
Recursive function, support for lookForDescendants, to explore the urdf tree.
link | pointer to the actual link that is being explored |
linksVect | [out] vector of explored links are stored here at each iteration |
joint | pointer to the actual joint thaqt is being explored (father of link , each joint has always one and only one (direct) child link) |
jointsVect | [out] vector of explored joints are stored here at each iteration |
Definition at line 563 of file ParserMoveIt.cpp.
const robot_model::RobotModelPtr ROSEE::ParserMoveIt::getRobotModel | ( | ) | const |
the robot model can't be modified, if you want it to modify, use getCopyModel to get a copy.
Definition at line 93 of file ParserMoveIt.cpp.
std::vector< double > ROSEE::ParserMoveIt::getSmallerBoundFromZero | ( | std::string | jointName | ) | const |
For each DOF of a joint, find the limit which is nearer from 0 position.
jointName | the name of the joint |
Definition at line 304 of file ParserMoveIt.cpp.
std::vector< double > ROSEE::ParserMoveIt::getSmallerBoundFromZero | ( | const moveit::core::JointModel * | joint | ) | const |
For each DOF of a joint, find the limit which is nearer from 0 position.
joint | pointer to the joint model |
Definition at line 314 of file ParserMoveIt.cpp.
bool ROSEE::ParserMoveIt::groupIsChain | ( | const std::string | groupName | ) | const |
check if a group (defined in srdf file) is a chain.
See groupIsChain ( moveit::core::JointModelGroup* group )
groupName | the name of the group |
Definition at line 212 of file ParserMoveIt.cpp.
bool ROSEE::ParserMoveIt::groupIsChain | ( | const moveit::core::JointModelGroup * | group | ) | const |
check if a group (defined in srdf file) is a chain.
This is done simply exploring all the links of the group: if no links have more than 1 children, the group is a chain. Moveit has a function isChain() but I don't understand how it works, in fact also if there is a link with more children joint sometimes the group is considered a chain anyway. I can't find where the moveit _is_chain member is set.
group | pointer to moveit::core::JointModelGroup object |
Definition at line 228 of file ParserMoveIt.cpp.
bool ROSEE::ParserMoveIt::init | ( | std::string | robot_description, |
bool | verbose = true |
||
) |
Init the parser, fill the structures.
robot_description | a string containing the name given to the param set in ROS server for the urdf file. The srdf file must have the same param name but with a trailing "_semantic" |
verbose | pass false to reduce the quantity of informative prints |
Definition at line 27 of file ParserMoveIt.cpp.
|
private |
This function look for all active joints in the model (i.e.
not mimic, not fixed, not passive) There exist a moveit function getActiveJointModels() which return all not mimic and not fixed, but it can return also passive joints (a info that is stored in srdf file). So this function also check if the joint is not passive It stores both the joint names and pointer to joint models in two private vector (activeJointNames and activeJointModels)
Definition at line 493 of file ParserMoveIt.cpp.
|
private |
Function to explore the kinematic tree from each actuated joint.
It stores each descendants links and joints in two maps (descendantLinksOfJoint and descendantJointsOfJoint) where the key is the name of the joint and the value a vector of descendandts. The tree is explored recursively thanks to getRealDescendantLinkModelsRecursive support function
Definition at line 540 of file ParserMoveIt.cpp.
|
private |
This function explore the robot_model (which was built from urdf and srdf files), and fills the fingerTipNames vector.
In particular, the function explores only the groups specified in the srdf, and prints infos about each link it finds (eg. not a fingertin, not a chain group, and so on). A fingertip is a link with the following conditions:
verbose | set it to false to not print explored hand info |
Definition at line 436 of file ParserMoveIt.cpp.
|
private |
This function looks for all passive joints, defined so in the srdf file.
Definition at line 504 of file ParserMoveIt.cpp.
|
private |
Here, we find for each tip, which are all the joints (active) that can modifies its position It is easier to start from each joint and see which tips has as its descendands, because there is the getDescendantLinkModels() function in moveit that gives ALL the child links.
There is not a function like getNonFixedParentJointModels from the tip, there is only the one to take the FIRST parent joint (getParentJointModel()) Meanwhile, we find also, for each joint, all the tips that are influenced by the joint movement: fingertipsOfJointMap
Definition at line 514 of file ParserMoveIt.cpp.
void ROSEE::ParserMoveIt::parseNonLinearMimicRelations | ( | std::string | xml | ) |
Definition at line 582 of file ParserMoveIt.cpp.
|
private |
Definition at line 256 of file ParserMoveIt.h.
|
private |
Definition at line 253 of file ParserMoveIt.h.
|
private |
Map containing info about descendants joints of a joint see lookForDescendants function for more info.
Definition at line 264 of file ParserMoveIt.h.
|
private |
Map containing info about descendants links of a joint see lookForDescendants function for more info.
Definition at line 261 of file ParserMoveIt.h.
|
private |
The map with as key the name of the finger (defined in srdf file) and as value the fingertip (the last (not virtual) link of the joint)
Definition at line 274 of file ParserMoveIt.h.
|
private |
Definition at line 252 of file ParserMoveIt.h.
|
private |
The map with as key the name of the fingertip (the last (not virtual) link of a finger) and as value the finger name (defined in the srdf)
Definition at line 278 of file ParserMoveIt.h.
|
private |
The map with as key the name of the actuated joint and as value all the fingertips which pose can be modified by the joint.
Definition at line 270 of file ParserMoveIt.h.
|
private |
Definition at line 250 of file ParserMoveIt.h.
|
private |
The map with as key the name of the fingertip and as value all the joints (actuated) that can modify its pose.
Definition at line 267 of file ParserMoveIt.h.
|
private |
This map contain as key the name of the mimic joint which position follows a non linear relationship with a father joint.
As value there is a pair: first element is the name of the father joint, second element is the non linear equation
as convention, in the equation there must exist only the variable x, that is, the position of the father joint
Definition at line 288 of file ParserMoveIt.h.
|
private |
inverse map of previous, even if the function is replicated, this is anyway useful, at the cost of having 2 copy of a string type.
the key is the name of the father, the value is a map because more than one child can mimic the father (In the other map, there is a pair)
Definition at line 296 of file ParserMoveIt.h.
|
private |
Definition at line 258 of file ParserMoveIt.h.
|
private |
Definition at line 254 of file ParserMoveIt.h.
|
private |
Definition at line 257 of file ParserMoveIt.h.
|
private |
Definition at line 251 of file ParserMoveIt.h.