ParserMoveIt.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 <copyright holder> <email>
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __ROSEE_PARSER_MOVEIT_H
18 #define __ROSEE_PARSER_MOVEIT_H
19 
20 #include <string>
21 #include <vector>
22 #include <map>
23 #include <iostream>
24 
26 
27 //parse customized urdf with non linear mimic
28 #include <tinyxml.h>
29 
30 
31 namespace ROSEE {
36 class ParserMoveIt {
37 
38 public:
39 
40  typedef std::shared_ptr<ParserMoveIt> Ptr;
41  typedef std::shared_ptr<const ParserMoveIt> ConstPtr;
42 
43  ParserMoveIt();
44  ~ParserMoveIt();
45 
54  bool init (std::string robot_description, bool verbose = true) ;
55  std::string getHandName () const;
56  unsigned int getNFingers () const ;
57  std::vector <std::string> getFingertipNames () const;
58 
63  std::vector <std::string> getActiveJointNames () const;
64 
69  std::vector <const moveit::core::JointModel*> getActiveJointModels () const;
70 
77  std::vector <std::string> getPassiveJointNames () const;
78 
84  std::map <std::string, std::vector < const moveit::core::LinkModel* > > getDescendantLinksOfJoint() const ;
85 
91  std::map <std::string, std::vector < const moveit::core::JointModel* > > getDescendantJointsOfJoint() const ;
92 
98  const robot_model::RobotModelPtr getRobotModel () const ;
99 
100  std::map < std::string, std::vector<std::string> > getFingertipsOfJointMap () const;
101  std::map < std::string, std::vector<std::string> > getJointsOfFingertipMap () const;
102  std::map < std::string, std::string > getFingerOfFingertipMap () const;
103  std::map < std::string, std::string > getFingertipOfFingerMap () const;
104 
113  std::string getFingerOfFingertip (std::string tipName) const;
114 
122  std::string getFingertipOfFinger (std::string fingerName) const;
123 
124 
130  robot_model::RobotModelPtr getCopyModel ( ) const;
131 
138  std::vector < std::string > getGroupOfLink ( std::string linkName );
139 
145  bool groupIsChain ( const std::string groupName ) const;
146 
156  bool groupIsChain ( const moveit::core::JointModelGroup* group ) const;
157 
163  bool checkIfContinuosJoint ( const std::string jointName) const;
169  bool checkIfContinuosJoint ( const moveit::core::JointModel* joint ) const;
170 
176  std::vector<double> getBiggerBoundFromZero ( std::string jointName ) const;
182  std::vector<double> getBiggerBoundFromZero ( const moveit::core::JointModel* joint ) const;
183 
189  std::vector<double> getSmallerBoundFromZero ( std::string jointName ) const;
195  std::vector<double> getSmallerBoundFromZero ( const moveit::core::JointModel* joint ) const;
196 
206  unsigned int getNExclusiveJointsOfTip (std::string tipName, bool continuosIncluded) const;
207 
215  std::string getFirstActuatedParentJoint ( std::string linkName, bool includeContinuos ) const;
216 
227  std::string getFirstActuatedJointInFinger (std::string linkName) const ;
228 
234  void parseNonLinearMimicRelations(std::string xml);
235 
240  std::pair<std::string, std::string> getMimicNLFatherOfJoint(std::string mimicNLJointName) const;
241  std::map<std::string, std::pair<std::string, std::string>> getMimicNLFatherOfJointMap() const;
242 
243  std::string getMimicNLJointOfFather(std::string mimicNLFatherName, std::string mimicNLJointName) const;
244  std::map<std::string, std::string> getMimicNLJointsOfFather(std::string mimicNLFatherName) const;
245  std::map<std::string, std::map<std::string, std::string>> getMimicNLJointsOfFatherMap() const;
246 
247 
248 private:
249 
250  std::string handName;
251  robot_model::RobotModelPtr robot_model;
252  std::vector<std::string> fingertipNames;
253  std::vector<std::string> activeJointNames;
254  std::vector<std::string> passiveJointNames;
255 
256  std::vector<const moveit::core::JointModel*> activeJointModels;
257  std::string robot_description;
258  unsigned int nFingers;
259 
261  std::map <std::string, std::vector < const moveit::core::LinkModel* > > descendantLinksOfJoint;
262 
264  std::map <std::string, std::vector < const moveit::core::JointModel* > > descendantJointsOfJoint;
265 
267  std::map<std::string, std::vector<std::string>> jointsOfFingertipMap;
268 
270  std::map<std::string, std::vector<std::string>> fingertipsOfJointMap;
271 
274  std::map<std::string, std::string> fingerOfFingertipMap;
275 
278  std::map<std::string, std::string> fingertipOfFingerMap;
279 
288  std::map<std::string, std::pair<std::string, std::string>> mimicNLFatherOfJointMap;
289 
296  std::map<std::string, std::map<std::string, std::string>> mimicNLJointsOfFatherMap;
297 
298 
314  void lookForFingertips(bool verbose = true);
315 
316 
323  void lookForActiveJoints();
324 
325 
330  void lookForPassiveJoints();
331 
332 
343 
353  void lookForDescendants();
354 
362  void getRealDescendantLinkModelsRecursive ( const moveit::core::LinkModel* link, std::vector< const moveit::core::LinkModel* > & linksVect,
363  const moveit::core::JointModel* joint, std::vector< const moveit::core::JointModel* > & jointsVect ) const;
364 
365 
366 
367 
368 
369 
370 };
371 
372 } //namespace
373 
374 #endif // __ROSEE_PARSER_MOVEIT_H
moveit::core::LinkModel
ROSEE::ParserMoveIt::getMimicNLJointsOfFather
std::map< std::string, std::string > getMimicNLJointsOfFather(std::string mimicNLFatherName) const
Definition: ParserMoveIt.cpp:168
ROSEE::ParserMoveIt::fingertipsOfJointMap
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 ...
Definition: ParserMoveIt.h:270
ROSEE::ParserMoveIt::robot_model
robot_model::RobotModelPtr robot_model
Definition: ParserMoveIt.h:251
ROSEE::ParserMoveIt::ParserMoveIt
ParserMoveIt()
Definition: ParserMoveIt.cpp:19
ROSEE::ParserMoveIt::checkIfContinuosJoint
bool 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)
Definition: ParserMoveIt.cpp:244
ROSEE::ParserMoveIt::ConstPtr
std::shared_ptr< const ParserMoveIt > ConstPtr
Definition: ParserMoveIt.h:41
ROSEE::ParserMoveIt::lookForPassiveJoints
void lookForPassiveJoints()
This function looks for all passive joints, defined so in the srdf file.
Definition: ParserMoveIt.cpp:504
ROSEE::ParserMoveIt::lookForDescendants
void lookForDescendants()
Function to explore the kinematic tree from each actuated joint. It stores each descendants links and...
Definition: ParserMoveIt.cpp:540
ROSEE::ParserMoveIt::getFingertipOfFingerMap
std::map< std::string, std::string > getFingertipOfFingerMap() const
Definition: ParserMoveIt.cpp:121
ROSEE::ParserMoveIt::fingerOfFingertipMap
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 las...
Definition: ParserMoveIt.h:274
ROSEE::ParserMoveIt::getMimicNLJointsOfFatherMap
std::map< std::string, std::map< std::string, std::string > > getMimicNLJointsOfFatherMap() const
Definition: ParserMoveIt.cpp:180
ROSEE
Definition: EEInterface.h:30
ROSEE::ParserMoveIt::getFingerOfFingertipMap
std::map< std::string, std::string > getFingerOfFingertipMap() const
Definition: ParserMoveIt.cpp:105
ROSEE::ParserMoveIt::handName
std::string handName
Definition: ParserMoveIt.h:250
ROSEE::ParserMoveIt::fingertipNames
std::vector< std::string > fingertipNames
Definition: ParserMoveIt.h:252
ROSEE::ParserMoveIt::getBiggerBoundFromZero
std::vector< double > getBiggerBoundFromZero(std::string jointName) const
For each DOF of a joint, find the limit which is farther from 0 position.
Definition: ParserMoveIt.cpp:274
ROSEE::ParserMoveIt::getDescendantLinksOfJoint
std::map< std::string, std::vector< const moveit::core::LinkModel * > > getDescendantLinksOfJoint() const
getter for descendandsLinksOfJoint. "Descendants" is intended in a slightly different way respect to ...
Definition: ParserMoveIt.cpp:81
ROSEE::ParserMoveIt::jointsOfFingertipMap
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 ...
Definition: ParserMoveIt.h:267
ROSEE::ParserMoveIt::getSmallerBoundFromZero
std::vector< double > getSmallerBoundFromZero(std::string jointName) const
For each DOF of a joint, find the limit which is nearer from 0 position.
Definition: ParserMoveIt.cpp:304
robot_model_loader.h
ROSEE::ParserMoveIt::mimicNLJointsOfFatherMap
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,...
Definition: ParserMoveIt.h:296
ROSEE::ParserMoveIt::lookJointsTipsCorrelation
void lookJointsTipsCorrelation()
Here, we find for each tip, which are all the joints (active) that can modifies its position It is ea...
Definition: ParserMoveIt.cpp:514
ROSEE::ParserMoveIt::getPassiveJointNames
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 joi...
Definition: ParserMoveIt.cpp:77
ROSEE::ParserMoveIt::activeJointNames
std::vector< std::string > activeJointNames
Definition: ParserMoveIt.h:253
ROSEE::ParserMoveIt::getCopyModel
robot_model::RobotModelPtr getCopyModel() const
This function reload another model, same as the one loaded in init but this one can be modified exter...
Definition: ParserMoveIt.cpp:187
ROSEE::ParserMoveIt::getGroupOfLink
std::vector< std::string > getGroupOfLink(std::string linkName)
This function explores all groups of srdf and says to which ones the linkName belongs to....
Definition: ParserMoveIt.cpp:192
ROSEE::ParserMoveIt::getDescendantJointsOfJoint
std::map< std::string, std::vector< const moveit::core::JointModel * > > getDescendantJointsOfJoint() const
getter for descendandsJointsOfJoint. "Descendants" is intended in a slightly different way respect to...
Definition: ParserMoveIt.cpp:85
ROSEE::ParserMoveIt::getNExclusiveJointsOfTip
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...
Definition: ParserMoveIt.cpp:334
ROSEE::ParserMoveIt::getNFingers
unsigned int getNFingers() const
Definition: ParserMoveIt.cpp:89
ROSEE::ParserMoveIt::descendantLinksOfJoint
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.
Definition: ParserMoveIt.h:261
ROSEE::ParserMoveIt::getFingertipNames
std::vector< std::string > getFingertipNames() const
Definition: ParserMoveIt.cpp:65
ROSEE::ParserMoveIt::getMimicNLFatherOfJoint
std::pair< std::string, std::string > getMimicNLFatherOfJoint(std::string mimicNLJointName) const
gets for the maps of non linear mimic joints
Definition: ParserMoveIt.cpp:137
ROSEE::ParserMoveIt::getFirstActuatedParentJoint
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....
Definition: ParserMoveIt.cpp:379
ROSEE::ParserMoveIt::fingertipOfFingerMap
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 ...
Definition: ParserMoveIt.h:278
ROSEE::ParserMoveIt::getMimicNLFatherOfJointMap
std::map< std::string, std::pair< std::string, std::string > > getMimicNLFatherOfJointMap() const
Definition: ParserMoveIt.cpp:149
ROSEE::ParserMoveIt::mimicNLFatherOfJointMap
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 ...
Definition: ParserMoveIt.h:288
ROSEE::ParserMoveIt::getHandName
std::string getHandName() const
Definition: ParserMoveIt.cpp:61
ROSEE::ParserMoveIt::lookForFingertips
void lookForFingertips(bool verbose=true)
This function explore the robot_model (which was built from urdf and srdf files), and fills the finge...
Definition: ParserMoveIt.cpp:436
ROSEE::ParserMoveIt::getFingerOfFingertip
std::string getFingerOfFingertip(std::string tipName) const
This function returns the name of the finger which the passed tipName belongs to.
Definition: ParserMoveIt.cpp:109
ROSEE::ParserMoveIt::getMimicNLJointOfFather
std::string getMimicNLJointOfFather(std::string mimicNLFatherName, std::string mimicNLJointName) const
Definition: ParserMoveIt.cpp:155
ROSEE::ParserMoveIt::activeJointModels
std::vector< const moveit::core::JointModel * > activeJointModels
Definition: ParserMoveIt.h:256
ROSEE::ParserMoveIt::lookForActiveJoints
void lookForActiveJoints()
This function look for all active joints in the model (i.e. not mimic, not fixed, not passive) There ...
Definition: ParserMoveIt.cpp:493
ROSEE::ParserMoveIt::getRealDescendantLinkModelsRecursive
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.
Definition: ParserMoveIt.cpp:563
ROSEE::ParserMoveIt::getActiveJointModels
std::vector< const moveit::core::JointModel * > getActiveJointModels() const
getter for all active (actuated) joints. The analogous moveit function returns also the "passive" one...
Definition: ParserMoveIt.cpp:73
ROSEE::ParserMoveIt::descendantJointsOfJoint
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...
Definition: ParserMoveIt.h:264
ROSEE::ParserMoveIt::robot_description
std::string robot_description
Definition: ParserMoveIt.h:257
ROSEE::ParserMoveIt
class to parse urdf and srdf with moveit classes and to give information about the model parsed
Definition: ParserMoveIt.h:36
ROSEE::ParserMoveIt::getFirstActuatedJointInFinger
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 ...
Definition: ParserMoveIt.cpp:409
ROSEE::ParserMoveIt::getJointsOfFingertipMap
std::map< std::string, std::vector< std::string > > getJointsOfFingertipMap() const
Definition: ParserMoveIt.cpp:101
ROSEE::ParserMoveIt::Ptr
std::shared_ptr< ParserMoveIt > Ptr
Definition: ParserMoveIt.h:40
ROSEE::ParserMoveIt::groupIsChain
bool groupIsChain(const std::string groupName) const
check if a group (defined in srdf file) is a chain. See groupIsChain ( moveit::core::JointModelGroup*...
Definition: ParserMoveIt.cpp:212
ROSEE::ParserMoveIt::nFingers
unsigned int nFingers
Definition: ParserMoveIt.h:258
moveit::core::JointModelGroup
ROSEE::ParserMoveIt::parseNonLinearMimicRelations
void parseNonLinearMimicRelations(std::string xml)
Definition: ParserMoveIt.cpp:582
ROSEE::ParserMoveIt::init
bool init(std::string robot_description, bool verbose=true)
Init the parser, fill the structures.
Definition: ParserMoveIt.cpp:27
ROSEE::ParserMoveIt::getFingertipsOfJointMap
std::map< std::string, std::vector< std::string > > getFingertipsOfJointMap() const
Definition: ParserMoveIt.cpp:97
ROSEE::ParserMoveIt::~ParserMoveIt
~ParserMoveIt()
Definition: ParserMoveIt.cpp:23
ROSEE::ParserMoveIt::getFingertipOfFinger
std::string getFingertipOfFinger(std::string fingerName) const
This function returns the name of the fingertip that belongs to the passed fingerName.
Definition: ParserMoveIt.cpp:125
ROSEE::ParserMoveIt::getRobotModel
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.
Definition: ParserMoveIt.cpp:93
ROSEE::ParserMoveIt::getActiveJointNames
std::vector< std::string > getActiveJointNames() const
getter for all active (actuated) joints' names. The analogous moveit function returns also the "passi...
Definition: ParserMoveIt.cpp:69
moveit::core::JointModel
ROSEE::ParserMoveIt::passiveJointNames
std::vector< std::string > passiveJointNames
Definition: ParserMoveIt.h:254


end-effector
Author(s): Luca Muratore , Davide Torielli , Liana Bertoni
autogenerated on Sat Dec 14 2024 03:49:26