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


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:02