ActionTimed.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 <copyright holder> <email>
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ROSEE_ACTIONTIMED_H
18 #define ROSEE_ACTIONTIMED_H
19 
20 #include <vector>
21 #include <string>
22 #include <map>
24 #include <end_effector/Utils.h>
25 #include <yaml-cpp/yaml.h>
26 
27 namespace ROSEE {
28 
39 class ActionTimed : public Action
40 {
41 public:
42  typedef std::shared_ptr<ActionTimed> Ptr;
43  typedef std::shared_ptr<const ActionTimed> ConstPtr;
47  ActionTimed();
48 
53  ActionTimed(std::string actionName);
54 
59 
64  JointPos getJointPos () const override;
65 
71  std::vector < ROSEE::JointPos > getAllJointPos () const override;
72 
77  std::vector < ROSEE::JointsInvolvedCount > getAllJointCountAction() const;
78 
84  std::vector < std::pair <double, double> > getAllActionMargins() const;
85 
92  ROSEE::JointPos getJointPosAction ( std::string actionName ) const ;
93 
100  std::pair <double, double> getActionMargins ( std::string actionName ) const ;
101 
109  ROSEE::JointsInvolvedCount getJointCountAction ( std::string actionName ) const;
110 
115  std::vector <std::string> getInnerActionsNames() const ;
119  void print () const override;
120 
125  void emitYaml ( YAML::Emitter& out) const override;
126 
132  bool fillFromYaml( YAML::const_iterator yamlIt ) override;
133 
150  bool insertAction ( ROSEE::Action::Ptr action, double marginBefore = 0.0, double marginAfter = 0.0,
151  unsigned int jointPosIndex = 0, double percentJointPos = 1, std::string newActionName = "");
152 
153 private:
154  std::map <std::string, std::pair<double, double> > actionsTimeMarginsMap;
155  std::map <std::string, ROSEE::JointPos> actionsJointPosMap;
156  std::map <std::string, ROSEE::JointsInvolvedCount> actionsJointCountMap;
157 
163 
167  std::vector < std::string > actionsNamesOrdered;
168 
169 };
170 
171 }
172 
173 #endif // ROSEE_ACTIONTIMED_H
ROSEE::ActionTimed
An action composed by other ones that must be executed one after other with some wait time (also 0) i...
Definition: ActionTimed.h:39
ROSEE::ActionTimed::fillFromYaml
bool fillFromYaml(YAML::const_iterator yamlIt) override
Fill the internal data with infos taken from yaml file.
Definition: ActionTimed.cpp:222
ROSEE::ActionTimed::getAllJointPos
std::vector< ROSEE::JointPos > getAllJointPos() const override
Override function from father Action. For this class, it returns the jointPos of all the inner action...
Definition: ActionTimed.cpp:31
ROSEE::ActionTimed::getAllActionMargins
std::vector< std::pair< double, double > > getAllActionMargins() const
get all the time margins of all inner action
Definition: ActionTimed.cpp:51
ROSEE::ActionTimed::actionsTimeMarginsMap
std::map< std::string, std::pair< double, double > > actionsTimeMarginsMap
Definition: ActionTimed.h:154
ROSEE::ActionTimed::actionsJointPosMap
std::map< std::string, ROSEE::JointPos > actionsJointPosMap
Definition: ActionTimed.h:155
ROSEE::ActionTimed::getJointCountAction
ROSEE::JointsInvolvedCount getJointCountAction(std::string actionName) const
get for JointsInvolvedCount of the inner actions
Definition: ActionTimed.cpp:74
ROSEE::ActionTimed::ActionTimed
ActionTimed()
Default constructor, used when parsing action from yaml file.
Definition: ActionTimed.cpp:19
ROSEE
Definition: EEInterface.h:30
ROSEE::ActionTimed::getJointPos
JointPos getJointPos() const override
Override this function is necessary because it is pure virtual in father class Action.
Definition: ActionTimed.cpp:27
ROSEE::JointsInvolvedCount
std::map< std::string, unsigned int > JointsInvolvedCount
The map to describe, how many times a joint is set by the action. An ActionPrimitive and an ActionCom...
Definition: Action.h:63
ROSEE::Action
The pure virtual class representing an Action. It has members that are in common to all derived class...
Definition: Action.h:71
Action.h
ROSEE::ActionTimed::~ActionTimed
~ActionTimed()
Destructor.
Definition: ActionTimed.h:58
Utils.h
ROSEE::ActionTimed::actionsJointCountMap
std::map< std::string, ROSEE::JointsInvolvedCount > actionsJointCountMap
Definition: ActionTimed.h:156
ROSEE::ActionTimed::getActionMargins
std::pair< double, double > getActionMargins(std::string actionName) const
get for time margins
Definition: ActionTimed.cpp:88
ROSEE::ActionTimed::emitYaml
void emitYaml(YAML::Emitter &out) const override
Emit info in a file with yaml format.
Definition: ActionTimed.cpp:142
ROSEE::ActionTimed::print
void print() const override
Print info about this action.
Definition: ActionTimed.cpp:106
ROSEE::ActionTimed::getInnerActionsNames
std::vector< std::string > getInnerActionsNames() const
getter for action that composed this one
Definition: ActionTimed.cpp:101
ROSEE::ActionTimed::getJointPosAction
ROSEE::JointPos getJointPosAction(std::string actionName) const
get for joint positions
Definition: ActionTimed.cpp:61
ROSEE::ActionTimed::Ptr
std::shared_ptr< ActionTimed > Ptr
Definition: ActionTimed.h:42
ROSEE::ActionTimed::ConstPtr
std::shared_ptr< const ActionTimed > ConstPtr
Definition: ActionTimed.h:43
ROSEE::ActionTimed::actionsNamesOrdered
std::vector< std::string > actionsNamesOrdered
Definition: ActionTimed.h:167
ROSEE::Action::Ptr
std::shared_ptr< Action > Ptr
Definition: Action.h:75
ROSEE::ActionTimed::getAllJointCountAction
std::vector< ROSEE::JointsInvolvedCount > getAllJointCountAction() const
Get the JointsInvolvedCount maps of all the inner actions, in order.
Definition: ActionTimed.cpp:41
ROSEE::JointPos
std::map< std::string, std::vector< double > > JointPos
The map to describe the position of all actuated joints. The key is the name of the string,...
Definition: Action.h:40
ROSEE::ActionTimed::insertAction
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.
Definition: ActionTimed.cpp:291
ROSEE::ActionTimed::jointPosFinal
ROSEE::JointPos jointPosFinal
Definition: ActionTimed.h:162


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