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
Collision.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: Collision class
18
* Author: Nate Koenig
19
* Date: 13 Feb 2006
20
*/
21
22
#ifndef _COLLISION_HH_
23
#define _COLLISION_HH_
24
25
#include <string>
26
#include <vector>
27
28
#include "
common/Event.hh
"
29
#include "
common/CommonTypes.hh
"
30
31
#include "
physics/PhysicsTypes.hh
"
32
#include "
physics/CollisionState.hh
"
33
#include "
physics/Entity.hh
"
34
35
namespace
gazebo
36
{
37
namespace
physics
38
{
41
43
class
Collision
:
public
Entity
44
{
47
public
:
explicit
Collision
(
LinkPtr
_link);
48
50
public
:
virtual
~Collision
();
51
53
public
:
virtual
void
Fini
();
54
57
public
:
virtual
void
Load
(
sdf::ElementPtr
_sdf);
58
60
public
:
virtual
void
Init
();
61
64
public
:
virtual
void
UpdateParameters
(
sdf::ElementPtr
_sdf);
65
68
public
:
void
SetCollision
(
bool
_placeable);
69
73
public
:
bool
IsPlaceable
()
const
;
74
77
public
:
virtual
void
SetCategoryBits
(
unsigned
int
_bits) = 0;
78
81
public
:
virtual
void
SetCollideBits
(
unsigned
int
_bits) = 0;
82
85
public
:
void
SetLaserRetro
(
float
_retro);
86
89
public
:
float
GetLaserRetro
()
const
;
90
93
public
:
LinkPtr
GetLink
()
const
;
94
97
public
:
ModelPtr
GetModel
()
const
;
98
101
public
:
virtual
math::Box
GetBoundingBox
()
const
= 0;
102
106
public
:
unsigned
int
GetShapeType
();
107
110
public
:
void
SetShape
(
ShapePtr
_shape);
111
114
public
:
ShapePtr
GetShape
()
const
;
115
118
public
:
void
SetContactsEnabled
(
bool
_enable);
119
122
public
:
bool
GetContactsEnabled
()
const
;
123
127
public
:
void
AddContact
(
const
Contact
&_contact);
128
131
public
:
virtual
math::Vector3
GetRelativeLinearVel
()
const
;
132
136
public
:
virtual
math::Vector3
GetWorldLinearVel
()
const
;
137
140
public
:
virtual
math::Vector3
GetRelativeAngularVel
()
const
;
141
144
public
:
virtual
math::Vector3
GetWorldAngularVel
()
const
;
145
148
public
:
virtual
math::Vector3
GetRelativeLinearAccel
()
const
;
149
153
public
:
virtual
math::Vector3
GetWorldLinearAccel
()
const
;
154
157
public
:
virtual
math::Vector3
GetRelativeAngularAccel
()
const
;
158
162
public
:
virtual
math::Vector3
GetWorldAngularAccel
()
const
;
163
166
public
:
CollisionState
GetState
();
167
170
public
:
void
SetState
(
const
CollisionState
&_state);
171
173
public
:
template
<
typename
T>
174
event::ConnectionPtr
ConnectContact
(T _subscriber)
175
{
return
contact.
Connect
(_subscriber);}
176
178
public
:
void
DisconnectContact
(
event::ConnectionPtr
&_conn)
179
{contact.
Disconnect
(_conn);}
180
183
public
:
void
FillMsg
(msgs::Collision &_msg);
184
187
public
:
void
ProcessMsg
(
const
msgs::Collision &_msg);
188
191
public
:
inline
SurfaceParamsPtr
GetSurface
()
const
192
{
return
this->surface;}
193
196
private
: msgs::Visual CreateCollisionVisual();
197
199
protected
:
LinkPtr
link
;
200
202
protected
:
bool
placeable
;
203
205
protected
:
ShapePtr
shape
;
206
208
private
:
bool
contactsEnabled;
209
211
private
:
event::EventT
<void (
const
std::string &,
212
const
Contact
&)> contact;
213
215
private
:
SurfaceParamsPtr
surface;
216
218
private
:
float
laserRetro;
219
220
private
:
CollisionState
state;
221
};
223
}
224
}
225
#endif