10 #include <argos3/core/simulator/entity/embodied_entity.h>
21 cpShape* pt_gripper_shape) :
23 m_cGripperEntity(c_gripper_entity),
24 m_ptGripperShape(pt_gripper_shape),
27 m_ptGripperShape->sensor = 1;
29 m_ptGripperShape->data =
this;
47 for(
SInt32 i = 0; i < cpArbiterGetCount(pt_arb); ++i) {
48 m_tAnchor = cpvadd(m_tAnchor, cpArbiterGetPoint(pt_arb, i));
50 m_tAnchor = cpvmult(m_tAnchor, 1.0f / cpArbiterGetCount(pt_arb));
60 m_ptGripperShape->body,
63 m_tConstraint->maxBias = 0.95f;
64 m_tConstraint->maxForce = 10000.0f;
66 m_pcGrippee = pc_grippee;
67 m_pcGrippee->
Attach(*
this);
76 cpConstraintFree(m_tConstraint);
79 m_pcGrippee->
Remove(*
this);
89 m_cEmbodiedEntity(c_entity),
92 m_ptShape->data =
this;
106 m_listGrippers.push_back(&c_gripper);
113 CDynamics2DGripper::TList::iterator it =
114 std::find(m_listGrippers.begin(), m_listGrippers.end(), &c_gripper);
115 if(it != m_listGrippers.end()) {
116 m_listGrippers.erase(it);
124 CDynamics2DGripper::TList::iterator it =
125 std::find(m_listGrippers.begin(), m_listGrippers.end(), &c_gripper);
126 if(it != m_listGrippers.end()) {
135 while(!m_listGrippers.empty()) {
136 m_listGrippers.back()->Release();
147 CP_ARBITER_GET_SHAPES(pt_arb, ptGripperShape, ptGrippableShape);
163 CP_ARBITER_GET_SHAPES(pt_arb, ptGripperShape, ptGrippableShape);
175 cpSpaceAddPostStepCallback(
179 ptGrippableShape->data);
185 cpSpaceAddPostStepCallback(
189 reinterpret_cast<CDynamics2DGrippable*>(ptGrippableShape->data));
206 pcGripper->
Grip(pcGrippable);
signed int SInt32
32-bit signed integer.
CEmbodiedEntity & GetEmbodiedEntity()
void ClearGrippedEntity()
Clears the reference to the embodied entity currently gripped by this gripper.
void Remove(CDynamics2DGripper &c_gripper)
CDynamics2DGripper(CDynamics2DEngine &c_engine, CGripperEquippedEntity &c_gripper_entity, cpShape *pt_gripper_shape)
void Release(CDynamics2DGripper &c_gripper)
This entity is a link to a body in the physics engine.
void Attach(CDynamics2DGripper &c_gripper)
void AddConstraintBetweenGripperAndGrippable(cpSpace *pt_space, void *p_obj, void *p_data)
void SetGrippedEntity(CEmbodiedEntity &c_entity)
Sets the embodied entity currently gripped by this gripper.
cpSpace * GetPhysicsSpace()
void CalculateAnchor(cpArbiter *pt_arb)
int BeginCollisionBetweenGripperAndGrippable(cpArbiter *pt_arb, cpSpace *pt_space, void *p_data)
CComposableEntity & GetParent()
Returns this entity's parent.
The namespace containing all the ARGoS related code.
int ManageCollisionBetweenGripperAndGrippable(cpArbiter *pt_arb, cpSpace *pt_space, void *p_data)
CDynamics2DGrippable(CEmbodiedEntity &c_entity, cpShape *pt_shape)
void RemoveConstraintBetweenGripperAndGrippable(cpSpace *pt_space, void *p_obj, void *p_data)
void Grip(CDynamics2DGrippable *pc_grippee)
CGripperEquippedEntity & GetGripperEntity()
An entity that stores the state of a robot gripper.