cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osaODEBody.h
Go to the documentation of this file.
1 /*
2 
3  Author(s): Simon Leonard
4  Created on: November 11 2009
5 
6  (C) Copyright 2008 Johns Hopkins University (JHU), All Rights
7  Reserved.
8 
9 --- begin cisst license - do not edit ---
10 
11 This software is provided "as is" under an open source license, with
12 no warranty. The complete license can be found in license.txt and
13 http://www.cisst.org/cisst/license.txt.
14 
15 --- end cisst license ---
16 */
17 
18 #ifndef _osaODEBody_h
19 #define _osaODEBody_h
20 
21 #include <ode/ode.h>
22 
23 #include <osg/Geode>
24 
27 
30 
31 // Forward declaration
32 class osaODEWorld;
33 
35 
36  public:
37 
38  // The state of a body
39  struct State {
44  };
45 
46  private:
47 
49  osaODEBody::State ODEstate;
50  double scale;
52  osaODEWorld* odeworld;
53 
55  dBodyID bodyid;
56 
58  dMass* mass;
59 
61 
64  dTriMeshDataID meshid;
65 
67 
70  dGeomID geomid;
71 
73  dVector3* Vertices;
74  int VertexCount;
75  vctDynamicMatrix<double> vctVertices;
76  dTriIndex* Indices;
77  int IndexCount;
78  double simplify_ratio;
79 
81 
84  dSpaceID space;
85 
86  // Transformation from the center of mass to the intertial frame (base)
87  vctFrame4x4<double> Rtcomb;
88 
89  void BuildODETriMesh( const vctFixedSizeVector<double,3>& com );
90 
91  // This is called from each OSG update traversal
92  virtual void UpdateTransform();
93 
94  vctMatrixRotation3<double> GetOrientation() const;
95 
96  vctFixedSizeVector<double,3> GetPosition() const;
97 
98  void Initialize( const vctFrame4x4<double>& Rtwb );
99 
100  void Initialize( const vctFrame4x4<double>& Rtwb,
101  double m,
102  const vctFixedSizeVector<double,3>& com,
103  const vctFixedSizeMatrix<double,3,3>& moit );
104 
105 
106  public:
107 
109 
117  osaODEBody( const std::string& model,
118  osaODEWorld* odeworld,
119  const vctFrame4x4<double>& Rtwb,
120  double scale = 1.0,
121  double alpha = 1.0,
122  const std::string& options = std::string(""),
123  osaOSGWorld* osgworld = NULL,
124  double simplify_ratio = 0.0 );
125 
126 
128 
137  osaODEBody( const std::string& model,
138  osaODEWorld* odeworld,
139  const vctFrm3& Rtwb,
140  double scale = 1.0,
141  double alpha = 1.0,
142  const std::string& options = std::string(""),
143  osaOSGWorld* osgworld = NULL,
144  double simplify_ratio = 0.0 );
145 
146 
148 
159  osaODEBody( const std::string& model,
160  osaODEWorld* odeWorld,
161  const vctFrame4x4<double>& Rtwb,
162  double m,
163  const vctFixedSizeVector<double,3>& com,
164  const vctFixedSizeMatrix<double,3,3>& moit,
165  double scale = 1.0,
166  double alpha = 1.0,
167  const std::string& options = std::string(""),
168  osaOSGWorld* osgworld = NULL,
169  double simplify_ratio = 0.0 );
170 
172 
183  osaODEBody( const std::string& model,
184  osaODEWorld* odeworld,
185  const vctFrm3& Rt,
186  double m,
187  const vctFixedSizeVector<double,3>& tbcom,
188  const vctFixedSizeMatrix<double,3,3>& moit,
189  double scale = 1.0,
190  double alpha = 1.0,
191  const std::string& options = std::string(""),
192  osaOSGWorld* osgworld = NULL,
193  double simplify_ratio = 0.0 );
194 
196 
206  osaODEBody( const std::string& model,
207  osaODEWorld* odeworld,
208  const vctFrame4x4<double>& Rt,
209  double m,
210  double scale = 1.0,
211  double alpha = 1.0,
212  const std::string& options = std::string(""),
213  osaOSGWorld* osgworld = NULL,
214  double simplify_ratio = 0.0 );
215 
217 
227  osaODEBody( const std::string& model,
228  osaODEWorld* odeworld,
229  const vctFrm3& Rt,
230  double m,
231  double scale = 1.0,
232  double alpha = 1.0,
233  const std::string& options = std::string(""),
234  osaOSGWorld* osgworld = NULL,
235  double simplify_ratio = 0.0 );
236 
237 
239  ~osaODEBody();
240 
242  void Enable();
243 
245  void Disable();
246 
248  dBodyID GetBodyID() const { return bodyid; }
249 
251  dGeomID GetGeomID() const { return geomid; }
252 
253  const std::string& GetUserData();
254 
255  void SetTransform( const vctFrame4x4<double>& Rt );
256  vctFrm3 GetTransform() const;
257 
258  //vctDynamicMatrix<double> GetVertices() const;
259 
260 };
261 
262 #endif
Definition: osaODEBody.h:39
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
void Initialize(double scale=1.0)
Definition: osaOSGBody.h:34
vctFixedSizeVector< double, 3 > t
Definition: osaODEBody.h:41
virtual void UpdateTransform()
This method is called from the transform callback.
Declaration of vctMatrixRotation3.
Definition: osaOSGWorld.h:24
vctMatrixRotation3< double > R
Definition: osaODEBody.h:40
Declaration of vctFixedSizeVector.
virtual vctFrm3 GetTransform() const
vctFixedSizeVector< double, 3 > w
Definition: osaODEBody.h:43
dBodyID GetBodyID() const
Query the ID of the body.
Definition: osaODEBody.h:248
Definition: osaODEWorld.h:58
dGeomID GetGeomID() const
Query the ID of the body.
Definition: osaODEBody.h:251
virtual void SetTransform(const vctFrame4x4< double > &Rt)
Set the transform of the body.
Definition: osaODEBody.h:34
vctFixedSizeVector< double, 3 > v
Definition: osaODEBody.h:42