Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ROSEE::ActionComposed Class Reference

A ActionComposed, which is formed by one or more Primitives (or even other composed). It is useful for example to create an action that grasp only with bending the tips (e.g. to take a dish from above) If the ActionComposed has the boolean value independent to true, it means that include indipendent sub-actions, so, each joint is used by at maximum by ONLY ONE of the sub-action inside. In this case the jointsInvolvedCount will contain only 0 or 1 values. If the ActionComposed is not independent, each joint position is calculated as the mean of all the joint position of the contained sub-actions that uses that joint. So each mean can include different primitives, so we used the jointsInvolvedCount vector to store the number of sub action that use each joint. More...

#include <ActionComposed.h>

Inheritance diagram for ROSEE::ActionComposed:
Inheritance graph
[legend]

Public Types

typedef std::shared_ptr< const ActionComposedConstPtr
 
typedef std::shared_ptr< ActionComposedPtr
 
- Public Types inherited from ROSEE::ActionGeneric
typedef std::shared_ptr< const ActionGenericConstPtr
 
typedef std::shared_ptr< ActionGenericPtr
 
- Public Types inherited from ROSEE::Action
typedef std::shared_ptr< const ActionConstPtr
 
typedef std::shared_ptr< ActionPtr
 
enum  Type {
  Primitive, Generic, Composed, Timed,
  None
}
 Enum useful to discriminate each action when, for example, we want to parse a file if you change this enum, change also the ROSEEControl.msg accordingly. More...
 

Public Member Functions

 ActionComposed ()
 
 ActionComposed (std::string name)
 
 ActionComposed (std::string name, bool independent)
 
 ActionComposed (const ActionComposed &other)
 Copy costructor. More...
 
virtual void emitYaml (YAML::Emitter &out) const override
 Emit info in a file with yaml format. More...
 
bool empty ()
 Check if the action composed is empty. More...
 
virtual bool fillFromYaml (YAML::const_iterator yamlIt) override
 Fill the internal data with infos taken from yaml file. More...
 
std::vector< std::string > getInnerActionsNames () const
 
bool isIndependent () const
 
unsigned int numberOfInnerActions () const
 
virtual void print () const override
 Print info about this action (name, jointpos, inner actions names, and other) More...
 
virtual bool sumAction (ROSEE::Action::Ptr action, double jointPosScaleFactor=1.0, unsigned int jointPosIndex=0)
 Function to add another action to this one. More...
 
- Public Member Functions inherited from ROSEE::ActionGeneric
 ActionGeneric ()
 default costructor. It is used when parsing a file with YamlWorker, More...
 
 ActionGeneric (std::string actionName, ROSEE::JointPos jointPos)
 Simpliest costructor, need only essential infos. More...
 
 ActionGeneric (std::string actionName, ROSEE::JointPos jointPos, JointsInvolvedCount jic)
 Another costructor. More...
 
 ActionGeneric (std::string actionName, ROSEE::JointPos jointPos, JointsInvolvedCount jic, std::set< std::string > fingersInvolved)
 
std::vector< ROSEE::JointPosgetAllJointPos () const override
 Get the joint position related to this action, overriden from Action Necessary to not make this class abstact, even if for a composed action we store only a single JointPos, so this function return a single element vector. More...
 
JointPos getJointPos () const override
 Get the joint position related to this action, overriden from Action. More...
 
- Public Member Functions inherited from ROSEE::Action
std::set< std::string > getFingersInvolved () const
 Get for fingersInvolved. More...
 
JointsInvolvedCount getJointsInvolvedCount () const
 Get for jointsInvolvedCount. More...
 
std::string getName () const
 Get the name of the action. More...
 
Type getType () const
 
virtual ~Action ()
 

Protected Member Functions

bool checkIndependency (ROSEE::Action::Ptr action)
 
- Protected Member Functions inherited from ROSEE::ActionGeneric
 ActionGeneric (std::string actionName)
 this costructor is only for derived class More...
 
- Protected Member Functions inherited from ROSEE::Action
 Action ()
 
 Action (std::string actionName, Action::Type type)
 

Protected Attributes

bool independent
 
std::vector< std::string > innerActionsNames
 
unsigned int nInnerActions
 
- Protected Attributes inherited from ROSEE::ActionGeneric
JointPos jointPos
 
- Protected Attributes inherited from ROSEE::Action
std::set< std::string > fingersInvolved
 
JointsInvolvedCount jointsInvolvedCount
 
std::string name
 
Action::Type type
 

Detailed Description

A ActionComposed, which is formed by one or more Primitives (or even other composed). It is useful for example to create an action that grasp only with bending the tips (e.g. to take a dish from above) If the ActionComposed has the boolean value independent to true, it means that include indipendent sub-actions, so, each joint is used by at maximum by ONLY ONE of the sub-action inside. In this case the jointsInvolvedCount will contain only 0 or 1 values. If the ActionComposed is not independent, each joint position is calculated as the mean of all the joint position of the contained sub-actions that uses that joint. So each mean can include different primitives, so we used the jointsInvolvedCount vector to store the number of sub action that use each joint.

Todo:
A removeAction function? difficult to implement, and useless?

Definition at line 44 of file ActionComposed.h.

Member Typedef Documentation

◆ ConstPtr

typedef std::shared_ptr<const ActionComposed> ROSEE::ActionComposed::ConstPtr

Definition at line 49 of file ActionComposed.h.

◆ Ptr

typedef std::shared_ptr<ActionComposed> ROSEE::ActionComposed::Ptr

Definition at line 48 of file ActionComposed.h.

Constructor & Destructor Documentation

◆ ActionComposed() [1/4]

ROSEE::ActionComposed::ActionComposed ( )

Definition at line 21 of file ActionComposed.cpp.

◆ ActionComposed() [2/4]

ROSEE::ActionComposed::ActionComposed ( std::string  name)

Definition at line 27 of file ActionComposed.cpp.

◆ ActionComposed() [3/4]

ROSEE::ActionComposed::ActionComposed ( std::string  name,
bool  independent 
)

Definition at line 33 of file ActionComposed.cpp.

◆ ActionComposed() [4/4]

ROSEE::ActionComposed::ActionComposed ( const ActionComposed other)

Copy costructor.

Member Function Documentation

◆ checkIndependency()

bool ROSEE::ActionComposed::checkIndependency ( ROSEE::Action::Ptr  action)
protected

Definition at line 147 of file ActionComposed.cpp.

◆ emitYaml()

void ROSEE::ActionComposed::emitYaml ( YAML::Emitter &  out) const
overridevirtual

Emit info in a file with yaml format.

Parameters
outa YAML::Emitter& object to emit the infos

Reimplemented from ROSEE::ActionGeneric.

Definition at line 208 of file ActionComposed.cpp.

◆ empty()

bool ROSEE::ActionComposed::empty ( )

Check if the action composed is empty.

Returns
true if empty, false otherwise

Definition at line 51 of file ActionComposed.cpp.

◆ fillFromYaml()

bool ROSEE::ActionComposed::fillFromYaml ( YAML::const_iterator  yamlIt)
overridevirtual

Fill the internal data with infos taken from yaml file.

Parameters
yamlIta yamlt iterator to a node which has loaded the file
Returns
false if some error happened

Reimplemented from ROSEE::ActionGeneric.

Definition at line 234 of file ActionComposed.cpp.

◆ getInnerActionsNames()

std::vector< std::string > ROSEE::ActionComposed::getInnerActionsNames ( ) const
Returns
std::vector <std::string> all the names that compose this action

Definition at line 47 of file ActionComposed.cpp.

◆ isIndependent()

bool ROSEE::ActionComposed::isIndependent ( ) const
Returns
bool true if this action must contain only independent primitives

Definition at line 43 of file ActionComposed.cpp.

◆ numberOfInnerActions()

unsigned int ROSEE::ActionComposed::numberOfInnerActions ( ) const
Returns
unsigned int the number of the actions that compose this one

Definition at line 39 of file ActionComposed.cpp.

◆ print()

void ROSEE::ActionComposed::print ( ) const
overridevirtual

Print info about this action (name, jointpos, inner actions names, and other)

Reimplemented from ROSEE::Action.

Definition at line 176 of file ActionComposed.cpp.

◆ sumAction()

bool ROSEE::ActionComposed::sumAction ( ROSEE::Action::Ptr  action,
double  jointPosScaleFactor = 1.0,
unsigned int  jointPosIndex = 0 
)
virtual

Function to add another action to this one.

Parameters
actionThe action to be added to the ActionComposed
jointPosScaleFactorHow much scale the joint position values for the action to be inserted. Default to 1
jointPosIndex(default == 0) the wanted jointPos or action to insert. Error the index is greater than the number of joint pos in the action. First element has index 0.
Returns
False if the ActionComposed is independent and we try to add an action that is dependent from one of the already present

Definition at line 56 of file ActionComposed.cpp.

Member Data Documentation

◆ independent

bool ROSEE::ActionComposed::independent
protected

Definition at line 116 of file ActionComposed.h.

◆ innerActionsNames

std::vector< std::string > ROSEE::ActionComposed::innerActionsNames
protected

Definition at line 113 of file ActionComposed.h.

◆ nInnerActions

unsigned int ROSEE::ActionComposed::nInnerActions
protected

Definition at line 114 of file ActionComposed.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