Go to the documentation of this file.
30 int main (
int argc,
char **argv ) {
40 ROS_INFO_STREAM(
"FINDACTIONS: Set urdf and srdf file in the param server");
42 std::shared_ptr <ROSEE::ParserMoveIt> parserMoveIt = std::make_shared <ROSEE::ParserMoveIt> ();
43 if (! parserMoveIt->init (
"robot_description") ) {
48 parserMoveIt->parseNonLinearMimicRelations(parser.
getUrdfString());
55 auto maps = actionsFinder.
findPinch(folderForActions +
"/primitives/");
57 std::map <std::string, ROSEE::ActionTrig> trigMap = actionsFinder.
findTrig (ROSEE::ActionPrimitive::Type::Trig,
58 folderForActions +
"/primitives/") ;
60 std::map <std::string, ROSEE::ActionTrig> tipFlexMap = actionsFinder.
findTrig (ROSEE::ActionPrimitive::Type::TipFlex,
61 folderForActions +
"/primitives/");
63 std::map <std::string, ROSEE::ActionTrig> fingFlexMap = actionsFinder.
findTrig (ROSEE::ActionPrimitive::Type::FingFlex,
64 folderForActions +
"/primitives/");
65 unsigned int nFinger = 3;
66 std::map < std::string, ROSEE::ActionSingleJointMultipleTips> singleJointMultipleTipsMap =
70 std::map < std::string, ROSEE::ActionSingleJointMultipleTips> singleJointMultipleTipsMap2 =
74 std::map < std::string, ROSEE::ActionSingleJointMultipleTips> singleJointMultipleTipsMap5 =
77 auto mulPinch = actionsFinder.
findMultiplePinch(3, folderForActions +
"/primitives/" );
87 std::cout <<
"PARSED MAP OF PINCHESTIGHT FROM YAML FILE:" << std::endl;
91 std::cout <<
"PARSED MAP OF PINCHESLOOSE FROM YAML FILE:" << std::endl;
95 std::cout <<
"PARSED MAP OF TRIGS FROM YAML FILE:" << std::endl;
99 std::cout <<
"PARSED MAP OF TIPFLEX FROM YAML FILE:" << std::endl;
103 std::cout <<
"PARSED MAP OF FINGFLEX FROM YAML FILE:" << std::endl;
107 std::cout <<
"PARSED MAP OF SINGLEJOINTMULTIPLETIPS_3 FROM YAML FILE:" << std::endl;
108 for (
auto &i : mapsHandler.
getPrimitiveMap(
"singleJointMultipleTips_3")) {
111 std::cout <<
"DEBUG MULTIPINCH PARSED: " << std::endl;
203 yamlWorker.
createYamlFile (&schunkGrasp, folderForActions +
"/generics/");
208 0, 0.7, 0, 0.4,
"FingerSpread");
211 0, 0.7, 0, 0.47,
"Opposition");
213 ROSEE::Action::Ptr schunkTipFlexs = std::make_shared<ROSEE::ActionComposed>(
"TipFlexes",
true);
217 schunkTipFlexsCasted->sumAction (mapsHandler.
getPrimitive(
"tipFlex",
"index"), 0.84);
218 schunkTipFlexsCasted->sumAction (mapsHandler.
getPrimitive(
"tipFlex",
"middle"), 0.76);
219 schunkTipFlexsCasted->sumAction (mapsHandler.
getPrimitive(
"trig",
"thumb"), 0.8);
221 actionTimed.
insertAction( schunkTipFlexs, 0.6, 0.2, 0, 1,
"TipFlexes");
225 yamlWorker.
createYamlFile ( &actionTimed, folderForActions +
"/timeds/" );
237 0, 1, 0, 1,
"OpenWide");
240 0, 0, 0, 0.6,
"Grasp");
242 yamlWorker.
createYamlFile ( &actionTimed, folderForActions +
"/timeds/" );
245 }
else if (parserMoveIt->getHandName().compare(
"heri_II") == 0 ) {
250 ROSEE::Action::Ptr grasp3f = std::make_shared<ROSEE::ActionComposed>(
"grasp3f",
true);
251 std::shared_ptr<ROSEE::ActionComposed> grasp3f_casted = std::dynamic_pointer_cast<ROSEE::ActionComposed> (grasp3f);
253 grasp3f_casted->sumAction(mapsHandler.
getPrimitive(
"trig",
"finger_1"));
254 grasp3f_casted->sumAction(mapsHandler.
getPrimitive(
"trig",
"finger_2"));
255 grasp3f_casted->sumAction(mapsHandler.
getPrimitive(
"trig",
"thumb"));
261 actionTimed.
insertAction( grasp3f, 0, 0, 0, 1,
"Grasp3f");
265 yamlWorker.
createYamlFile ( &actionTimed, folderForActions +
"/timeds/" );
268 std::cout <<
"The timed action parsed: " << std::endl;
269 mapsHandler.
getTimed(
"drill")->print();
bool parseAllPrimitives(std::string pathFolder)
void setParam(const std::string &key, bool b) const
std::string getEndEffectorName() const
getter for the configure End-Effector name
An action composed by other ones that must be executed one after other with some wait time (also 0) i...
#define ROS_ERROR_STREAM(args)
std::shared_ptr< ROSEE::ActionTimed > getTimed(std::string name) const
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...
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
bool parseAllTimeds(std::string pathFolder)
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...
std::shared_ptr< ActionComposed > Ptr
Class to check which fingertips collide (for the pinch action at the moment)
int main(int argc, char **argv)
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...
std::string getSrdfString() const
get the whole srdf file parsed as a string
std::map< std::string, ROSEE::ActionSingleJointMultipleTips > findSingleJointMultipleTips(unsigned int nFinger, std::string path2saveYaml)
std::vector< ActionPrimitiveMap > getPrimitiveMap(ROSEE::ActionPrimitive::Type type) const
getter to take all the primitives maps of one type (
ROSEE::ActionPrimitive::Ptr getPrimitive(std::string primitiveName, std::set< std::string > key) const
std::string getActionPath() const
get the path where emit and parse grasping actions
void print() const override
Print info about this action.
virtual bool sumAction(ROSEE::Action::Ptr action, double jointPosScaleFactor=1.0, unsigned int jointPosIndex=0)
Function to add another action to this one.
#define ROS_INFO_STREAM(args)
std::string getUrdfString() const
get the whole urdf file parsed as a string
bool init()
Initialization function using the ROS param ROSEEConfigPath.
std::shared_ptr< Action > Ptr
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),...
Class responsible for parsing the YAML file providing the URDF, SRDF, the EE-HAL library implementati...
A ActionComposed, which is formed by one or more Primitives (or even other composed)....
bool insertAction(ROSEE::Action::Ptr action, double marginBefore=0.0, double marginAfter=0.0, unsigned int jointPosIndex=0, double percentJointPos=1, std::string newActionName="")
Insert an action as last one in the time line.
end-effector
Author(s): Luca Muratore
, Davide Torielli , Liana Bertoni
autogenerated on Sat Dec 14 2024 03:49:26