ROSEndEffector
ROS End-Effector package: provides a ROS-based set of standard interfaces to command robotics end-effectors in an agnostic fashion.
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
unsigned int nFingersInvolved
Virtual class, Base of all the primitive actions.
std::string name
Definition: Action.h:146
unsigned int getMaxStoredActionStates() const
std::map< std::string, unsigned int > JointsInvolvedCount
The map to describe, how many times a joint is set by the action.
Definition: Action.h:63
void setJointsInvolvedCount(ROSEE::JointsInvolvedCount jointsInvolvedCount)
The pure virtual class representing an Action.
Definition: Action.h:71
std::shared_ptr< const ActionPrimitive > ConstPtr
std::shared_ptr< ActionPrimitive > Ptr
ActionPrimitive(std::string name, unsigned int maxStoredActionStates, Type type)
Type
Enum useful to discriminate each primitive action when, for example, we want to parse a file if you ...
Action::Type type
Definition: Action.h:147
JointsInvolvedCount jointsInvolvedCount
Definition: Action.h:149
const unsigned int maxStoredActionStates
virtual void emitYaml(YAML::Emitter &) const override
Function to fill the argument passed with info about the action.
unsigned int getnFingersInvolved() const
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 ...
Type getPrimitiveType() const