ODE_World.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  */
9 
10 #ifndef ODE_WORLD_H_INCLUDED
11 #define ODE_WORLD_H_INCLUDED
12 
13 #include <ode/ode.h>
14 #include <hrpCorba/ModelLoader.hh>
15 #include <hrpModel/World.h>
16 #include <hrpModel/Body.h>
18 #include <hrpUtil/Eigen4d.h>
19 #include <string>
20 #include <vector>
21 
22 #include "ODE_Link.h"
23 
24 static const bool USE_QUICKSTEP=true;
25 static const int QUICKSTEP_NUM_ITERATIONS = 20;
26 
27 #ifdef dDOUBLE
28 static const dReal CFM = 10e-11;
29 #else
30 static const dReal CFM = 10e-6;
31 #endif
32 static const dReal ERP = 0.2;
33 static const dReal CONTACT_MAX_CORRECTING_VEL = dInfinity;
34 static const dReal CONTACT_SURFACE_LAYER = 0.0;
35 
36 static const int COLLISION_MAX_POINT = 100;
37 
38 static const int SURFACE_MODE = 0
39 // | dContactMu2
40 // | dContactFDir1
41  | dContactBounce
42 // | dContactSoftERP
43 // | ContactSoftCFM
44 // | dContactMotion1
45 // | dContactMotion2
46 // | dContactMotionN
47 // | dContactSlip1
48 // | dContactSlip2
49 // | dContactApprox0
50 // | dContactApprox1_1
51 // | dContactApprox1_2
52 // | dContactApprox1
53  ;
54 static const dReal SURFACE_MU = dInfinity;
55 static const dReal SURFACE_MU2 = 0.0;
56 static const dReal SURFACE_BOUNCE = 0.0;
57 static const dReal SURFACE_BOUNCE_VEL = 0.0;
58 static const dReal SURFACE_SOFT_ERP = 0.0;
59 static const dReal SURFACE_SOFT_CFM = 0.0;
60 static const dReal SURFACE_MOTION1 = 0.0;
61 static const dReal SURFACE_MOTION2 = 0.0;
62 static const dReal SURFACE_SLIP1 = 0.0;
63 static const dReal SURFACE_SLIP2 = 0.0;
64 static const dReal CONTACT_FDIR1_X = 0.0;
65 static const dReal CONTACT_FDIR1_Y = 0.0;
66 static const dReal CONTACT_FDIR1_Z = 0.0;
67 
68 class ODE_World : public hrp::WorldBase
69  {
70  public:
71  ODE_World();
72  ~ODE_World();
73 
78  void setGravityAcceleration(const dVector3& gravity);
79 
84  void getGravityAcceleration(dVector3& gravity);
85 
92  void addBody(OpenHRP::BodyInfo_ptr body, const char *name);
93 
97  void initialize();
98 
102  void calcNextState(OpenHRP::CollisionSequence& corbaCollisionSequence);
103 
104  void clearExternalForces();
105 
108  };
109 
110  void addCollisionPair(OpenHRP::LinkPair& linkPair);
111 
112  dWorldID getWorldID() { return worldId; }
113  dSpaceID getSpaceID() { return spaceId; }
114  dJointGroupID getJointGroupID() { return contactgroupId; }
115 
116  OpenHRP::CollisionSequence collisions;
117 
118  struct LinkPair{
119  dBodyID bodyId1;
120  dBodyID bodyId2;
121  };
122  typedef std::vector<LinkPair> LinkPairArray;
123  LinkPairArray linkPairs;
124 
125  private:
126  dWorldID worldId;
127  dSpaceID spaceId;
128  dJointGroupID contactgroupId;
129 
131 
132  void updateSensors();
133 };
134 
135 static void ODE_collideCallback(void* data, dGeomID o1, dGeomID o2);
136 
138  public :
140 
141  virtual void initialize();
142  virtual void calcNextState();
143  void updateSensors();
144 
145  private :
146  void updateForceSensor(ODE_ForceSensor* sensor);
147 };
148 typedef boost::shared_ptr<ODE_ForwardDynamics> ODE_ForwardDynamicsPtr;
149 
150 #endif
dSpaceID getSpaceID()
Definition: ODE_World.h:113
void useInternalCollisionDetector(bool use)
Definition: ODE_World.h:106
OpenHRP::CollisionSequence collisions
Definition: ODE_World.h:116
static const dReal CFM
Definition: ODE_World.h:30
void clearExternalForces()
Definition: ODE_World.cpp:193
static const dReal SURFACE_MU
Definition: ODE_World.h:54
bool useInternalCollisionDetector_
Definition: ODE_World.h:130
virtual void calcNextState()
compute forward dynamics and update current state
static const dReal CONTACT_FDIR1_X
Definition: ODE_World.h:64
std::vector< LinkPair > LinkPairArray
Definition: ODE_World.h:122
void addBody(OpenHRP::BodyInfo_ptr body, const char *name)
add body to this world
Definition: ODE_World.cpp:55
const Vector3 & getGravityAcceleration()
get gravity acceleration
static const dReal SURFACE_SOFT_CFM
Definition: ODE_World.h:59
png_infop png_charpp name
Definition: png.h:2382
static const dReal SURFACE_MOTION2
Definition: ODE_World.h:61
static const int COLLISION_MAX_POINT
Definition: ODE_World.h:36
static const dReal SURFACE_MU2
Definition: ODE_World.h:55
void addCollisionPair(OpenHRP::LinkPair &linkPair)
Definition: ODE_World.cpp:64
void initialize()
initialize this world. This must be called after all bodies are registered.
Definition: ODE_World.cpp:173
static const bool USE_QUICKSTEP
Definition: ODE_World.h:24
static const dReal CONTACT_SURFACE_LAYER
Definition: ODE_World.h:34
static const int QUICKSTEP_NUM_ITERATIONS
Definition: ODE_World.h:25
boost::shared_ptr< Body > BodyPtr
Definition: Body.h:315
boost::shared_ptr< ODE_ForwardDynamics > ODE_ForwardDynamicsPtr
Definition: ODE_World.h:148
BodyPtr body(int index)
get body by index
void setGravityAcceleration(const dVector3 &gravity)
set gravity acceleration
Definition: ODE_World.cpp:45
static const int SURFACE_MODE
Definition: ODE_World.h:38
static const dReal SURFACE_BOUNCE
Definition: ODE_World.h:56
double dReal
Definition: ColladaUtil.h:78
static const dReal SURFACE_SOFT_ERP
Definition: ODE_World.h:58
static const dReal SURFACE_SLIP1
Definition: ODE_World.h:62
dWorldID getWorldID()
Definition: ODE_World.h:112
static const dReal CONTACT_FDIR1_Z
Definition: ODE_World.h:66
dSpaceID spaceId
Definition: ODE_World.h:127
static const dReal SURFACE_SLIP2
Definition: ODE_World.h:63
static const dReal CONTACT_MAX_CORRECTING_VEL
Definition: ODE_World.h:33
static const dReal SURFACE_BOUNCE_VEL
Definition: ODE_World.h:57
void updateSensors()
Definition: ODE_World.cpp:197
LinkPairArray linkPairs
Definition: ODE_World.h:123
static const dReal SURFACE_MOTION1
Definition: ODE_World.h:60
dWorldID worldId
Definition: ODE_World.h:126
static const dReal CONTACT_FDIR1_Y
Definition: ODE_World.h:65
JSAMPIMAGE data
Definition: jpeglib.h:945
dJointGroupID contactgroupId
Definition: ODE_World.h:128
static const dReal ERP
Definition: ODE_World.h:32
dJointGroupID getJointGroupID()
Definition: ODE_World.h:114
static void ODE_collideCallback(void *data, dGeomID o1, dGeomID o2)
Definition: ODE_World.cpp:205


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:04