gripper_equipped_entity.h
Go to the documentation of this file.
1 
7 #ifndef GRIPPER_EQUIPPED_ENTITY_H
8 #define GRIPPER_EQUIPPED_ENTITY_H
9 
10 namespace argos {
11  class CGripperEquippedEntity;
12  class CEmbodiedEntity;
13 }
14 
15 #include <argos3/core/simulator/entity/entity.h>
16 #include <argos3/core/utility/math/vector3.h>
17 #include <argos3/core/utility/math/quaternion.h>
18 
19 namespace argos {
20 
38 
39  public:
40 
41  ENABLE_VTABLE();
42 
43  public:
44 
51 
64  const std::string& str_id,
65  const CVector3& c_offset,
66  const CVector3& c_direction,
67  Real f_lock_threshold = 0.5f);
68 
73  virtual void Init(TConfigurationNode& t_tree);
74 
78  virtual void Reset();
79 
84  inline const CVector3& GetOffset() const {
85  return m_cOffset;
86  }
87 
93  inline const CVector3& GetInitOffset() const {
94  return m_cInitOffset;
95  }
96 
101  inline void SetOffset(const CVector3& c_offset) {
102  m_cOffset = c_offset;
103  }
104 
110  inline void SetInitOffset(const CVector3& c_offset) {
111  m_cInitOffset = c_offset;
112  }
113 
118  inline const CVector3& GetDirection() const {
119  return m_cDirection;
120  }
121 
127  inline const CVector3& GetInitDirection() const {
128  return m_cInitDirection;
129  }
130 
135  inline void SetDirection(const CVector3& c_direction) {
136  m_cDirection = c_direction;
137  }
138 
144  inline void SetInitDirection(const CVector3& c_direction) {
145  m_cInitDirection = c_direction;
146  }
147 
153  inline Real GetLockState() const {
154  return m_fLockState;
155  }
156 
162  void SetLockState(Real f_lock_state);
163 
169  inline Real GetLockThreshold() const {
170  return m_fLockThreshold;
171  }
172 
178  void SetLockThreshold(Real f_lock_threshold);
179 
187  inline bool IsLocked() const {
188  return m_fLockState > m_fLockThreshold;
189  }
190 
195  inline bool IsGripping() const {
196  return (m_pcGrippedEntity != NULL);
197  }
198 
205 
210  inline void SetGrippedEntity(CEmbodiedEntity& c_entity) {
211  m_pcGrippedEntity = &c_entity;
212  }
213 
217  inline void ClearGrippedEntity() {
218  m_pcGrippedEntity = NULL;
219  }
220 
221  virtual std::string GetTypeDescription() const {
222  return "gripper";
223  }
224 
225  private:
226 
228  CVector3 m_cOffset;
229 
231  CVector3 m_cInitOffset;
232 
234  CVector3 m_cDirection;
235 
237  CVector3 m_cInitDirection;
238 
240  Real m_fLockState;
241 
243  Real m_fLockThreshold;
244 
246  CEmbodiedEntity* m_pcGrippedEntity;
247 
248  };
249 }
250 
251 #endif
void ClearGrippedEntity()
Clears the reference to the embodied entity currently gripped by this gripper.
A 3D vector class.
Definition: vector3.h:29
const CVector3 & GetInitDirection() const
Returns the initial facing direction of the gripper with respect to the local X-axis.
Real GetLockThreshold() const
Returns the lock threshold of the gripper.
void SetLockThreshold(Real f_lock_threshold)
Sets the lock threshold of the gripper.
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or one of the standalone constructors ...
void SetDirection(const CVector3 &c_direction)
Sets the facing direction of the gripper with respect to the local X-axis.
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
virtual std::string GetTypeDescription() const
Returns a string label for this class.
bool IsGripping() const
Returns true if this gripper is gripping something.
The basic entity type.
Definition: entity.h:89
void SetInitDirection(const CVector3 &c_direction)
Sets the initial facing direction of the gripper with respect to the local X-axis.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
This entity is a link to a body in the physics engine.
bool IsLocked() const
Returns true if the gripper is locked.
CGripperEquippedEntity(CComposableEntity *pc_parent)
Class constructor.
void SetOffset(const CVector3 &c_offset)
Sets the offset of the gripper with respect to the reference point.
void SetInitOffset(const CVector3 &c_offset)
Sets the initial offset of the gripper with respect to the reference point.
Basic class for an entity that contains other entities.
const CVector3 & GetDirection() const
Returns the facing direction of the gripper with respect to the local X-axis.
void SetGrippedEntity(CEmbodiedEntity &c_entity)
Sets the embodied entity currently gripped by this gripper.
Real GetLockState() const
Returns the lock state of the gripper.
const CVector3 & GetInitOffset() const
Returns the initial offset of the gripper with respect to the reference point.
const CVector3 & GetOffset() const
Returns the offset of the gripper with respect to the reference point.
CEmbodiedEntity & GetGrippedEntity()
Returns the embodied entity currently gripped by this gripper.
void SetLockState(Real f_lock_state)
Sets the lock state of the gripper.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
An entity that stores the state of a robot gripper.