UtDynamicsSimulator/DynamicsSimulator_impl.h
Go to the documentation of this file.
1 // -*- mode: c++; indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
2 /*
3  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
4  * All rights reserved. This program is made available under the terms of the
5  * Eclipse Public License v1.0 which accompanies this distribution, and is
6  * available at http://www.eclipse.org/legal/epl-v10.html
7  * Contributors:
8  * The University of Tokyo
9  * National Institute of Advanced Industrial Science and Technology (AIST)
10  * General Robotix Inc.
11  */
12 #ifndef NEW_DYNAMICSSIMULATOR_IMPL_HEADER
13 #define NEW_DYNAMICSSIMULATOR_IMPL_HEADER
14 
19 #include <boost/scoped_ptr.hpp>
20 
21 #include <hrpCorba/ORBwrap.h>
22 #include <hrpCorba/ModelLoader.hh>
23 #include <hrpCorba/CollisionDetector.hh>
24 #include <hrpCorba/DynamicsSimulator.hh>
25 
26 #include "World.h"
27 #include "TimeMeasure.h"
28 
29 using namespace OpenHRP;
33  class 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;
49  bool needToUpdatePositions;
50 
51  SensorStateSequence_var allCharacterSensorStates;
52  bool needToUpdateSensorStates;
53 
55 
56  TimeMeasure timeMeasure1;
57  TimeMeasure timeMeasure2;
58  TimeMeasure timeMeasure3;
59  bool timeMeasureFinished;
60 
61  void _setupCharacterData();
62  void _updateCharacterPositions();
63  void _updateSensorStates();
64 
65  void registerCollisionPair2CD(
66  const std::string &, const std::string &,
67  const std::string &, const std::string &);
68 
69  public:
70 
71  DynamicsSimulator_impl(CORBA::ORB_ptr orb);
72 
74 
75 
76  virtual void destroy();
77 
78  virtual void registerCharacter(
79  const char *name,
80  BodyInfo_ptr cinfo);
81 
82  virtual void init(
83  CORBA::Double timeStep,
84  OpenHRP::DynamicsSimulator::IntegrateMethod integrateOpt,
85  OpenHRP::DynamicsSimulator::SensorOption sensorOpt);
86 
87  virtual void registerCollisionCheckPair(
88  const char* char1,
89  const char* name1,
90  const char* char2,
91  const char* name2,
92  CORBA::Double staticFriction,
93  CORBA::Double slipFriction,
94  const DblSequence6& K,
95  const DblSequence6& C,
96  const double culling_thresh,
97  const double restitution);
98 
99  virtual void registerIntersectionCheckPair(
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  const char* characterName,
121  const char* extraJointName,
122  DblSequence6_out contactForce);
123 
124  virtual void getCharacterSensorValues(
125  const char* characterName,
126  const char* sensorName,
127  DblSequence_out values);
128 
129  virtual void initSimulation();
130 
131  virtual void stepSimulation();
132 
133  virtual void setCharacterLinkData(
134  const char* characterName,
135  const char* link,
136  OpenHRP::DynamicsSimulator::LinkDataType type,
137  const DblSequence& data);
138 
139  virtual void getCharacterLinkData(
140  const char* characterName,
141  const char* link,
142  OpenHRP::DynamicsSimulator::LinkDataType type,
143  DblSequence_out rdata);
144 
145  virtual void getCharacterAllLinkData(
146  const char* characterName,
147  OpenHRP::DynamicsSimulator::LinkDataType type,
148  DblSequence_out wdata);
149 
150  virtual void setCharacterAllLinkData(
151  const char* characterName,
152  OpenHRP::DynamicsSimulator::LinkDataType type,
153  const DblSequence& wdata);
154 
155  virtual void setGVector(const DblSequence3& wdata);
156 
157  virtual void getGVector(DblSequence3_out wdata);
158 
159  virtual void setCharacterAllJointModes(
160  const char* characterName,
161  OpenHRP::DynamicsSimulator::JointDriveMode jointMode);
162 
164  virtual CORBA::Boolean calcCharacterInverseKinematics(
165  const char* characterName,
166  const char* baseLink,
167  const char* targetLink,
168  const LinkPosition& target);
169 
170  virtual void calcCharacterForwardKinematics(
171  const char* characterName);
172 
173  virtual void calcWorldForwardKinematics();
174 
175  virtual void getWorldState(WorldState_out state);
176 
177  virtual void getCharacterSensorState(const char* characterName, SensorState_out sstate);
178 
179  virtual CORBA::Boolean getCharacterCollidingPairs(
180  const char* characterName,
181  LinkPairSequence_out pairs);
182 
183  virtual void calcCharacterJacobian(
184  const char* characterName,
185  const char* baseLink,
186  const char* targetLink,
187  DblSequence_out jacobian);
188 
189  virtual bool checkCollision(bool checkAll);
190 
191  virtual LinkPairSequence *checkIntersection(CORBA::Boolean checkAll);
192 
193  virtual DistanceSequence *checkDistance();
194  };
195 
203  class DynamicsSimulatorFactory_impl: virtual public POA_OpenHRP::DynamicsSimulatorFactory
204  {
205 
206  private:
210  CORBA::ORB_var orb_;
211 
212  public:
213 
218  DynamicsSimulatorFactory_impl(CORBA::ORB_ptr orb);
219 
224 
228  DynamicsSimulator_ptr create();
229 
230  void shutdown();
231 
232  };
233 
234 #endif
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
void getWorldState(WorldState &state, WorldBase &world)
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 Thu Sep 8 2022 02:24:03