dynamics3d_multi_body_object_model.h
Go to the documentation of this file.
1 
7 #ifndef DYNAMICS3D_MULTI_BODY_OBJECT_MODEL_H
8 #define DYNAMICS3D_MULTI_BODY_OBJECT_MODEL_H
9 
10 namespace argos {
11  class CDynamics3DMultiBodyObjectModel;
12 }
13 
14 #include <argos3/plugins/simulator/physics_engines/dynamics3d/dynamics3d_model.h>
15 
16 #ifdef __APPLE__
17 #pragma clang diagnostic push
18 #pragma clang diagnostic ignored "-Wreorder"
19 #else
20 #pragma GCC diagnostic push
21 #pragma GCC diagnostic ignored "-Wreorder"
22 #endif
23 
24 #include <argos3/plugins/simulator/physics_engines/dynamics3d/bullet/BulletDynamics/Featherstone/btMultiBody.h>
25 #include <argos3/plugins/simulator/physics_engines/dynamics3d/bullet/BulletDynamics/Featherstone/btMultiBodyLink.h>
26 #include <argos3/plugins/simulator/physics_engines/dynamics3d/bullet/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h>
27 
28 #ifdef __APPLE__
29 #pragma clang diagnostic pop
30 #else
31 #pragma GCC diagnostic pop
32 #endif
33 
34 namespace argos {
35 
37 
38  public:
39 
40  class CLink : public CAbstractBody {
41 
42  public:
43 
45  UInt32 un_link_index,
46  SAnchor* ps_anchor,
47  const std::shared_ptr<btCollisionShape>& ptr_shape,
48  const SData& s_data);
49 
50  virtual ~CLink() {}
51 
52  virtual void Reset();
53 
54  virtual void AddToWorld(btMultiBodyDynamicsWorld& c_world);
55 
56  virtual void RemoveFromWorld(btMultiBodyDynamicsWorld& c_world);
57 
58  virtual void ApplyForce(const btVector3& c_force);
59 
60  virtual void ApplyForce(const btVector3& c_force,
61  const btVector3& c_offset);
62 
63  virtual void ApplyTorque(const btVector3& c_torque);
64 
65  virtual btTransform& GetTransform();
66 
67  UInt32 GetIndex() const;
68 
69  protected:
70 
73  btMultiBodyLinkCollider m_cMultiBodyLink;
74  };
75 
76  class CBase : public CLink {
77 
78  public:
79 
81  SAnchor* ps_anchor,
82  const std::shared_ptr<btCollisionShape>& ptr_shape,
83  const SData& s_data);
84 
85  virtual ~CBase() {}
86 
87  virtual void Reset();
88 
89  virtual void ApplyForce(const btVector3& c_force);
90 
91  virtual void ApplyForce(const btVector3& c_force,
92  const btVector3& c_offset);
93 
94  virtual void ApplyTorque(const btVector3& c_torque);
95  };
96 
98  CComposableEntity& c_entity,
99  UInt32 un_num_links,
100  bool b_fixed_base);
101 
103 
104  virtual void Reset();
105 
106  virtual void MoveTo(const CVector3& c_position,
107  const CQuaternion& c_orientation);
108 
109  virtual void CalculateBoundingBox();
110 
111  virtual void AddToWorld(btMultiBodyDynamicsWorld& c_world);
112 
113  virtual void RemoveFromWorld(btMultiBodyDynamicsWorld& c_world);
114 
115  btMultiBody& GetMultiBody() {
116  return m_cMultiBody;
117  }
118 
119  virtual void UpdateOriginAnchor(SAnchor& s_anchor);
120 
121  protected:
122 
123  btMultiBody m_cMultiBody;
126  };
127 
128 }
129 
130 #endif
unsigned int UInt32
32-bit unsigned integer.
Definition: datatypes.h:97
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
Basic class for an entity that contains other entities.
An anchor related to the body of an entity.
Definition: physics_model.h:38
A 3D vector class.
Definition: vector3.h:31
virtual void RemoveFromWorld(btMultiBodyDynamicsWorld &c_world)
virtual void CalculateBoundingBox()
Calculates the axis-aligned box that contains the entire physics model.
virtual void AddToWorld(btMultiBodyDynamicsWorld &c_world)
virtual void MoveTo(const CVector3 &c_position, const CQuaternion &c_orientation)
CDynamics3DMultiBodyObjectModel(CDynamics3DEngine &c_engine, CComposableEntity &c_entity, UInt32 un_num_links, bool b_fixed_base)
CLink(CDynamics3DMultiBodyObjectModel &c_model, UInt32 un_link_index, SAnchor *ps_anchor, const std::shared_ptr< btCollisionShape > &ptr_shape, const SData &s_data)
virtual void RemoveFromWorld(btMultiBodyDynamicsWorld &c_world)
virtual void AddToWorld(btMultiBodyDynamicsWorld &c_world)
CBase(CDynamics3DMultiBodyObjectModel &c_model, SAnchor *ps_anchor, const std::shared_ptr< btCollisionShape > &ptr_shape, const SData &s_data)