ActionPrimitive.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 IIT-HHCM
3  * Author: Davide Torielli
4  * email: davide.torielli@iit.it
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef __ROSEE_ACTIONPRIMITIVE_H
20 #define __ROSEE_ACTIONPRIMITIVE_H
21 
22 #include <set>
23 #include <string>
24 #include <map>
25 #include <vector>
26 #include <iostream>
27 
29 
30 #include <yaml-cpp/yaml.h>
31 
32 
33 namespace ROSEE{
34 
48 class ActionPrimitive : public Action
49 {
50 
51 public:
52 
53  typedef std::shared_ptr<ActionPrimitive> Ptr;
54  typedef std::shared_ptr<const ActionPrimitive> ConstPtr;
55 
61  /* destructor of base must be virtual */
62  virtual ~ActionPrimitive() {};
63 
64  /* virtual and not getters */
65  Type getPrimitiveType() const;
66  unsigned int getMaxStoredActionStates() const;
67  unsigned int getnFingersInvolved() const;
68 
74  virtual std::set < std::string> getKeyElements () const = 0;
75 
77  /* overridable functions, if we want to make them more action-specific*/
78  virtual void emitYaml ( YAML::Emitter& ) const override;
79 
80 protected:
81 
82  ActionPrimitive ( std::string name, unsigned int maxStoredActionStates, Type type );
83 
88  ActionPrimitive( std::string name, unsigned int nFingersInvolved, unsigned int maxStoredActionStates,
89  Type type );
90 
91  /* e.g. two tips for the pinch*/
92  unsigned int nFingersInvolved;
93 
94  /* the max number of action for each linksInvolved set that we want to store */
95  const unsigned int maxStoredActionStates;
96 
98 
99 
100 
101 };
102 
108 //std::ostream& operator<<(std::ostream& out, const ActionPrimitive::Type type);
109 
110 }
111 
112 #endif // __ROSEE_ACTIONPRIMITIVE_H
ROSEE::Action::jointsInvolvedCount
JointsInvolvedCount jointsInvolvedCount
Definition: Action.h:149
ROSEE::ActionPrimitive::Ptr
std::shared_ptr< ActionPrimitive > Ptr
Definition: ActionPrimitive.h:53
ROSEE::ActionPrimitive::ActionPrimitive
ActionPrimitive(std::string name, unsigned int maxStoredActionStates, Type type)
Definition: ActionPrimitive.cpp:39
ROSEE::ActionPrimitive::getMaxStoredActionStates
unsigned int getMaxStoredActionStates() const
Definition: ActionPrimitive.cpp:53
ROSEE
Definition: EEInterface.h:30
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::ActionPrimitive::getPrimitiveType
Type getPrimitiveType() const
Definition: ActionPrimitive.cpp:49
ROSEE::Action
The pure virtual class representing an Action. It has members that are in common to all derived class...
Definition: Action.h:71
ROSEE::ActionPrimitive::MultiplePinchTight
@ MultiplePinchTight
Definition: ActionPrimitive.h:60
Action.h
ROSEE::ActionPrimitive::nFingersInvolved
unsigned int nFingersInvolved
Definition: ActionPrimitive.h:92
ROSEE::ActionPrimitive::PinchLoose
@ PinchLoose
Definition: ActionPrimitive.h:60
ROSEE::ActionPrimitive::SingleJointMultipleTips
@ SingleJointMultipleTips
Definition: ActionPrimitive.h:60
ROSEE::ActionPrimitive::getnFingersInvolved
unsigned int getnFingersInvolved() const
Definition: ActionPrimitive.cpp:57
ROSEE::ActionPrimitive::emitYaml
virtual void emitYaml(YAML::Emitter &) const override
Function to fill the argument passed with info about the action. Pure virtual because each derived cl...
Definition: ActionPrimitive.cpp:67
ROSEE::ActionPrimitive::~ActionPrimitive
virtual ~ActionPrimitive()
Definition: ActionPrimitive.h:62
ROSEE::ActionPrimitive::setJointsInvolvedCount
void setJointsInvolvedCount(ROSEE::JointsInvolvedCount jointsInvolvedCount)
Definition: ActionPrimitive.cpp:61
ROSEE::ActionPrimitive
Virtual class, Base of all the primitive actions. It has some implemented functions that a derived cl...
Definition: ActionPrimitive.h:48
Type
Type
ROSEE::ActionPrimitive::TipFlex
@ TipFlex
Definition: ActionPrimitive.h:60
ROSEE::ActionPrimitive::primitiveType
const Type primitiveType
Definition: ActionPrimitive.h:97
ROSEE::ActionPrimitive::ConstPtr
std::shared_ptr< const ActionPrimitive > ConstPtr
Definition: ActionPrimitive.h:54
ROSEE::ActionPrimitive::Type
Type
Enum useful to discriminate each primitive action when, for example, we want to parse a file @remind ...
Definition: ActionPrimitive.h:60
ROSEE::ActionPrimitive::None
@ None
Definition: ActionPrimitive.h:60
ROSEE::ActionPrimitive::FingFlex
@ FingFlex
Definition: ActionPrimitive.h:60
ROSEE::ActionPrimitive::getKeyElements
virtual std::set< std::string > getKeyElements() const =0
Depending on the primitive, we can use different "keys" to take info from yaml file when parsing for ...
ROSEE::ActionPrimitive::PinchTight
@ PinchTight
Definition: ActionPrimitive.h:60
ROSEE::Action::name
std::string name
Definition: Action.h:146
ROSEE::ActionPrimitive::Trig
@ Trig
Definition: ActionPrimitive.h:60
ROSEE::ActionPrimitive::maxStoredActionStates
const unsigned int maxStoredActionStates
Definition: ActionPrimitive.h:95
ROSEE::Action::type
Action::Type type
Definition: Action.h:147


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