Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ROSEE::MapActionHandler Class Reference

#include <MapActionHandler.h>

Public Types

typedef std::map< std::set< std::string >, ROSEE::ActionPrimitive::PtrActionPrimitiveMap
 
typedef std::shared_ptr< MapActionHandlerPtr
 

Public Member Functions

std::map< std::string, std::shared_ptr< ROSEE::ActionGeneric > > getAllGenerics () const
 
std::map< std::string, ActionPrimitiveMapgetAllPrimitiveMaps () const
 
std::map< std::string, std::shared_ptr< ROSEE::ActionTimed > > getAllTimeds () const
 
std::set< std::string > getFingertipsForPinch (std::string finger, ROSEE::ActionPrimitive::Type pinchType) const
 
std::shared_ptr< ROSEE::ActionGenericgetGeneric (std::string name, bool verbose=true) const
 
ROSEE::Action::Ptr getGrasp (unsigned int nFingers, std::string graspName="grasp")
 This function try to get an action that should be a grasp. More...
 
std::map< std::string, std::set< std::string > > getPinchLoosePairsMap () const
 
std::map< std::string, std::set< std::string > > getPinchTightPairsMap () const
 
ROSEE::ActionPrimitive::Ptr getPrimitive (std::string primitiveName, std::set< std::string > key) const
 
std::vector< ROSEE::ActionPrimitive::PtrgetPrimitive (ROSEE::ActionPrimitive::Type, std::set< std::string > key) const
 
ROSEE::ActionPrimitive::Ptr getPrimitive (std::string primitiveName, std::vector< std::string > key) const
 
std::vector< ROSEE::ActionPrimitive::PtrgetPrimitive (ROSEE::ActionPrimitive::Type, std::vector< std::string > key) const
 
ROSEE::ActionPrimitive::Ptr getPrimitive (std::string primitiveName, std::pair< std::string, std::string > key) const
 
std::vector< ROSEE::ActionPrimitive::PtrgetPrimitive (ROSEE::ActionPrimitive::Type, std::pair< std::string, std::string > key) const
 
ROSEE::ActionPrimitive::Ptr getPrimitive (std::string primitiveName, std::string key) const
 
std::vector< ROSEE::ActionPrimitive::PtrgetPrimitive (ROSEE::ActionPrimitive::Type, std::string key) const
 
std::vector< ActionPrimitiveMapgetPrimitiveMap (ROSEE::ActionPrimitive::Type type) const
 getter to take all the primitives maps of one type ( More...
 
ActionPrimitiveMap getPrimitiveMap (std::string primitiveName) const
 
std::map< std::string, ROSEE::ActionPrimitive::PtrgetPrimitiveSingleJointMultipleTipsMap (unsigned int nFingers) const
 function to return the map that contains all the singleJointMultipleTips primitive with that moves the specific number of fingers nFingers . This is in practice, the file singleJointMultipleTips_*nFingers*.yaml More...
 
std::shared_ptr< ROSEE::ActionTimedgetTimed (std::string name) const
 
bool insertSingleGeneric (ROSEE::ActionGeneric::Ptr generic)
 This is needed by rosservicehandler which has to include a new doable action, if received the service. More...
 
 MapActionHandler ()
 
bool parseAllActions (std::string pathFolder)
 
bool parseAllGenerics (std::string pathFolder)
 
bool parseAllPrimitives (std::string pathFolder)
 
bool parseAllTimeds (std::string pathFolder)
 

Private Member Functions

void findPinchPairsMap ()
 

Private Attributes

std::map< std::string, std::shared_ptr< ROSEE::ActionGeneric > > generics
 
std::string handName
 
std::map< std::string, std::set< std::string > > pinchLoosePairsMap
 
std::map< std::string, std::set< std::string > > pinchTightPairsMap
 
std::map< std::string, ActionPrimitiveMapprimitives
 
std::map< std::string, std::shared_ptr< ROSEE::ActionTimed > > timeds
 

Detailed Description

Todo:
write docs

Definition at line 39 of file MapActionHandler.h.

Member Typedef Documentation

◆ ActionPrimitiveMap

Definition at line 47 of file MapActionHandler.h.

◆ Ptr

Definition at line 43 of file MapActionHandler.h.

Constructor & Destructor Documentation

◆ MapActionHandler()

ROSEE::MapActionHandler::MapActionHandler ( )

Definition at line 19 of file MapActionHandler.cpp.

Member Function Documentation

◆ findPinchPairsMap()

void ROSEE::MapActionHandler::findPinchPairsMap ( )
private

Definition at line 389 of file MapActionHandler.cpp.

◆ getAllGenerics()

std::map< std::string, std::shared_ptr< ROSEE::ActionGeneric > > ROSEE::MapActionHandler::getAllGenerics ( ) const

Definition at line 187 of file MapActionHandler.cpp.

◆ getAllPrimitiveMaps()

std::map< std::string, ROSEE::MapActionHandler::ActionPrimitiveMap > ROSEE::MapActionHandler::getAllPrimitiveMaps ( ) const

Definition at line 48 of file MapActionHandler.cpp.

◆ getAllTimeds()

std::map< std::string, std::shared_ptr< ROSEE::ActionTimed > > ROSEE::MapActionHandler::getAllTimeds ( ) const

Definition at line 202 of file MapActionHandler.cpp.

◆ getFingertipsForPinch()

std::set< std::string > ROSEE::MapActionHandler::getFingertipsForPinch ( std::string  finger,
ROSEE::ActionPrimitive::Type  pinchType 
) const

Definition at line 256 of file MapActionHandler.cpp.

◆ getGeneric()

std::shared_ptr< ROSEE::ActionGeneric > ROSEE::MapActionHandler::getGeneric ( std::string  name,
bool  verbose = true 
) const
Note
these functions return generics and composed (because composed are a derived class of generic)

Definition at line 174 of file MapActionHandler.cpp.

◆ getGrasp()

ROSEE::Action::Ptr ROSEE::MapActionHandler::getGrasp ( unsigned int  nFingers,
std::string  graspName = "grasp" 
)

This function try to get an action that should be a grasp.

A real grasp, until now, can be two things:

  • a generic/composed action, composed by trig with all the fingers
  • a SingleJointMultipleTips primitive action, where the number of fingers moved is obviously the number of finger of the hand In the second case, if we have more joints that moves all the fingers, we return no action because we do not know which one is "the grasp". If we have only one joint that move all fingers, we return the singleJointMultipleTips action associated with this joint, even if there is the possibility that this is not a grasp (but which hand has only one joint that moves all fingers and it is not for a grasp?)

This function look first for a generic (or composed, that is a derived class of generic) action with name graspName , that should have been created and emitted before calling the parseAllActions (or parseAllGenerics) (e.g. in UniversalFindActions putting all the trigs togheter, but we can also define the grasp in another way).

Parameters
nFingersthe number of the finger of the hand, that is an information that this class hasn't
graspNamename given to the action grasp, default is "grasp"
Returns
pointer to Action, because the pointed object can be a primitive or a generic action.
Todo:
If not found, it tries to create a composed action, done with all trigs, and store this new action??
Warning
Generic and singleJointMultipleTips are different ros msg: singleJointMultipleTips want a element to be set (the joint) so this can cause problems.. so maybe this function should not exist

Definition at line 234 of file MapActionHandler.cpp.

◆ getPinchLoosePairsMap()

std::map< std::string, std::set< std::string > > ROSEE::MapActionHandler::getPinchLoosePairsMap ( ) const

Definition at line 170 of file MapActionHandler.cpp.

◆ getPinchTightPairsMap()

std::map< std::string, std::set< std::string > > ROSEE::MapActionHandler::getPinchTightPairsMap ( ) const

Definition at line 166 of file MapActionHandler.cpp.

◆ getPrimitive() [1/8]

ROSEE::ActionPrimitive::Ptr ROSEE::MapActionHandler::getPrimitive ( std::string  primitiveName,
std::set< std::string >  key 
) const

Definition at line 52 of file MapActionHandler.cpp.

◆ getPrimitive() [2/8]

std::vector< ROSEE::ActionPrimitive::Ptr > ROSEE::MapActionHandler::getPrimitive ( ROSEE::ActionPrimitive::Type  type,
std::set< std::string >  key 
) const

Definition at line 101 of file MapActionHandler.cpp.

◆ getPrimitive() [3/8]

ROSEE::ActionPrimitive::Ptr ROSEE::MapActionHandler::getPrimitive ( std::string  primitiveName,
std::vector< std::string >  key 
) const

Definition at line 83 of file MapActionHandler.cpp.

◆ getPrimitive() [4/8]

std::vector< ROSEE::ActionPrimitive::Ptr > ROSEE::MapActionHandler::getPrimitive ( ROSEE::ActionPrimitive::Type  type,
std::vector< std::string >  key 
) const

Definition at line 148 of file MapActionHandler.cpp.

◆ getPrimitive() [5/8]

ROSEE::ActionPrimitive::Ptr ROSEE::MapActionHandler::getPrimitive ( std::string  primitiveName,
std::pair< std::string, std::string >  key 
) const

Definition at line 95 of file MapActionHandler.cpp.

◆ getPrimitive() [6/8]

std::vector< ROSEE::ActionPrimitive::Ptr > ROSEE::MapActionHandler::getPrimitive ( ROSEE::ActionPrimitive::Type  type,
std::pair< std::string, std::string >  key 
) const

Definition at line 160 of file MapActionHandler.cpp.

◆ getPrimitive() [7/8]

ROSEE::ActionPrimitive::Ptr ROSEE::MapActionHandler::getPrimitive ( std::string  primitiveName,
std::string  key 
) const

Definition at line 89 of file MapActionHandler.cpp.

◆ getPrimitive() [8/8]

std::vector< ROSEE::ActionPrimitive::Ptr > ROSEE::MapActionHandler::getPrimitive ( ROSEE::ActionPrimitive::Type  type,
std::string  key 
) const

Definition at line 154 of file MapActionHandler.cpp.

◆ getPrimitiveMap() [1/2]

std::vector< ROSEE::MapActionHandler::ActionPrimitiveMap > ROSEE::MapActionHandler::getPrimitiveMap ( ROSEE::ActionPrimitive::Type  type) const

getter to take all the primitives maps of one type (

Parameters
type)A primitive map is a map where key is the element involved (joints or fingers) and values the action primitive itself It returns a vector (differently from version with string as argument) because we can have more primitives with same type (e.g. a singleJointMultipleTips primitive, which are differente between them because of the joint they move (singleJointMultipleTips_5 , singleJointMultipleTips_4 ... ) , or also multipinch)). This consideration is valid for all the other getPrimitive
typethe primitive type of the action that we want
Returns
vector of all the primitives that are of type
Parameters
type
Warning
Be sure to call parsing functions (parseAll*** ) otherwise no actions are returned never

Definition at line 32 of file MapActionHandler.cpp.

◆ getPrimitiveMap() [2/2]

ROSEE::MapActionHandler::ActionPrimitiveMap ROSEE::MapActionHandler::getPrimitiveMap ( std::string  primitiveName) const

Definition at line 21 of file MapActionHandler.cpp.

◆ getPrimitiveSingleJointMultipleTipsMap()

std::map< std::string, ROSEE::ActionPrimitive::Ptr > ROSEE::MapActionHandler::getPrimitiveSingleJointMultipleTipsMap ( unsigned int  nFingers) const

function to return the map that contains all the singleJointMultipleTips primitive with that moves the specific number of fingers nFingers . This is in practice, the file singleJointMultipleTips_*nFingers*.yaml

It return only one map because per definition we have only one ActionPrimitiveMap of type singleJointMultipleTips with a defined number of nFinger. (Then inside it we can have more primitives ( when we have a hand with more joints that moves more than 1 finger), but always with the same number of nFinger)

Parameters
nFingersthe number of the finger that the singleJointMultipleTips primitives moves
Returns
A map with key the joint that moves the nFingers and as value the primitive with all the info to command it to the hand. Obvioulsy we can have more joints that move a certain number (nFingers) of fingers
Todo:
return with the key as set instead??? or leave as it is?

Definition at line 207 of file MapActionHandler.cpp.

◆ getTimed()

std::shared_ptr< ROSEE::ActionTimed > ROSEE::MapActionHandler::getTimed ( std::string  name) const

Definition at line 191 of file MapActionHandler.cpp.

◆ insertSingleGeneric()

bool ROSEE::MapActionHandler::insertSingleGeneric ( ROSEE::ActionGeneric::Ptr  generic)

This is needed by rosservicehandler which has to include a new doable action, if received the service.

Definition at line 365 of file MapActionHandler.cpp.

◆ parseAllActions()

bool ROSEE::MapActionHandler::parseAllActions ( std::string  pathFolder)

Definition at line 301 of file MapActionHandler.cpp.

◆ parseAllGenerics()

bool ROSEE::MapActionHandler::parseAllGenerics ( std::string  pathFolder)

Definition at line 334 of file MapActionHandler.cpp.

◆ parseAllPrimitives()

bool ROSEE::MapActionHandler::parseAllPrimitives ( std::string  pathFolder)
Parameters
folderwhere the action are. the action will be look in (<pkg_path> + pathFolder + "/" + handName + "/") ;

Definition at line 318 of file MapActionHandler.cpp.

◆ parseAllTimeds()

bool ROSEE::MapActionHandler::parseAllTimeds ( std::string  pathFolder)

Definition at line 351 of file MapActionHandler.cpp.

Member Data Documentation

◆ generics

std::map<std::string, std::shared_ptr<ROSEE::ActionGeneric> > ROSEE::MapActionHandler::generics
private

Definition at line 167 of file MapActionHandler.h.

◆ handName

std::string ROSEE::MapActionHandler::handName
private

Definition at line 164 of file MapActionHandler.h.

◆ pinchLoosePairsMap

std::map<std::string, std::set<std::string> > ROSEE::MapActionHandler::pinchLoosePairsMap
private

Definition at line 171 of file MapActionHandler.h.

◆ pinchTightPairsMap

std::map<std::string, std::set<std::string> > ROSEE::MapActionHandler::pinchTightPairsMap
private

Definition at line 170 of file MapActionHandler.h.

◆ primitives

std::map<std::string, ActionPrimitiveMap> ROSEE::MapActionHandler::primitives
private

Definition at line 166 of file MapActionHandler.h.

◆ timeds

std::map<std::string, std::shared_ptr<ROSEE::ActionTimed> > ROSEE::MapActionHandler::timeds
private

Definition at line 168 of file MapActionHandler.h.


The documentation for this class was generated from the following files:


end-effector
Author(s): Luca Muratore , Davide Torielli , Liana Bertoni
autogenerated on Tue Apr 5 2022 02:57:53