ARGoS 3
A parallel, multi-engine simulator for swarm robotics
dynamics2d_gripping.h
Go to the documentation of this file.
1
7#ifndef DYNAMICS2D_GRIPPING_H
8#define DYNAMICS2D_GRIPPING_H
9
10namespace argos {
11 class CDynamics2DEngine;
12 class CDynamics2DGripper;
13 class CDynamics2DGrippable;
14 class CGripperEquippedEntity;
15}
16
17#include <argos3/plugins/simulator/physics_engines/dynamics2d/chipmunk-physics/include/chipmunk.h>
18#include <argos3/plugins/simulator/entities/gripper_equipped_entity.h>
19#include <list>
20
21namespace argos {
22
23 /****************************************/
24 /****************************************/
25
27
28 public:
29
30 typedef std::list<CDynamics2DGripper*> TList;
31
32 public:
33
35 CGripperEquippedEntity& c_gripper_entity,
36 cpShape* pt_gripper_shape);
37
39
40 inline bool IsGripping() const {
41 return m_pcGrippee != NULL;
42 }
43
44 inline bool IsLocked() const {
45 return m_cGripperEntity.IsLocked();
46 }
47
49 return m_cGripperEntity;
50 }
51
52 inline cpShape* GripperShape() {
53 return m_ptGripperShape;
54 }
55
57 return m_pcGrippee;
58 }
59
60 inline cpConstraint* GetConstraint() {
61 return m_tConstraint;
62 }
63
72 Real GetExtension() const;
73
74 void CalculateAnchor(cpArbiter* pt_arb);
75
76 void Grip(CDynamics2DGrippable* pc_grippee);
77
78 void Release();
79
80 private:
81
82 CDynamics2DEngine& m_cEngine;
83 CGripperEquippedEntity& m_cGripperEntity;
84 cpShape* m_ptGripperShape;
85 CDynamics2DGrippable* m_pcGrippee;
86 cpVect m_tGrippeeAnchor;
87 cpConstraint* m_tConstraint;
88 cpFloat m_fRestLength;
89
90 };
91
92 /****************************************/
93 /****************************************/
94
96
97 public:
98
100 cpShape* pt_shape);
101
103
105 return m_cEmbodiedEntity;
106 }
107
108 inline cpShape* GetShape() {
109 return m_ptShape;
110 }
111
112 inline bool HasGrippers() const {
113 return !m_listGrippers.empty();
114 }
115
116 void Attach(CDynamics2DGripper& c_gripper);
117
118 void Remove(CDynamics2DGripper& c_gripper);
119
120 void Release(CDynamics2DGripper& c_gripper);
121
122 void ReleaseAll();
123
124 private:
125
126 CEmbodiedEntity& m_cEmbodiedEntity;
127 cpShape* m_ptShape;
128 CDynamics2DGripper::TList m_listGrippers;
129
130 };
131
132 /****************************************/
133 /****************************************/
134
135 extern int BeginCollisionBetweenGripperAndGrippable(cpArbiter* pt_arb,
136 cpSpace* pt_space,
137 void* p_data);
138
139 extern int ManageCollisionBetweenGripperAndGrippable(cpArbiter* pt_arb,
140 cpSpace* pt_space,
141 void* p_data);
142
143 extern void AddConstraintBetweenGripperAndGrippable(cpSpace* pt_space,
144 void* p_obj,
145 void* p_data);
146
147 extern void RemoveConstraintBetweenGripperAndGrippable(cpSpace* pt_space,
148 void* p_obj,
149 void* p_data);
150
151 /****************************************/
152 /****************************************/
153
154}
155
156#endif
float Real
Collects all ARGoS code.
Definition datatypes.h:39
The namespace containing all the ARGoS related code.
Definition ci_actuator.h:12
int BeginCollisionBetweenGripperAndGrippable(cpArbiter *pt_arb, cpSpace *pt_space, void *p_data)
void AddConstraintBetweenGripperAndGrippable(cpSpace *pt_space, void *p_obj, void *p_data)
void RemoveConstraintBetweenGripperAndGrippable(cpSpace *pt_space, void *p_obj, void *p_data)
int ManageCollisionBetweenGripperAndGrippable(cpArbiter *pt_arb, cpSpace *pt_space, void *p_data)
This entity is a link to a body in the physics engine.
An entity that stores the state of a robot gripper.
bool IsLocked() const
Returns true if the gripper is locked.
void CalculateAnchor(cpArbiter *pt_arb)
CGripperEquippedEntity & GetGripperEntity()
void Grip(CDynamics2DGrippable *pc_grippee)
std::list< CDynamics2DGripper * > TList
CDynamics2DGrippable * GetGrippee()
Real GetExtension() const
Returns the extension of the constraint.
CDynamics2DGripper(CDynamics2DEngine &c_engine, CGripperEquippedEntity &c_gripper_entity, cpShape *pt_gripper_shape)
void Release(CDynamics2DGripper &c_gripper)
void Remove(CDynamics2DGripper &c_gripper)
void Attach(CDynamics2DGripper &c_gripper)
CEmbodiedEntity & GetEmbodiedEntity()
CDynamics2DGrippable(CEmbodiedEntity &c_entity, cpShape *pt_shape)