Class
List
Hierarchy
Modules
Common
Events
Math
Messages
Physics
Rendering
Sensors
Transport
Links
Gazebo Website
Wiki
Tutorials
Download
Report Documentation Issues
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
gazebo
physics
PhysicsEngine.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2012 Open Source Robotics Foundation
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
*/
17
/* Desc: The base class for all physics engines
18
* Author: Nate Koenig
19
*/
20
21
#ifndef _PHYSICSENGINE_HH_
22
#define _PHYSICSENGINE_HH_
23
24
#include <boost/thread/recursive_mutex.hpp>
25
#include <string>
26
27
#include "
gazebo/transport/TransportTypes.hh
"
28
#include "
gazebo/msgs/msgs.hh
"
29
30
#include "
gazebo/physics/PhysicsTypes.hh
"
31
32
namespace
gazebo
33
{
34
namespace
physics
35
{
36
class
ContactManager;
37
40
43
class
PhysicsEngine
44
{
47
public
:
explicit
PhysicsEngine
(
WorldPtr
_world);
48
50
public
:
virtual
~PhysicsEngine
();
51
54
public
:
virtual
void
Load
(
sdf::ElementPtr
_sdf);
55
57
public
:
virtual
void
Init
() = 0;
58
60
public
:
virtual
void
Fini
();
61
63
public
:
virtual
void
Reset
() {}
64
66
public
:
virtual
void
InitForThread
() = 0;
67
69
public
:
virtual
void
UpdateCollision
() = 0;
70
73
public
:
virtual
std::string
GetType
()
const
= 0;
74
77
public
:
virtual
void
SetSeed
(uint32_t _seed) = 0;
78
82
public
:
void
SetUpdateRate
(
double
_value)
GAZEBO_DEPRECATED
(1.5);
83
87
public
:
double
GetUpdateRate
()
GAZEBO_DEPRECATED
(1.5);
88
91
public:
double
GetUpdatePeriod
();
92
96
public: virtual
void
SetStepTime
(
double
_value)
GAZEBO_DEPRECATED
(1.5);
97
101
public: virtual
double
GetStepTime
() GAZEBO_DEPRECATED(1.5);
102
105
public:
double
GetTargetRealTimeFactor
() const;
106
109
public:
double
GetRealTimeUpdateRate
() const;
110
113
public:
double
GetMaxStepSize
() const;
114
117
public:
void
SetTargetRealTimeFactor
(
double
_factor);
118
121
public:
void
SetRealTimeUpdateRate
(
double
_rate);
122
125
public:
void
SetMaxStepSize
(
double
_stepSize);
126
128
public: virtual
void
UpdatePhysics
() {}
129
132
public
:
virtual
LinkPtr
CreateLink
(
ModelPtr
_parent) = 0;
133
137
public
:
virtual
CollisionPtr
CreateCollision
(
138
const
std::string &_shapeType,
LinkPtr
_link) = 0;
139
143
public
:
CollisionPtr
CreateCollision
(
const
std::string &_shapeType,
144
const
std::string &_linkName);
145
149
public
:
virtual
ShapePtr
CreateShape
(
const
std::string &_shapeType,
150
CollisionPtr
_collision) = 0;
151
155
public
:
virtual
JointPtr
CreateJoint
(
const
std::string &_type,
156
ModelPtr
_parent =
ModelPtr
()) = 0;
157
160
public
:
virtual
math::Vector3
GetGravity
()
const
;
161
164
public
:
virtual
void
SetGravity
(
165
const
gazebo::math::Vector3
&_gravity) = 0;
166
171
public
:
virtual
void
SetWorldCFM
(
double
_cfm);
172
177
public
:
virtual
void
SetWorldERP
(
double
_erp);
178
183
public
:
virtual
void
SetAutoDisableFlag
(
bool
_autoDisable);
184
189
public
:
virtual
void
SetSORPGSPreconIters
(
unsigned
int
_iters);
190
195
public
:
virtual
void
SetSORPGSIters
(
unsigned
int
_iters);
196
201
public
:
virtual
void
SetSORPGSW
(
double
_w);
202
207
public
:
virtual
void
SetContactMaxCorrectingVel
(
double
_vel);
208
213
public
:
virtual
void
SetContactSurfaceLayer
(
double
_layerDepth);
214
219
public
:
virtual
void
SetMaxContacts
(
double
_maxContacts);
220
225
public
:
virtual
double
GetWorldCFM
() {
return
0;}
226
231
public
:
virtual
double
GetWorldERP
() {
return
0;}
232
237
public
:
virtual
bool
GetAutoDisableFlag
() {
return
0;}
238
243
public
:
virtual
int
GetSORPGSPreconIters
() {
return
0;}
244
249
public
:
virtual
int
GetSORPGSIters
() {
return
0;}
250
255
public
:
virtual
double
GetSORPGSW
() {
return
0;}
256
261
public
:
virtual
double
GetContactMaxCorrectingVel
() {
return
0;}
262
267
public
:
virtual
double
GetContactSurfaceLayer
() {
return
0;}
268
273
public
:
virtual
int
GetMaxContacts
() {
return
0;}
274
278
public
:
virtual
void
SetParam
(std::string _key,
279
const
boost::any &_value);
280
284
public
:
virtual
boost::any
GetParam
(std::string _key)
const
;
285
287
public
:
virtual
void
DebugPrint
()
const
= 0;
288
291
public
:
ContactManager
*
GetContactManager
()
const
;
292
295
public
: boost::recursive_mutex *
GetPhysicsUpdateMutex
()
const
296
{
return
this->
physicsUpdateMutex
;}
297
300
protected
:
virtual
void
OnRequest
(ConstRequestPtr &_msg);
301
304
protected
:
virtual
void
OnPhysicsMsg
(ConstPhysicsPtr &_msg);
305
307
protected
:
WorldPtr
world
;
308
310
protected
:
sdf::ElementPtr
sdf
;
311
313
protected
:
transport::NodePtr
node
;
314
316
protected
:
transport::PublisherPtr
responsePub
;
317
319
protected
:
transport::SubscriberPtr
physicsSub
;
320
322
protected
:
transport::SubscriberPtr
requestSub
;
323
325
protected
: boost::recursive_mutex *
physicsUpdateMutex
;
326
329
protected
:
ContactManager
*
contactManager
;
330
332
protected
:
double
realTimeUpdateRate
;
333
335
protected
:
double
targetRealTimeFactor
;
336
338
protected
:
double
maxStepSize
;
339
};
341
}
342
}
343
#endif