dynamics3d_prototype_model.h
Go to the documentation of this file.
1 
7 #ifndef DYNAMICS3D_PROTOTYPE_MODEL_H
8 #define DYNAMICS3D_PROTOTYPE_MODEL_H
9 
10 namespace argos {
11  class CPrototypeEntity;
12  class CPrototypeJointEquippedEntity;
13 }
14 
15 #include <argos3/plugins/robots/prototype/simulator/prototype_joint_entity.h>
16 #include <argos3/plugins/simulator/physics_engines/dynamics3d/dynamics3d_multi_body_object_model.h>
17 #include <argos3/plugins/simulator/physics_engines/dynamics3d/bullet/BulletDynamics/Featherstone/btMultiBodyJointMotor.h>
18 #include <argos3/plugins/simulator/physics_engines/dynamics3d/bullet/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.h>
19 
20 namespace argos {
21 
23 
24  public:
25 
27 
29 
30  virtual void Reset();
31 
32  virtual void UpdateEntityStatus();
33 
34  virtual void UpdateFromEntityStatus();
35 
36  virtual void AddToWorld(btMultiBodyDynamicsWorld& c_world);
37 
38  virtual void RemoveFromWorld(btMultiBodyDynamicsWorld& c_world);
39 
40  private:
41 
42  CAbstractBody::SData CreateBodyData(const CPrototypeLinkEntity& c_link_entity);
43 
44  std::shared_ptr<btCollisionShape> RequestShape(const CPrototypeLinkEntity& c_link_entity);
45 
46  private:
47 
48  CPrototypeEntity& m_cEntity;
49 
50  CPrototypeJointEquippedEntity& m_cJointEquippedEntity;
51 
52  struct SJoint {
53  SJoint(CPrototypeJointEntity::EType e_type,
54  CLink& c_parent,
55  CLink& c_child,
56  const btVector3& c_parent_offset,
57  const btVector3& c_child_offset,
58  const btQuaternion& c_parent_to_child_rotation,
59  const btVector3& c_axis,
60  bool b_disable_collision);
62  CLink& Parent;
63  CLink& Child;
64  btVector3 ParentOffset;
65  btVector3 ChildOffset;
66  btQuaternion ParentToChildRotation;
67  btVector3 Axis;
68  bool DisableCollision;
69  };
70 
71  struct SLimit {
72  /* constructor */
73  SLimit(CDynamics3DPrototypeModel& c_model,
74  Real f_lower_limit,
75  Real f_upper_limit,
76  SInt32 n_joint_index);
77  /* methods */
78  void Reset();
79  /* data members */
81  Real LowerLimit;
82  Real UpperLimit;
83  SInt32 JointIndex;
84  btMultiBodyJointLimitConstraint Constraint;
85  };
86 
87  struct SActuator {
88  /* constructor */
89  SActuator(CDynamics3DPrototypeModel& c_model,
90  CPrototypeJointEntity::SActuator& s_actuator,
91  SInt32 n_joint_index);
92  /* methods */
93  void Reset();
94  void Update();
95  /* members */
97  CPrototypeJointEntity::SActuator& Actuator;
98  SInt32 JointIndex;
99  btMultiBodyJointMotor Motor;
100  };
101 
102  struct SSensor {
103  /* constructor */
104  SSensor(CDynamics3DPrototypeModel& c_model,
105  CPrototypeJointEntity::SSensor& s_sensor,
106  SInt32 n_joint_index);
107  /* methods */
108  void Update();
109  /* members */
111  CPrototypeJointEntity::SSensor& Sensor;
112  SInt32 JointIndex;
113  };
114 
115  std::vector<SJoint> m_vecJoints;
116  std::vector<SLimit> m_vecLimits;
117  std::vector<SActuator> m_vecActuators;
118  std::vector<SSensor> m_vecSensors;
119 
120  };
121 }
122 
123 #endif
virtual void UpdateFromEntityStatus()
Updates the state of this model from the status of the associated entity.
virtual void AddToWorld(btMultiBodyDynamicsWorld &c_world)
signed int SInt32
32-bit signed integer.
Definition: datatypes.h:93
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
virtual void RemoveFromWorld(btMultiBodyDynamicsWorld &c_world)
virtual void UpdateEntityStatus()
Updates the status of the associated entity.
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
CDynamics3DPrototypeModel(CDynamics3DEngine &c_engine, CPrototypeEntity &c_entity)