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;
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
ODE_World::ODE_World
ODE_World()
Definition: ODE_World.cpp:15
hrp::ForwardDynamics::body
BodyPtr body
Definition: ForwardDynamics.h:71
ODE_World::setGravityAcceleration
void setGravityAcceleration(const dVector3 &gravity)
set gravity acceleration
Definition: ODE_World.cpp:45
hrp::WorldBase::body
BodyPtr body(int index)
get body by index
Definition: hrplib/hrpModel/World.cpp:56
SURFACE_SOFT_CFM
static const dReal SURFACE_SOFT_CFM
Definition: ODE_World.h:59
ODE_collideCallback
static void ODE_collideCallback(void *data, dGeomID o1, dGeomID o2)
Definition: ODE_World.cpp:205
ColladaUtil::dReal
double dReal
Definition: ColladaUtil.h:78
ODE_World::LinkPair
Definition: ODE_World.h:118
CFM
static const dReal CFM
Definition: ODE_World.h:30
ODE_World::spaceId
dSpaceID spaceId
Definition: ODE_World.h:127
CONTACT_FDIR1_X
static const dReal CONTACT_FDIR1_X
Definition: ODE_World.h:64
ODE_World::linkPairs
LinkPairArray linkPairs
Definition: ODE_World.h:123
ODE_ForwardDynamicsPtr
boost::shared_ptr< ODE_ForwardDynamics > ODE_ForwardDynamicsPtr
Definition: ODE_World.h:148
SURFACE_MOTION2
static const dReal SURFACE_MOTION2
Definition: ODE_World.h:61
ODE_ForwardDynamics::initialize
virtual void initialize()
Definition: ODE_World.cpp:266
ODE_World::updateSensors
void updateSensors()
Definition: ODE_World.cpp:197
ODE_ForceSensor
Definition: ODE_Link.h:50
ODE_World::worldId
dWorldID worldId
Definition: ODE_World.h:126
QUICKSTEP_NUM_ITERATIONS
static const int QUICKSTEP_NUM_ITERATIONS
Definition: ODE_World.h:25
COLLISION_MAX_POINT
static const int COLLISION_MAX_POINT
Definition: ODE_World.h:36
SURFACE_MU2
static const dReal SURFACE_MU2
Definition: ODE_World.h:55
World.h
ODE_World::LinkPair::bodyId1
dBodyID bodyId1
Definition: ODE_World.h:119
USE_QUICKSTEP
static const bool USE_QUICKSTEP
Definition: ODE_World.h:24
CONTACT_SURFACE_LAYER
static const dReal CONTACT_SURFACE_LAYER
Definition: ODE_World.h:34
ODE_ForwardDynamics::updateForceSensor
void updateForceSensor(ODE_ForceSensor *sensor)
Definition: ODE_World.cpp:311
ODE_World::useInternalCollisionDetector_
bool useInternalCollisionDetector_
Definition: ODE_World.h:130
ODE_World::collisions
OpenHRP::CollisionSequence collisions
Definition: ODE_World.h:116
ODE_World::getSpaceID
dSpaceID getSpaceID()
Definition: ODE_World.h:113
SURFACE_BOUNCE
static const dReal SURFACE_BOUNCE
Definition: ODE_World.h:56
ODE_World::clearExternalForces
void clearExternalForces()
Definition: ODE_World.cpp:193
ODE_World::contactgroupId
dJointGroupID contactgroupId
Definition: ODE_World.h:128
hrp::WorldBase::calcNextState
virtual void calcNextState()
compute forward dynamics and update current state
Definition: hrplib/hrpModel/World.cpp:135
ODE_World::getJointGroupID
dJointGroupID getJointGroupID()
Definition: ODE_World.h:114
ODE_ForwardDynamics
Definition: ODE_World.h:137
SURFACE_SOFT_ERP
static const dReal SURFACE_SOFT_ERP
Definition: ODE_World.h:58
ODE_World::useInternalCollisionDetector
void useInternalCollisionDetector(bool use)
Definition: ODE_World.h:106
hrp::BodyPtr
boost::shared_ptr< Body > BodyPtr
Definition: Body.h:315
SURFACE_MODE
static const int SURFACE_MODE
Definition: ODE_World.h:38
Eigen4d.h
name
png_infop png_charpp name
Definition: png.h:2379
hrp::WorldBase
Definition: hrplib/hrpModel/World.h:34
SURFACE_SLIP2
static const dReal SURFACE_SLIP2
Definition: ODE_World.h:63
ODE_ForwardDynamics::calcNextState
virtual void calcNextState()
Definition: ODE_World.cpp:263
data
JSAMPIMAGE data
Definition: jpeglib.h:945
SURFACE_SLIP1
static const dReal SURFACE_SLIP1
Definition: ODE_World.h:62
ODE_World::LinkPairArray
std::vector< LinkPair > LinkPairArray
Definition: ODE_World.h:122
ODE_World::LinkPair::bodyId2
dBodyID bodyId2
Definition: ODE_World.h:120
CONTACT_FDIR1_Z
static const dReal CONTACT_FDIR1_Z
Definition: ODE_World.h:66
hrp::WorldBase::getGravityAcceleration
const Vector3 & getGravityAcceleration()
get gravity acceleration
Definition: hrplib/hrpModel/World.h:128
ForwardDynamics.h
ERP
static const dReal ERP
Definition: ODE_World.h:32
ODE_World::initialize
void initialize()
initialize this world. This must be called after all bodies are registered.
Definition: ODE_World.cpp:173
ODE_World::addBody
void addBody(OpenHRP::BodyInfo_ptr body, const char *name)
add body to this world
Definition: ODE_World.cpp:55
Body.h
SURFACE_MOTION1
static const dReal SURFACE_MOTION1
Definition: ODE_World.h:60
CONTACT_MAX_CORRECTING_VEL
static const dReal CONTACT_MAX_CORRECTING_VEL
Definition: ODE_World.h:33
SURFACE_BOUNCE_VEL
static const dReal SURFACE_BOUNCE_VEL
Definition: ODE_World.h:57
hrp::ForwardDynamics
Definition: ForwardDynamics.h:35
ODE_World::~ODE_World
~ODE_World()
Definition: ODE_World.cpp:32
ODE_World
Definition: ODE_World.h:68
ODE_World::addCollisionPair
void addCollisionPair(OpenHRP::LinkPair &linkPair)
Definition: ODE_World.cpp:64
CONTACT_FDIR1_Y
static const dReal CONTACT_FDIR1_Y
Definition: ODE_World.h:65
ODE_World::getWorldID
dWorldID getWorldID()
Definition: ODE_World.h:112
ODE_ForwardDynamics::updateSensors
void updateSensors()
Definition: ODE_World.cpp:273
SURFACE_MU
static const dReal SURFACE_MU
Definition: ODE_World.h:54
ODE_ForwardDynamics::ODE_ForwardDynamics
ODE_ForwardDynamics(hrp::BodyPtr body)
Definition: ODE_World.cpp:258


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:03