ROSEndEffector
ROS End-Effector package: provides a ROS-based set of standard interfaces to command robotics end-effectors in an agnostic fashion.
|
An action composed by other ones that must be executed one after other with some wait time (also 0) in between. More...
#include <ActionTimed.h>
Public Types | |
typedef std::shared_ptr< ActionTimed > | Ptr |
typedef std::shared_ptr< const ActionTimed > | ConstPtr |
Public Types inherited from ROSEE::Action | |
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< Action > | Ptr |
typedef std::shared_ptr< const Action > | ConstPtr |
Public Member Functions | |
ActionTimed () | |
Default constructor, used when parsing action from yaml file. More... | |
ActionTimed (std::string actionName) | |
Costructor. More... | |
~ActionTimed () | |
Destructor. More... | |
JointPos | getJointPos () const override |
Override this function is necessary because it is pure virtual in father class Action. More... | |
std::vector< ROSEE::JointPos > | getAllJointPos () const override |
Override function from father Action. More... | |
std::vector< ROSEE::JointsInvolvedCount > | getAllJointCountAction () const |
Get the JointsInvolvedCount maps of all the inner actions, in order. More... | |
std::vector< std::pair< double, double > > | getAllActionMargins () const |
get all the time margins of all inner action More... | |
ROSEE::JointPos | getJointPosAction (std::string actionName) const |
get for joint positions More... | |
std::pair< double, double > | getActionMargins (std::string actionName) const |
get for time margins More... | |
ROSEE::JointsInvolvedCount | getJointCountAction (std::string actionName) const |
get for JointsInvolvedCount of the inner actions More... | |
std::vector< std::string > | getInnerActionsNames () const |
getter for action that composed this one More... | |
void | print () const override |
Print info about this action. More... | |
void | emitYaml (YAML::Emitter &out) const override |
Emit info in a file with yaml format. More... | |
bool | fillFromYaml (YAML::const_iterator yamlIt) override |
Fill the internal data with infos taken from yaml file. More... | |
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. More... | |
Public Member Functions inherited from ROSEE::Action | |
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... | |
Private Attributes | |
std::map< std::string, std::pair< double, double > > | actionsTimeMarginsMap |
std::map< std::string, ROSEE::JointPos > | actionsJointPosMap |
std::map< std::string, ROSEE::JointsInvolvedCount > | actionsJointCountMap |
ROSEE::JointPos | jointPosFinal |
Here is contained the wanted final position of the timed action. More... | |
std::vector< std::string > | actionsNamesOrdered |
This vector is used to take count of the order of the actions inserted. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ROSEE::Action | |
Action () | |
Action (std::string actionName, Action::Type type) | |
Protected Attributes inherited from ROSEE::Action | |
std::string | name |
Action::Type | type |
std::set< std::string > | fingersInvolved |
JointsInvolvedCount | jointsInvolvedCount |
An action composed by other ones that must be executed one after other with some wait time (also 0) in between.
E.G. 0.000000second --—> Grasp --—> 0.1 + 0.1 second --—> OpenLid --—> 0.5second -— and so on This class contains all the joint position of each action (actionsJointPosMap ) and some time margins which indicates wait time before and after the action (actionsTimeMarginsMap). Each action inside is identified by its name, so no two action with same name can exist (see insertAction ) After create the ActionTimed object, we can add actions with insertAction(). As all other Action classes, it implements also functions to emit and parse in a yaml file
Definition at line 39 of file ActionTimed.h.
typedef std::shared_ptr<const ActionTimed> ROSEE::ActionTimed::ConstPtr |
Definition at line 43 of file ActionTimed.h.
typedef std::shared_ptr<ActionTimed> ROSEE::ActionTimed::Ptr |
Definition at line 42 of file ActionTimed.h.
ROSEE::ActionTimed::ActionTimed | ( | ) |
Default constructor, used when parsing action from yaml file.
Definition at line 19 of file ActionTimed.cpp.
ROSEE::ActionTimed::ActionTimed | ( | std::string | actionName | ) |
Costructor.
actionName | name of the action that will be created |
Definition at line 23 of file ActionTimed.cpp.
|
inline |
|
overridevirtual |
Emit info in a file with yaml format.
out | a YAML::Emitter& object to emit the infos |
Implements ROSEE::Action.
Definition at line 142 of file ActionTimed.cpp.
|
overridevirtual |
Fill the internal data with infos taken from yaml file.
yamlIt | a yamlt iterator to a node which has loaded the file |
Implements ROSEE::Action.
Definition at line 222 of file ActionTimed.cpp.
std::pair< double, double > ROSEE::ActionTimed::getActionMargins | ( | std::string | actionName | ) | const |
get for time margins
actionName | the name of the inner action of which we want to know the time margins |
actionName
was not present in this ActionTimed. Definition at line 88 of file ActionTimed.cpp.
std::vector< std::pair< double, double > > ROSEE::ActionTimed::getAllActionMargins | ( | ) | const |
get all the time margins of all inner action
Definition at line 51 of file ActionTimed.cpp.
std::vector< ROSEE::JointsInvolvedCount > ROSEE::ActionTimed::getAllJointCountAction | ( | ) | const |
Get the JointsInvolvedCount maps of all the inner actions, in order.
Definition at line 41 of file ActionTimed.cpp.
|
overridevirtual |
Override function from father Action.
For this class, it returns the jointPos of all the inner actions that are inside this ActionTimed.
Implements ROSEE::Action.
Definition at line 31 of file ActionTimed.cpp.
std::vector< std::string > ROSEE::ActionTimed::getInnerActionsNames | ( | ) | const |
getter for action that composed this one
Definition at line 101 of file ActionTimed.cpp.
ROSEE::JointsInvolvedCount ROSEE::ActionTimed::getJointCountAction | ( | std::string | actionName | ) | const |
get for JointsInvolvedCount of the inner actions
actionName | the name of the inner action of which we want to know the JointCount |
actionName
Return empty JointsInvolvedCount if actionName
is not present in this ActionTimed Definition at line 74 of file ActionTimed.cpp.
|
overridevirtual |
Override this function is necessary because it is pure virtual in father class Action.
Implements ROSEE::Action.
Definition at line 27 of file ActionTimed.cpp.
ROSEE::JointPos ROSEE::ActionTimed::getJointPosAction | ( | std::string | actionName | ) | const |
get for joint positions
actionName | the name of the inner action of which we want to know the JointPos |
actionName
Return empty JointPos if actionName
is not present in this ActionTimed Definition at line 61 of file ActionTimed.cpp.
bool ROSEE::ActionTimed::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.
action | pointer to the action to be inserted |
marginBefore | the time margin to wait before executing the action |
marginAfter | the time margin to wait after executing the action |
jointPosIndex | (default == 0) the wanted jointPos of action to insert. Error the index is greater than the number of joint pos in the action . First element has index 0. |
percentJointPos | (default == 1) OPTIONAL argument to scale all the joint position of the action that is being inserted |
newActionName | (default == "") OPTIONAL argument if we want to store the action with a different name |
action
name (or newActionName
) is already present, the action is not inserted and the function returns false. Being Action names not changeable, to solve this we can pass the newActionName
argument to this function. If it will be inserted, it will be referenced with this new name action
and store them in the members of ActionTimed. There is not way to go back to the original inserted action from an ActionTimed Definition at line 291 of file ActionTimed.cpp.
|
overridevirtual |
Print info about this action.
Reimplemented from ROSEE::Action.
Definition at line 106 of file ActionTimed.cpp.
|
private |
Definition at line 156 of file ActionTimed.h.
|
private |
Definition at line 155 of file ActionTimed.h.
|
private |
This vector is used to take count of the order of the actions inserted.
Definition at line 167 of file ActionTimed.h.
|
private |
Definition at line 154 of file ActionTimed.h.
|
private |
Here is contained the wanted final position of the timed action.
So, it is the sum of all the wanted joint position of all the inner actions
Definition at line 162 of file ActionTimed.h.