cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osaODEWorld.h
Go to the documentation of this file.
1 /*
2 
3  Author(s): Simon Leonard
4  Created on: Nov 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 _osaODEWorld_h
19 #define _osaODEWorld_h
20 
21 #include <ode/ode.h>
22 
25 
27 
30 
32 
37  double depth;
38 
39  osaODEContact();
40 
42  osaODEBody* b2,
45  double d );
46  /*
47  friend std::ostream& operator<<( std::ostream& os, const osaODEContact& c ){
48  os << "Body1: " << c.body1->GetName() << std::endl
49  << "Body2: " << c.body2->GetName() << std::endl
50  << "Position: " << c.position << std::endl
51  << "Normal: " << c.normal << std::endl
52  << "Depth: " << c.depth;
53  return os;
54  }
55  */
56 };
57 
59 
60  private:
61 
63  double timestep;
64 
66  std::list<osaODEContact> contacts;
67 
69 
73  dWorldID worldid;
74 
76 
80  dSpaceID spaceid;
81 
83  dGeomID floor;
84 
86 
90  dJointGroupID contactsgid;
91 
93 
97  dJointGroupID GetGroupID() const { return contactsgid; }
98 
100 
106  static const size_t NUM_CONTACTS = 50;
107 
108  protected:
109 
112 
113  double contacterp;
115  double mu;
116  double surfacelayer;
117 
118  public:
119 
121 
128  osaODEWorld( double period,
129  const vctFixedSizeVector<double,3>& gravity = GRAVITY );
130 
132  ~osaODEWorld();
133 
135  dWorldID GetWorldID() const { return worldid; }
136 
138  dSpaceID GetSpaceID() const { return spaceid; }
139 
140  double GetTimeStep() const { return timestep; }
141 
142  void SetGravity( const vctFixedSizeVector<double,3>& g = GRAVITY )
143  { dWorldSetGravity( GetWorldID(), g[0], g[1], g[2] ); }
144 
145  void SetERP( double erp )
146  { dWorldSetERP( GetWorldID(), erp ); }
147 
148  void SetCFM( double cfm )
149  { dWorldSetCFM( GetWorldID(), cfm ); }
150 
151  void SetContactMaxCorrectingVel( double cmcv )
152  { dWorldSetContactMaxCorrectingVel( GetWorldID(), cmcv ); }
153 
155 
161  void Collision( dGeomID o1, dGeomID o2 );
162 
164  void Step();
165 
167  std::list< osaODEContact > GetContacts();
168 
169  void SetContactERP( double erp ){ contacterp = erp; }
170  void SetContactBouncing( double cb ){ contactbounce = cb; }
171  void SetContactFriction( double mu ){ this->mu = mu; }
172  void SetContactSurfaceLayer( double sl )
173  { dWorldSetContactSurfaceLayer( GetWorldID(), sl ); }
174 
175 
176 };
177 
178 #endif
179 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
void SetContactBouncing(double cb)
Definition: osaODEWorld.h:170
Declaration of osaMutex.
double contactbounce
Definition: osaODEWorld.h:114
double surfacelayer
Definition: osaODEWorld.h:116
double depth
Definition: osaODEWorld.h:37
void SetContactMaxCorrectingVel(double cmcv)
Definition: osaODEWorld.h:151
vctFixedSizeVector< double, 3 > normal
Definition: osaODEWorld.h:36
double contacterp
Definition: osaODEWorld.h:113
void SetGravity(const vctFixedSizeVector< double, 3 > &g=GRAVITY)
Definition: osaODEWorld.h:142
void SetContactFriction(double mu)
Definition: osaODEWorld.h:171
Definition: osaODEWorld.h:31
Definition: osaOSGWorld.h:24
void SetCFM(double cfm)
Definition: osaODEWorld.h:148
void SetContactSurfaceLayer(double sl)
Definition: osaODEWorld.h:172
double GetTimeStep() const
Definition: osaODEWorld.h:140
double mu
Definition: osaODEWorld.h:115
Declaration of vctFixedSizeVector.
Definition: osaODEWorld.h:58
void SetERP(double erp)
Definition: osaODEWorld.h:145
static const vctFixedSizeVector< double, 3 > GRAVITY
Default gravity.
Definition: osaODEWorld.h:111
vctFixedSizeVector< double, 3 > position
Definition: osaODEWorld.h:35
dWorldID GetWorldID() const
Return the world ID.
Definition: osaODEWorld.h:135
dSpaceID GetSpaceID() const
Return the space ID.
Definition: osaODEWorld.h:138
Definition: osaODEBody.h:34
osaODEBody * body1
Definition: osaODEWorld.h:33
void SetContactERP(double erp)
Definition: osaODEWorld.h:169
osaODEBody * body2
Definition: osaODEWorld.h:34