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

Class to handle a generic, simple action. Differently from other class, this is easily creable manually, for ex giving a name and a JointPos map to the costructor. It contains essential infos about the action, and override the necessary pure virtual functions of base class Action. More...

#include <ActionGeneric.h>

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

Public Types

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 @remind if you change this enum, change also the ROSEEControl.msg accordingly. More...
 

Public Member Functions

 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)
 
virtual void emitYaml (YAML::Emitter &out) const override
 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. More...
 
virtual bool fillFromYaml (YAML::const_iterator yamlIt) override
 function to fill members of the Action with infos taken from yaml files More...
 
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 void print () const
 Overridable functions, if we want to make them more action-specific. More...
 
virtual ~Action ()
 

Protected Member Functions

 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

JointPos jointPos
 
- Protected Attributes inherited from ROSEE::Action
std::set< std::string > fingersInvolved
 
JointsInvolvedCount jointsInvolvedCount
 
std::string name
 
Action::Type type
 

Detailed Description

Class to handle a generic, simple action. Differently from other class, this is easily creable manually, for ex giving a name and a JointPos map to the costructor. It contains essential infos about the action, and override the necessary pure virtual functions of base class Action.

Definition at line 32 of file ActionGeneric.h.

Member Typedef Documentation

◆ ConstPtr

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

Definition at line 36 of file ActionGeneric.h.

◆ Ptr

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

Definition at line 35 of file ActionGeneric.h.

Constructor & Destructor Documentation

◆ ActionGeneric() [1/5]

ROSEE::ActionGeneric::ActionGeneric ( )

default costructor. It is used when parsing a file with YamlWorker,

Warning
If you use this costructor, then you must fill internal structures with fillFromYaml (or using YamlWorker support class), it is the only way to set the internal infos (e.g. there is not a setName( name ) function ). If you have not a Yaml file to parse, use other costructors.

Definition at line 20 of file ActionGeneric.cpp.

◆ ActionGeneric() [2/5]

ROSEE::ActionGeneric::ActionGeneric ( std::string  actionName,
ROSEE::JointPos  jointPos 
)

Simpliest costructor, need only essential infos.

Note
This costructor create jointsInvolvedCount map. To do this, it considers a "not set" joint (count == 0) a joint which pos is 0. If you do not want this, pass also your JointsInvolvedCount map to the costructor

Definition at line 24 of file ActionGeneric.cpp.

◆ ActionGeneric() [3/5]

ROSEE::ActionGeneric::ActionGeneric ( std::string  actionName,
ROSEE::JointPos  jointPos,
JointsInvolvedCount  jic 
)

Another costructor.

Parameters
actionNamethe name of this action
jointPosmap containing position of ALL joints of your robot
jicmap of counters of times of joints involved (e.g. joint not used --> 0 ; joint used for the action --> 1)
Exceptions
Besure that keys of jointPos and jic are the same, otherwise exception is throw

Definition at line 41 of file ActionGeneric.cpp.

◆ ActionGeneric() [4/5]

ROSEE::ActionGeneric::ActionGeneric ( std::string  actionName,
ROSEE::JointPos  jointPos,
JointsInvolvedCount  jic,
std::set< std::string >  fingersInvolved 
)

Definition at line 68 of file ActionGeneric.cpp.

◆ ActionGeneric() [5/5]

ROSEE::ActionGeneric::ActionGeneric ( std::string  actionName)
protected

this costructor is only for derived class

Definition at line 22 of file ActionGeneric.cpp.

Member Function Documentation

◆ emitYaml()

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

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.

Implements ROSEE::Action.

Reimplemented in ROSEE::ActionComposed.

Definition at line 107 of file ActionGeneric.cpp.

◆ fillFromYaml()

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

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

Implements ROSEE::Action.

Reimplemented in ROSEE::ActionComposed.

Definition at line 130 of file ActionGeneric.cpp.

◆ getAllJointPos()

std::vector< ROSEE::JointPos > ROSEE::ActionGeneric::getAllJointPos ( ) const
overridevirtual

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.

Returns
JointsPos the map indicating the position of the joints

Implements ROSEE::Action.

Definition at line 101 of file ActionGeneric.cpp.

◆ getJointPos()

ROSEE::JointPos ROSEE::ActionGeneric::getJointPos ( ) const
overridevirtual

Get the joint position related to this action, overriden from Action.

Returns
JointsPos the map indicating the position of the joints

Implements ROSEE::Action.

Definition at line 97 of file ActionGeneric.cpp.

Member Data Documentation

◆ jointPos

JointPos ROSEE::ActionGeneric::jointPos
protected

Definition at line 94 of file ActionGeneric.h.


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


end-effector
Author(s): Luca Muratore , Davide Torielli , Liana Bertoni
autogenerated on Sat Dec 14 2024 03:49:27