7 this->
mimicNLRelMap = parserMoveIt->getMimicNLFatherOfJointMap();
21 if (mapOfLoosePinches.size() != 0 ){
26 if (mapOfPinches.size() == 0 ) {
27 std::cout <<
"[FINDACTIONS::" << __func__ <<
"]: I found no collisions between tips. Are you sure your hand" 28 <<
" has some fingertips that can collide? If yes, check your urdf/srdf, or be sure to" 29 <<
" have set the mesh or some collision geometry for the links, or" 30 <<
" set a bigger value in N_EXP_COLLISION" << std::endl;
37 for (
auto& it : mapOfPinches) {
40 std::set < std::string > keys ;
41 keys.insert (it.first.first) ;
42 keys.insert (it.first.second) ;
43 mapForWorker.insert (std::make_pair ( keys, pointer ) );
46 yamlWorker.
createYamlFile(mapForWorker,
"pinchTight", path2saveYaml);
49 if (mapOfLoosePinches.size() == 0 ) {
50 std::cout <<
"[FINDACTIONS::" << __func__ <<
"]: I found no loose pinches. This mean that some error happened or that" <<
51 " all the tips pairs collide with each other for at least one hand configuration." << std::endl;
58 for (
auto& it : mapOfLoosePinches) {
61 std::set < std::string > keys ;
62 keys.insert (it.first.first) ;
63 keys.insert (it.first.second) ;
64 mapForWorker.insert (std::make_pair ( keys, pointer ) );
67 yamlWorker.
createYamlFile(mapForWorker,
"pinchLoose", path2saveYaml);
70 return std::make_pair(mapOfPinches, mapOfLoosePinches);
74 std::string path2saveYaml) {
77 std::map <std::string, ActionTrig> trigMap;
80 case ROSEE::ActionPrimitive::Type::Trig : {
84 case ROSEE::ActionPrimitive::Type::TipFlex : {
88 case ROSEE::ActionPrimitive::Type::FingFlex : {
93 std::cout <<
"[ERROR FINDACTIONS::" << __func__ <<
"]: Passing as argument a action type which is not a type of trig. " << std::endl
94 <<
"I am returing an empty map" << std::endl;
99 if (trigMap.size() == 0 ) {
105 for (
auto & mapEl : trigMap) {
108 for (
auto joint : mapEl.second.getJointPos() ) {
109 jointsInvolvedCount.insert (std::make_pair(joint.first, 0));
110 for (
auto dof : joint.second) {
112 jointsInvolvedCount.at(joint.first) = 1;
117 mapEl.second.setJointsInvolvedCount (jointsInvolvedCount);
122 for (
auto& it : trigMap) {
125 std::set < std::string > keys ;
126 keys.insert (it.first) ;
127 mapForWorker.insert (std::make_pair ( keys, pointer ) );
131 yamlWorker.
createYamlFile(mapForWorker, trigMap.begin()->second.getName(), path2saveYaml);
139 std::map <std::string, ROSEE::ActionSingleJointMultipleTips> mapOfSingleJointMultipleTips;
142 std::cout <<
"[ERROR FINDACTIONS::" << __func__ <<
"] please pass a positive number " <<
143 " as number of fingers. You passed " << nFinger <<
" ! " << std::endl;
144 return mapOfSingleJointMultipleTips;
148 std::cout <<
"[ERROR FINDACTIONS::" << __func__ <<
"] with 1 finger, you are looking for a ActionTrig, " 149 <<
"and not a ActionSingleJointMultipleTips. Returning an empty map" << std::endl;
150 return mapOfSingleJointMultipleTips;
154 std::cout <<
"[ERROR FINDACTIONS::" << __func__ <<
"] I can not find an action which moves " << nFinger <<
155 " fingers if the hand has only " <<
parserMoveIt->getNFingers() <<
" fingers. Returning an empty map" << std::endl;
156 return mapOfSingleJointMultipleTips;
159 std::string actionName =
"singleJointMultipleTips_" + std::to_string(nFinger);
161 for (
auto mapEl :
parserMoveIt->getFingertipsOfJointMap() ) {
163 if (mapEl.second.size() != nFinger ) {
167 std::vector<double> furtherPos =
parserMoveIt->getBiggerBoundFromZero(mapEl.first);
168 std::vector<double> nearerPos =
parserMoveIt->getSmallerBoundFromZero(mapEl.first);
174 jpFar.insert ( std::make_pair ( it->getName(), jPos ));
178 jpFar.at ( mapEl.first ) = furtherPos;
179 jpNear.at ( mapEl.first ) = nearerPos;
181 std::vector<std::string> fingersInvolved;
182 for (
auto tip : mapEl.second){
183 fingersInvolved.push_back(
parserMoveIt->getFingerOfFingertip (tip) );
188 mapOfSingleJointMultipleTips.insert (std::make_pair(mapEl.first, action));
192 if (mapOfSingleJointMultipleTips.size() == 0 ) {
193 std::cout <<
"[FINDACTIONS::" << __func__ <<
"] no singleJointMultipleTips with " << nFinger <<
" found" << std::endl;
194 return mapOfSingleJointMultipleTips;
199 for (
auto& it : mapOfSingleJointMultipleTips) {
202 std::set<std::string>
set;
203 set.insert (it.first);
204 mapForWorker.insert (std::make_pair (
set, pointer ) );
208 yamlWorker.
createYamlFile(mapForWorker, actionName, path2saveYaml);
210 return mapOfSingleJointMultipleTips;
219 std::cerr <<
"[ERROR " << __func__ <<
"] for this find pass at least 3 as number " <<
220 " of fingertips for the pinch" << std::endl;
221 return multiplePinchMap;
227 if (multiplePinchMap.size() == 0 ) {
228 return multiplePinchMap;
232 for (
auto& it : multiplePinchMap) {
235 mapForWorker.insert (std::make_pair ( it.first, pointer ) );
239 yamlWorker.
createYamlFile(mapForWorker, multiplePinchMap.begin()->second.getName(), path2saveYaml);
241 return multiplePinchMap;
263 collision_request.max_contacts = 1000;
271 parserMoveIt->getRobotModel()->getLinkModelNames(),
true);
275 robot_state::RobotState kinematic_state(
parserMoveIt->getRobotModel());
279 std::stringstream logCollision;
280 collision_result.
clear();
284 planning_scene.checkSelfCollision(collision_request, collision_result, kinematic_state, acm);
289 for (
auto cont : collision_result.
contacts){
295 logCollision <<
"[FINDACTIONS::" << __func__ <<
"] Collision between " << cont.first.first <<
" and " <<
296 cont.first.second << std::endl;
298 for (
auto contInfo : cont.second){
299 logCollision <<
"\tWith a depth of contact: " << contInfo.depth;
311 auto itFind = mapOfPinches.find ( fingerPair );
312 if ( itFind == mapOfPinches.end() ) {
314 mapOfPinches.insert ( std::make_pair (fingerPair, pinch) );
315 logCollision <<
", NEW INSERTION";
318 if (itFind->second.insertActionState( jointPos, cont.second.at(0)) ) {
319 logCollision <<
", NEW INSERTION";
322 logCollision << std::endl;
323 logCollision << jointPos;
336 robot_state::RobotState kinematic_state(
parserMoveIt->getRobotModel());
343 for (
auto &mapEl : *mapOfLoosePinches) {
352 Eigen::Affine3d tip1Trasf = kinematic_state.getGlobalLinkTransform(tips.first);
353 Eigen::Affine3d tip2Trasf = kinematic_state.getGlobalLinkTransform(tips.second);
354 double distance = (tip1Trasf.translation() - tip2Trasf.translation() ) .norm() ;
356 mapEl.second.insertActionState( jointPosLoose, distance ) ;
357 mapEl.second.setJointsInvolvedCount ( jointsInvolvedCount );
365 robot_model::RobotModelPtr kinematic_model_noBound) {
367 for (
auto mapEl : *mapOfLoosePinches ) {
372 auto joints =
parserMoveIt->getJointsOfFingertipMap().at (tips.first);
373 for ( std::string joint : joints ) {
374 auto jointModel = kinematic_model_noBound ->getJointModel(joint);
376 auto type = jointModel->getType() ;
379 auto bound = jointModel->getVariableBounds().at(0);
380 bound.max_position_ = EIGEN_PI;
381 bound.min_position_ = -EIGEN_PI;
383 jointModel->setVariableBounds ( jointModel->getVariableNames().at(0), bound );
387 std::cout <<
"[WARNING FINDACTIONS::" << __func__ <<
"] I am doubling the bounds for your prismatic joint " 388 <<
"but I am not sure it is enough to make the tips colliding to find the loose pinches " <<
390 auto bound = jointModel->getVariableBounds().at(0);
391 bound.max_position_ *= 2;
392 bound.min_position_ *= 2;
394 jointModel->setVariableBounds ( jointModel->getVariableNames().at(0), bound );
398 std::cout <<
"[FINDACTIONS::" << __func__ <<
"] Why are you using a type " 399 << kinematic_model_noBound ->getJointModel(joint)->getType()
400 <<
" joint? Code not ready to temporarily delete the multiple dof bounds" 401 <<
" in the job done to find the loose pinches " << std::endl << std::endl;
408 auto joints2 =
parserMoveIt->getJointsOfFingertipMap().at (tips.second);
409 for (
auto joint : joints2 ) {
411 auto jointModel = kinematic_model_noBound ->getJointModel(joint);
412 auto type = jointModel->getType() ;
415 auto bound = jointModel->getVariableBounds().at(0);
416 bound.max_position_ = EIGEN_PI;
417 bound.min_position_ = -EIGEN_PI;
419 jointModel->setVariableBounds ( jointModel->getVariableNames().at(0), bound );
423 std::cout <<
"[WARNING FINDACTIONS::" << __func__ <<
"] I am doubling the bounds for your prismatic joint " 424 <<
"but I am not sure it is enough to make the tips colliding to find the loose pinches " << std::endl;
425 auto bound = jointModel->getVariableBounds().at(0);
426 bound.max_position_ *= 2;
427 bound.min_position_ *= 2;
429 jointModel->setVariableBounds ( jointModel->getVariableNames().at(0), bound );
433 std::cout <<
"[FINDACTIONS::" << __func__ <<
"] Why are you using a type " 434 << kinematic_model_noBound ->getJointModel(joint)->getType()
435 <<
" joint? Code not ready to temporarily delete the multiple dof bounds" 436 <<
" in the working done to find the loose pinches " << std::endl << std::endl;
448 robot_model::RobotModelPtr kinematic_model_noBound =
parserMoveIt->getCopyModel();
453 acm.
setEntry(kinematic_model_noBound->getLinkModelNames(),
454 kinematic_model_noBound->getLinkModelNames(),
true);
456 for(
auto it : *mapOfLoosePinches) {
459 std::string tip1 =
parserMoveIt->getFingertipOfFinger(it.first.first);
460 std::string tip2 =
parserMoveIt->getFingertipOfFinger(it.first.second);
471 robot_state::RobotState kinematic_state(kinematic_model_noBound);
474 std::set < std::pair<std::string, std::string> > collidingFingers ;
476 collision_result.
clear();
479 planning_scene.
checkSelfCollision(collision_request, collision_result, kinematic_state, acm);
481 for (
auto cont : collision_result.
contacts){
488 for (
auto mapEl = mapOfLoosePinches->cbegin(); mapEl != mapOfLoosePinches->cend() ; ) {
490 if (collidingFingers.count(mapEl->first) == 0 ) {
491 mapOfLoosePinches->erase(mapEl++);
503 unsigned int nMinCollision = strict ?
510 collision_request.max_contacts = 1000;
517 parserMoveIt->getRobotModel()->getLinkModelNames(),
true);
521 robot_state::RobotState kinematic_state(
parserMoveIt->getRobotModel());
525 collision_result.
clear();
528 planning_scene.checkSelfCollision(collision_request, collision_result, kinematic_state, acm);
530 if (collision_result.
contacts.size() >= nMinCollision ) {
533 std::set <std::string> tipsColliding;
534 for (
auto cont : collision_result.
contacts){
536 tipsColliding.insert(cont.first.first);
537 tipsColliding.insert(cont.first.second);
538 depthSum += std::abs(cont.second.at(0).depth);
543 if (tipsColliding.size() != nFinger) {
555 auto itFind = mapOfMultPinches.find ( fingerColliding );
556 if ( itFind == mapOfMultPinches.end() ) {
558 mapOfMultPinches.insert ( std::make_pair (fingerColliding, pinch) );
561 if (itFind->second.insertActionState( jointPos, depthSum ) ) {
569 return mapOfMultPinches;
579 std::map <std::string, ActionTrig> trigMap;
581 for (
auto mapEl :
parserMoveIt->getFingertipsOfJointMap()) {
583 if (mapEl.second.size() != 1) {
587 if (
parserMoveIt->checkIfContinuosJoint(mapEl.first) == true ) {
592 double trigMax =
parserMoveIt->getBiggerBoundFromZero(mapEl.first).at(0) ;
607 std::map <std::string, ROSEE::ActionTrig> tipFlexMap;
609 for (
auto tipName :
parserMoveIt->getFingertipNames() ) {
611 if (
parserMoveIt->getNExclusiveJointsOfTip ( tipName,
false ) < 2 ) {
616 std::string theInterestingJoint =
parserMoveIt->getFirstActuatedParentJoint ( tipName,
false );
617 double tipFlexMax =
parserMoveIt->getBiggerBoundFromZero ( theInterestingJoint ).at(0) ;
627 std::cout <<
"[FATAL ERROR FINDACTIONS::" << __func__ <<
"]: Inserting in tipFlexMap a tip already present??" << std::endl
628 <<
"I am returning a not completely filled map" << std::endl;
639 std::map <std::string, ROSEE::ActionTrig> fingFlexMap;
641 for (
auto tipName :
parserMoveIt->getFingertipNames() ) {
643 if (
parserMoveIt->getNExclusiveJointsOfTip ( tipName,
false ) < 2 ) {
648 std::string theInterestingJoint =
parserMoveIt->getFirstActuatedJointInFinger ( tipName );
649 double fingFlexMax =
parserMoveIt->getBiggerBoundFromZero ( theInterestingJoint ).at(0) ;
658 std::cout <<
"[FATAL ERROR FINDACTIONS::" << __func__ <<
"]: Inserting in fingFlexMap a tip already present??n" << std::endl
659 <<
"I am returning a not completely filled map" << std::endl;
671 if ( itMap == trigMap.end() ) {
677 jp.insert ( std::make_pair ( it->getName(), jPos ));
681 jp.at ( jointName ).at(0) = trigValue;
691 JointPos jp = itMap->second.getJointPos();
693 jp.at (jointName).at(0) = trigValue;
694 itMap->second.setJointPos(jp);
708 for (
auto actJ :
parserMoveIt->getActiveJointModels()) {
710 const double* pos = kinematic_state->getJointPositions(actJ);
711 unsigned posSize =
sizeof(pos) /
sizeof(
double);
712 std::vector <double> vecPos(pos, pos + posSize);
713 jp.insert(std::make_pair(actJ->getName(), vecPos));
724 for (
auto fingerEl1 :
parserMoveIt->getFingertipOfFingerMap() ) {
725 for (
auto fingerEl2 :
parserMoveIt->getFingertipOfFingerMap() ) {
728 if (fingerEl1.first < fingerEl2.first) {
729 mapOfLoosePinches->insert (std::make_pair (std::make_pair (fingerEl1.first, fingerEl2.first),
ActionPinchLoose(fingerEl1.first, fingerEl2.first)));
731 }
else if (fingerEl1.first > fingerEl2.first) {
732 mapOfLoosePinches->insert (std::make_pair (std::make_pair (fingerEl2.first, fingerEl1.first),
ActionPinchLoose(fingerEl2.first, fingerEl1.first)));
738 for (
const auto mapEl : *mapOfPinches){
739 mapOfLoosePinches->erase(mapEl.first);
747 std::pair < std::string, std::string > tipsNames,
JointPos *jPos) {
751 for (
auto &jp : *jPos) {
753 jointsInvolvedCount.insert ( std::make_pair (jp.first, 1) );
770 std::vector < std::string> tips =
parserMoveIt->getFingertipsOfJointMap().at(jp.first);
773 if (std::find (tips.begin(), tips.end(), tipsNames.first) == tips.end() &&
774 std::find (tips.begin(), tips.end(), tipsNames.second) == tips.end() ) {
777 jointsInvolvedCount.at ( jp.first ) = 0;
781 return jointsInvolvedCount;
786 std::set< std::string > tipsNames,
JointPos *jPos) {
790 for (
auto &jp : *jPos) {
792 jointsInvolvedCount.insert ( std::make_pair (jp.first, 0) );
795 std::vector < std::string> tips =
parserMoveIt->getFingertipsOfJointMap().at(jp.first);
801 for (
auto fingInv : tipsNames ) {
802 if (std::find (tips.begin(), tips.end(), fingInv) != tips.end()) {
803 jointsInvolvedCount.at ( jp.first ) = 1 ;
808 if (jointsInvolvedCount.at ( jp.first ) == 0 ) {
814 return jointsInvolvedCount;
820 for (
auto joint :
parserMoveIt->getPassiveJointNames()){
851 p.DefineVar(
"x", &fatherPos);
852 p.SetExpr(el.second.second);
856 catch (mu::Parser::exception_type &e)
858 std::cout << e.GetMsg() << std::endl;
859 std::cout <<
"[FINDACTIONS " << __func__ <<
"] Parsing of non linear function for mimic joint " 860 <<
"'" << el.first <<
"'. Please be sure to put characther 'x' as (unique) variable for father position" 861 <<
"in the expression. Have you used syntax valid for muparser?. Expression found: '" 862 << el.second.second <<
"'" << std::endl;
869 std::vector<double> one_dof ;
870 one_dof.push_back(mimPos);
889 std::pair <std::string, std::string> fingersPair = std::make_pair (
894 if ( fingersPair.first.compare (fingersPair.second) > 0 ) {
895 auto temp = fingersPair.first;
896 fingersPair.first = fingersPair.second;
897 fingersPair.second = temp;
899 }
else if (fingersPair.first.compare (fingersPair.second) == 0 ) {
900 std::cout <<
"[FINDACTIONS " << __func__ <<
"] STRANGE ERROR: '" << tipsPair.first <<
901 "' and '" << tipsPair.second <<
"' are in the same finger '" << fingersPair.first <<
902 "' so this pair can't perform a pinch" << std::endl;
903 return std::pair<std::string, std::string>();
911 std::set <std::string> fingersSet;
912 for (
auto it : tipsSet) {
914 fingersSet.insert (
parserMoveIt->getFingerOfFingertip ( it ) );
918 if ( fingersSet.size() < tipsSet.size() ) {
919 std::cout <<
"[FINDACTIONS " << __func__ <<
"] STRANGE ERROR: " <<
920 "the tipsSet passed has some fingertips that belong to the same finger." 921 <<
" I will return an empty set " << std::endl;
923 return std::set <std::string>();
931 std::pair <std::string, std::string> tipsPair = std::make_pair (
933 parserMoveIt->getFingertipOfFinger(fingersPair.second) );
936 if ( tipsPair.first.compare (tipsPair.second) > 0 ) {
937 auto temp = tipsPair.first;
938 tipsPair.first = tipsPair.second;
939 tipsPair.second = temp;
941 }
else if (tipsPair.first.compare (tipsPair.second) == 0 ) {
942 std::cout <<
"[FINDACTIONS " << __func__ <<
"] STRANGE ERROR: '" << fingersPair.first <<
943 "' and '" << fingersPair.second <<
"' have the same fingertip '" << tipsPair.first <<
944 "' so this pair can't perform a pinch" << std::endl;
945 return std::pair<std::string, std::string>();
void setJointPos(JointPos)
void setJointPositions(const std::string &joint_name, const double *position)
Virtual class, Base of all the primitive actions. It has some implemented functions that a derived cl...
std::map< std::string, ROSEE::ActionSingleJointMultipleTips > findSingleJointMultipleTips(unsigned int nFinger, std::string path2saveYaml)
std::map< std::string, std::pair< std::string, std::string > > mimicNLRelMap
std::map< std::string, ROSEE::ActionTrig > tipFlex()
We start from each tip. Given a tip, we look for all the joints that move this tip. If it has 2 or more joints that move exclusively that tip ( we count this number with ParserMoveIt::getNExclusiveJointsOfTip ), we say that a tipFlex is possible. If not, we can't move the tip independently from the rest of the finger, so we have a trig action (if ParserMoveIt::getNExclusiveJointsOfTip returns 1 ) or nothing (ParserMoveIt::getNExclusiveJointsOfTip returns 0). If ParserMoveIt::getNExclusiveJointsOfTip return >= 2, starting from the tip, we explore the parents joints, until we found the first actuated joint. This one will be theInterestingJoint which pose we must set. All the other joints (actuated) will have the default position (if no strange errors).
void checkDistances(std::map< std::pair< std::string, std::string >, ROSEE::ActionPinchLoose > *mapOfLoosePinches)
Principal function which fill the mapOfLoosePinches basing on minumun distance between tips...
std::map< std::string, std::vector< double > > JointPos
The map to describe the position of all actuated joints. The key is the name of the string...
std::map< std::string, unsigned int > JointsInvolvedCount
The map to describe, how many times a joint is set by the action. An ActionPrimitive and an ActionCom...
void checkSelfCollision(const collision_detection::CollisionRequest &req, collision_detection::CollisionResult &res)
void setJointsInvolvedCount(ROSEE::JointsInvolvedCount jointsInvolvedCount)
Class to describe the action of "pinching" with more than 2 tips (with 2 tips there is the ActionPinc...
void checkWhichTipsCollideWithoutBounds(std::map< std::pair< std::string, std::string >, ROSEE::ActionPinchLoose > *mapOfLoosePinches)
Function similar to checkCollisions but used for Loose Pinches. First, we temporarily remove bounds o...
std::map< std::pair< std::string, std::string >, ROSEE::ActionPinchTight > checkCollisions()
principal function which check for collisions with moveit functions when looking for tight pinches ...
The action of pinch with two tips. The two tips must not collide ever (otherwise we have a TightPinch...
void setToDefaultPositionPassiveJoints(moveit::core::RobotState *kinematic_state)
set to DEFAULT_JOINT_POS all the passive joints (defined so in the urdf file). this is necessary beca...
std::map< std::set< std::string >, ROSEE::ActionMultiplePinchTight > findMultiplePinch(unsigned int nFinger, std::string path2saveYaml, bool strict=true)
Finder for MultiplePinch (a pinch done with more than 2 finger). This function return the found multp...
EIGEN_MAKE_ALIGNED_OPERATOR_NEW void clear()
std::shared_ptr< ROSEE::ParserMoveIt > parserMoveIt
#define N_EXP_COLLISION_MULTPINCH
void removeBoundsOfNotCollidingTips(const std::map< std::pair< std::string, std::string >, ROSEE::ActionPinchLoose > *mapOfLoosePinches, robot_model::RobotModelPtr kinematic_model_noBound)
Support function to remove the joint limits from the model. This is done when looking for Loose Pinch...
std::string getFingerInvolved() const
Specific method of trig to simply return a string instead of the full vector fingersInvolved that in ...
std::map< std::string, ROSEE::ActionTrig > fingFlex()
We start from each tip. Given a tip, we check if ParserMoveIt::getNExclusiveJointsOfTip >= 2 (see tip...
std::map< std::string, ActionTrig > trig()
trig is the action of closing a SINGLE finger towards the palm. The position is the bound which is fa...
Type
Enum useful to discriminate each primitive action when, for example, we want to parse a file if you ...
JointPos getConvertedJointPos(const robot_state::RobotState *kinematic_state)
Utility function to take the actuated joint positions from a kinematic_state and returns the same inf...
The action of moving some joints (see later) of a single finger in a full clousure position towards t...
bool enforcePositionBounds(double *values) const
std::set< std::string > getFingersSet(std::set< std::string > tipsSet) const
Function used when looking for multiple pinches. It returns the set containing the fingers of the pas...
bool insertJointPosForTrigInMap(std::map< std::string, ActionTrig > &trigMap, ROSEE::ActionTrig action, std::string jointName, double trigValue)
Insert/update an ActionTrig in the trigMap. This is done setting the jointName position to the given ...
static int binomial_coefficent(int n, int k)
std::map< std::set< std::string >, ROSEE::ActionMultiplePinchTight > checkCollisionsForMultiplePinch(unsigned int nFinger, bool strict)
support function for findMultiplePinch (a pinch done with more than 2 finger). This is done similarly...
void setToRandomPositions(robot_state::RobotState *kinematic_state)
This function set the random position of joint considering:
void fillNotCollidingTips(std::map< std::pair< std::string, std::string >, ROSEE::ActionPinchLoose > *mapOfLoosePinches, const std::map< std::pair< std::string, std::string >, ROSEE::ActionPinchTight > *mapOfPinches)
function to "initialize" the map of ActionPinchLoose mapOfLoosePinches. It is done adding all the tip...
std::map< std::string, ROSEE::ActionTrig > findTrig(ROSEE::ActionPrimitive::Type actionType, std::string path2saveYaml)
Function to look for trigs (trig, tipFlex and fingFlex). The type of trig to be looked for is choosen...
void setEntry(const std::string &name1, const std::string &name2, bool allowed)
void setFingerInvolved(std::string)
void setToRandomPositions()
std::pair< std::string, std::string > getFingertipsPair(std::pair< std::string, std::string > fingersPair) const
Given the fingersPair, this function return the pair of their fingers, in lexicographical order...
The action of pinch with two tips. The two tips must collide for some hand configuration to mark this...
FindActions(std::shared_ptr< ROSEE::ParserMoveIt > parserMoveit)
ROSEE::JointsInvolvedCount setOnlyDependentJoints(std::pair< std::string, std::string > tipsNames, JointPos *jPos)
Given the contact, we want to know the state of the joint to replicate it. But we want to know only t...
const JointModel * getJointModel(const std::string &joint) const
std::pair< std::map< std::pair< std::string, std::string >, ROSEE::ActionPinchTight >, std::map< std::pair< std::string, std::string >, ROSEE::ActionPinchLoose > > findPinch(std::string path2saveYaml)
Function to look for pinches, both Tight and Loose ones. It fill the maps (returned as pair)...
Primitive which indicate a motion of n fingers moving ONLY ONE joint. For example, this primitive is necessary for the hands that have one joint that close all the fingers to do a grasp. But it can also useful to detect other multiple finger motions (like a "spread finger")
double distance(const urdf::Pose &transform)
const double * getJointPositions(const std::string &joint_name) const
std::pair< std::string, std::string > getFingersPair(std::pair< std::string, std::string > tipsPair) const
Giving as argument a pair of fingertips, this function return a pair of fingers that are the fingers ...
std::string createYamlFile(const std::map< std::set< std::string >, ActionPrimitive * > mapOfActions, const std::string actionName, std::string pathFolder)
Create/overwrite yaml file and emit info on it about each ActionPrimitive inside the given mapOfActio...
#define DEFAULT_JOINT_POS