ROSEndEffector
ROS End-Effector package: provides a ROS-based set of standard interfaces to command robotics end-effectors in an agnostic fashion.
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ROSEE::Action Class Referenceabstract

The pure virtual class representing an Action. More...

#include <Action.h>

+ Inheritance diagram for ROSEE::Action:
+ Collaboration diagram for ROSEE::Action:

Public Types

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...
 
typedef std::shared_ptr< ActionPtr
 
typedef std::shared_ptr< const ActionConstPtr
 

Public Member Functions

virtual ~Action ()
 
std::string getName () const
 Get the name of the action. More...
 
Type getType () const
 
std::set< std::string > getFingersInvolved () const
 Get for fingersInvolved. More...
 
JointsInvolvedCount getJointsInvolvedCount () const
 Get for jointsInvolvedCount. More...
 
virtual JointPos getJointPos () const =0
 Get the position related to this action. More...
 
virtual std::vector< ROSEE::JointPosgetAllJointPos () const =0
 Return all the joint position stored. More...
 
virtual void print () const
 Overridable functions, if we want to make them more action-specific. More...
 
virtual void emitYaml (YAML::Emitter &out) const =0
 Function to fill the argument passed with info about the action. More...
 
virtual bool fillFromYaml (YAML::const_iterator yamlIt)=0
 function to fill members of the Action with infos taken from yaml files More...
 

Protected Member Functions

 Action ()
 
 Action (std::string actionName, Action::Type type)
 

Protected Attributes

std::string name
 
Action::Type type
 
std::set< std::string > fingersInvolved
 
JointsInvolvedCount jointsInvolvedCount
 

Detailed Description

The pure virtual class representing an Action.

It has members that are in common to all derived class

Definition at line 71 of file Action.h.

Member Typedef Documentation

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

Definition at line 76 of file Action.h.

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

Definition at line 75 of file Action.h.

Member Enumeration Documentation

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.

Enumerator
Primitive 
Generic 
Composed 
Timed 
None 

Definition at line 82 of file Action.h.

Constructor & Destructor Documentation

virtual ROSEE::Action::~Action ( )
inlinevirtual

Definition at line 85 of file Action.h.

85 {};
ROSEE::Action::Action ( )
protected

Definition at line 106 of file Action.cpp.

106  {
107 
108 }
ROSEE::Action::Action ( std::string  actionName,
Action::Type  type 
)
protected

Definition at line 111 of file Action.cpp.

111  {
112  this->name = name;
113  this->type = type;
114 }
std::string name
Definition: Action.h:146
Action::Type type
Definition: Action.h:147

Member Function Documentation

virtual void ROSEE::Action::emitYaml ( YAML::Emitter &  out) const
pure virtual

Function to fill the argument passed with info about the action.

Pure virtual because each derived class has different infos and stored differently. check YamlWorker to correctly emit and parse the file

Parameters
outthe yaml-cpp emitter which store infos about the action
Note
this function does not print in a file, but simply fill a YAML::Emitter.

Implemented in ROSEE::ActionTimed, ROSEE::ActionPinchLoose, ROSEE::ActionComposed, ROSEE::ActionMultiplePinchTight, ROSEE::ActionSingleJointMultipleTips, ROSEE::ActionPinchTight, ROSEE::ActionGeneric, and ROSEE::ActionPrimitive.

virtual bool ROSEE::Action::fillFromYaml ( YAML::const_iterator  yamlIt)
pure virtual

function to fill members of the Action with infos taken from yaml files

Parameters
yamlIta YAML::const_iterator to the node that is loaded with YAML::LoadFile(dirPath + filename). check YamlWorker to correctly parse and emit the file

Implemented in ROSEE::ActionTimed, ROSEE::ActionTrig, ROSEE::ActionComposed, ROSEE::ActionPinchLoose, ROSEE::ActionMultiplePinchTight, ROSEE::ActionGeneric, ROSEE::ActionSingleJointMultipleTips, and ROSEE::ActionPinchTight.

virtual std::vector< ROSEE::JointPos > ROSEE::Action::getAllJointPos ( ) const
pure virtual

Return all the joint position stored.

If the concrete (derived from Action) has only one joint position info, this function is equal to getJointPos.

Returns
vector containing all the joint pos of the action

Implemented in ROSEE::ActionTrig, ROSEE::ActionGeneric, ROSEE::ActionTimed, ROSEE::ActionMultiplePinchTight, ROSEE::ActionSingleJointMultipleTips, ROSEE::ActionPinchLoose, and ROSEE::ActionPinchTight.

std::set< std::string > ROSEE::Action::getFingersInvolved ( ) const

Get for fingersInvolved.

Returns
std::set<std::string> the set containing all the hand's fingers involved in the action

Definition at line 125 of file Action.cpp.

125  {
126  return fingersInvolved;
127 }
std::set< std::string > fingersInvolved
Definition: Action.h:148
virtual JointPos ROSEE::Action::getJointPos ( ) const
pure virtual

Get the position related to this action.

Pure Virtual function: the derived class store this info differently so they are in charge of providing the read.

Returns
JointsPos the map indicating how the position of the joint

Implemented in ROSEE::ActionTrig, ROSEE::ActionSingleJointMultipleTips, ROSEE::ActionGeneric, ROSEE::ActionTimed, ROSEE::ActionMultiplePinchTight, ROSEE::ActionPinchLoose, and ROSEE::ActionPinchTight.

ROSEE::JointsInvolvedCount ROSEE::Action::getJointsInvolvedCount ( ) const

Get for jointsInvolvedCount.

Returns
JointsInvolvedCount the map indicating how many times the joint is set by the action

Definition at line 130 of file Action.cpp.

130  {
131  return jointsInvolvedCount;
132 }
JointsInvolvedCount jointsInvolvedCount
Definition: Action.h:149
std::string ROSEE::Action::getName ( ) const

Get the name of the action.

Returns
std::string the name of the action

Definition at line 116 of file Action.cpp.

116  {
117  return name;
118 }
std::string name
Definition: Action.h:146
ROSEE::Action::Type ROSEE::Action::getType ( ) const

Definition at line 120 of file Action.cpp.

120  {
121  return type;
122 }
Action::Type type
Definition: Action.h:147
void ROSEE::Action::print ( ) const
virtual

Overridable functions, if we want to make them more action-specific.

Reimplemented in ROSEE::ActionTimed, ROSEE::ActionPinchLoose, ROSEE::ActionMultiplePinchTight, ROSEE::ActionSingleJointMultipleTips, ROSEE::ActionPinchTight, and ROSEE::ActionComposed.

Definition at line 135 of file Action.cpp.

135  {
136 
137  std::stringstream output;
138  output << "ActionName: " << name << std::endl;
139 
140  if (fingersInvolved.size() > 0 ){
141  output << "FingersInvolved: [";
142  for (auto fingName : fingersInvolved){
143  output << fingName << ", " ;
144  }
145  output.seekp (-2, output.cur); //to remove the last comma (and space)
146  output << "]" << std::endl;
147 
148  } else {
149  output << "FingersInvolved: <not inserted>" << std::endl; // can happen, for ex for genericAction
150  }
151 
152 
153  output << "JointsInvolvedCount: " << std::endl;;
154  output << jointsInvolvedCount << std::endl;
155 
156  output << "JointPos:" << std::endl;
157  output << getJointPos() << std::endl;
158 
159  output << std::endl;
160 
161  std::cout << output.str();
162 }
std::string name
Definition: Action.h:146
JointsInvolvedCount jointsInvolvedCount
Definition: Action.h:149
virtual JointPos getJointPos() const =0
Get the position related to this action.
std::set< std::string > fingersInvolved
Definition: Action.h:148

Member Data Documentation

std::set<std::string> ROSEE::Action::fingersInvolved
protected

Definition at line 148 of file Action.h.

JointsInvolvedCount ROSEE::Action::jointsInvolvedCount
protected

Definition at line 149 of file Action.h.

std::string ROSEE::Action::name
protected

Definition at line 146 of file Action.h.

Action::Type ROSEE::Action::type
protected

Definition at line 147 of file Action.h.


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