ODE_DynamicsSimulator_impl.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  * General Robotix Inc.
9  */
10 #ifndef ODE_DYNAMICS_SIMULATOR_IMPL_H_INCLUDED
11 #define ODE_DYNAMICS_SIMULATOR_IMPL_H_INCLUDED
12 
13 
14 #include <hrpCorba/ORBwrap.h>
15 #include <hrpCorba/ModelLoader.hh>
16 #include <hrpCorba/CollisionDetector.hh>
17 #include <hrpCorba/DynamicsSimulator.hh>
18 
19 #include <hrpModel/World.h>
21 #include <hrpUtil/TimeMeasure.h>
22 
23 #include <boost/scoped_ptr.hpp>
24 
25 #include <ode/ode.h>
26 #include "ODE_World.h"
27 #include "ODE_Link.h"
28 using namespace OpenHRP;
29 
33 class ODE_DynamicsSimulator_impl : virtual public POA_OpenHRP::DynamicsSimulator,
34  virtual public PortableServer::RefCountServantBase
35 {
39  CORBA::ORB_var orb_;
40 
42 
43  CollisionDetector_var collisionDetector;
44 
45  CollisionSequence_var collisions;
46  LinkPairSequence_var collidingLinkPairs;
47 
48  CharacterPositionSequence_var allCharacterPositions;
50 
51  SensorStateSequence_var allCharacterSensorStates;
53 
59 
60  void _setupCharacterData();
61  void _updateCharacterPositions();
62  void _updateSensorStates();
63 
64  void registerCollisionPair2CD
65  (
66  const std::string &, const std::string &,
67  const std::string &, const std::string &
68  );
69 
70  public:
71 
72  ODE_DynamicsSimulator_impl(CORBA::ORB_ptr orb);
73 
75 
76 
77  virtual void destroy();
78 
79  virtual void registerCharacter(const char *name, BodyInfo_ptr binfo);
80 
81  virtual void init(CORBA::Double timeStep,
82  OpenHRP::DynamicsSimulator::IntegrateMethod integrateOpt,
83  OpenHRP::DynamicsSimulator::SensorOption sensorOpt);
84 
85  virtual void registerCollisionCheckPair
86  (
87  const char* char1,
88  const char* name1,
89  const char* char2,
90  const char* name2,
91  CORBA::Double staticFriction,
92  CORBA::Double slipFriction,
93  const DblSequence6& K,
94  const DblSequence6& C,
95  const double culling_thresh,
96  const double restitution);
97 
98  virtual void registerIntersectionCheckPair
99  (
100  const char* char1,
101  const char* name1,
102  const char* char2,
103  const char* name2,
104  const double tolerance);
105 
106  virtual void registerExtraJoint
107  (
108  const char* charName1,
109  const char* linkName1,
110  const char* charName2,
111  const char* linkName2,
112  const DblSequence3& link1LocalPos,
113  const DblSequence3& link2LocalPos,
114  const ExtraJointType jointType,
115  const DblSequence3& jointAxis,
116  const char* extraJointName);
117 
118  // TODO
119  virtual void getExtraJointConstraintForce
120  (
121  const char* characterName,
122  const char* extraJointName,
123  DblSequence6_out contactForce);
124 
125  virtual void getCharacterSensorValues
126  (
127  const char* characterName,
128  const char* sensorName,
129  DblSequence_out values);
130 
131  virtual void initSimulation();
132 
133  virtual void stepSimulation();
134 
135  virtual void setCharacterLinkData
136  (
137  const char* characterName,
138  const char* link,
139  OpenHRP::DynamicsSimulator::LinkDataType type,
140  const DblSequence& data);
141 
142  virtual void getCharacterLinkData
143  (
144  const char* characterName,
145  const char* link,
146  OpenHRP::DynamicsSimulator::LinkDataType type,
147  DblSequence_out rdata);
148 
149  virtual void getCharacterAllLinkData
150  (
151  const char* characterName,
152  OpenHRP::DynamicsSimulator::LinkDataType type,
153  DblSequence_out wdata);
154 
155  virtual void setCharacterAllLinkData
156  (
157  const char* characterName,
158  OpenHRP::DynamicsSimulator::LinkDataType type,
159  const DblSequence& wdata);
160 
161  virtual void setGVector(const DblSequence3& wdata);
162 
163  virtual void getGVector(DblSequence3_out wdata);
164 
165  virtual void setCharacterAllJointModes
166  (
167  const char* characterName,
168  OpenHRP::DynamicsSimulator::JointDriveMode jointMode);
169 
170  virtual CORBA::Boolean calcCharacterInverseKinematics
171  (
172  const char* characterName,
173  const char* baseLink,
174  const char* targetLink,
175  const LinkPosition& target);
176 
177  virtual void calcCharacterForwardKinematics
178  (
179  const char* characterName);
180 
181  virtual void calcWorldForwardKinematics();
182 
183  virtual bool checkCollision(bool checkAll);
184 
185  virtual LinkPairSequence *checkIntersection(CORBA::Boolean checkAll);
186 
187  virtual DistanceSequence *checkDistance();
188 
189  virtual void getWorldState(WorldState_out wstate);
190 
191  virtual void getCharacterSensorState(const char* characterName, SensorState_out sstate);
192 
193  virtual CORBA::Boolean getCharacterCollidingPairs
194  (
195  const char* characterName,
196  LinkPairSequence_out pairs);
197 
198  virtual void calcCharacterJacobian
199  (
200  const char* characterName,
201  const char* baseLink,
202  const char* targetLink,
203  DblSequence_out jacobian);
204 };
205 
213 class DynamicsSimulatorFactory_impl: virtual public POA_OpenHRP::DynamicsSimulatorFactory
214 {
215 
216  private:
220  CORBA::ORB_var orb_;
221 
222  public:
223 
229  DynamicsSimulatorFactory_impl(CORBA::ORB_ptr orb);
230 
235 
239  DynamicsSimulator_ptr create();
240 
241  void shutdown();
242 
243 };
244 
245 #endif
SensorStateSequence_var allCharacterSensorStates
png_infop png_charp png_int_32 png_int_32 int * type
Definition: png.h:2332
png_infop png_charpp name
Definition: png.h:2382
CharacterPositionSequence_var allCharacterPositions
void getWorldState(WorldState &state, WorldBase &world)
CollisionDetector_var collisionDetector
local int destroy(gz_stream *s)
Definition: gzio.c:355
JSAMPIMAGE data
Definition: jpeglib.h:945
static BodyCustomizerHandle create(BodyHandle bodyHandle, const char *modelName)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:24