Class
List
Heirarchy
Modules
Common
Events
Math
Messages
Physics
Rendering
Sensors
Transport
Links
Gazebo Website
Wiki
Tutorials
Download
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
gazebo
sensors
GpuRaySensor.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2012 Nate Koenig
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: RaySensor proximity sensor
18
* Author: Mihai Emanuel Dolha
19
* Date: 29 March 2012
20
*/
21
22
#ifndef _GPURAYSENSOR_HH_
23
#define _GPURAYSENSOR_HH_
24
25
#include <vector>
26
#include <string>
27
28
#include "
math/Angle.hh
"
29
#include "
math/Pose.hh
"
30
#include "
transport/TransportTypes.hh
"
31
#include "
sensors/Sensor.hh
"
32
#include "
rendering/RenderTypes.hh
"
33
34
namespace
gazebo
35
{
38
namespace
sensors
39
{
48
class
GpuRaySensor
:
public
Sensor
49
{
51
public
:
GpuRaySensor
();
52
54
public
:
virtual
~GpuRaySensor
();
55
59
public
:
virtual
void
Load
(
const
std::string &_worldName,
60
sdf::ElementPtr
&_sdf);
61
64
public
:
virtual
void
Load
(
const
std::string &_worldName);
65
67
public
:
virtual
void
Init
();
68
71
protected
:
virtual
void
UpdateImpl
(
bool
_force);
72
74
protected
:
virtual
void
Fini
();
75
78
public
:
rendering::GpuLaserPtr
GetLaserCamera
()
const
79
{
return
this->laserCam;}
80
83
public
:
math::Angle
GetAngleMin
()
const
;
84
87
public
:
void
SetAngleMin
(
double
_angle);
88
91
public
:
math::Angle
GetAngleMax
()
const
;
92
95
public
:
void
SetAngleMax
(
double
_angle);
96
98
public
:
double
GetAngleResolution
()
const
;
99
102
public
:
double
GetRangeMin
()
const
;
103
106
public
:
double
GetRangeMax
()
const
;
107
115
public
:
double
GetRangeResolution
()
const
;
116
119
public
:
int
GetRayCount
()
const
;
120
123
public
:
int
GetRangeCount
()
const
;
124
127
public
:
int
GetVerticalRayCount
()
const
;
128
131
public
:
int
GetVerticalRangeCount
()
const
;
132
135
public
:
math::Angle
GetVerticalAngleMin
()
const
;
136
139
public
:
void
SetVerticalAngleMin
(
double
_angle);
140
143
public
:
math::Angle
GetVerticalAngleMax
()
const
;
144
147
public
:
void
SetVerticalAngleMax
(
double
_angle);
148
149
159
public
:
double
GetRange
(
int
_index);
160
163
public
:
void
GetRanges
(std::vector<double> &_ranges);
164
174
public
:
double
GetRetro
(
int
_index);
175
185
public
:
int
GetFiducial
(
int
_index);
186
189
public
:
unsigned
int
GetCameraCount
();
190
193
public
:
bool
IsHorizontal
();
194
198
public
:
double
Get1stRatio
();
199
202
public
:
double
Get2ndRatio
();
203
206
public
:
double
GetHFOV
();
207
210
public
:
double
GetCHFOV
();
211
214
public
:
double
GetVFOV
();
215
218
public
:
double
GetCVFOV
();
219
222
public
:
double
GetHAngle
();
223
226
public
:
double
GetVAngle
();
227
230
private
:
void
OnPose(ConstPosePtr &_msg);
231
234
public
:
event::ConnectionPtr
ConnectNewLaserFrame
(
235
boost::function<
void
(
const
float
*,
unsigned
int
,
unsigned
int
,
236
unsigned
int
,
const
std::string &)> subscriber);
237
240
public
:
void
DisconnectNewLaserFrame
(
event::ConnectionPtr
&c);
241
242
protected
:
math::Vector3
offset
;
243
protected
:
sdf::ElementPtr
rayElem
;
244
protected
:
sdf::ElementPtr
scanElem
;
245
protected
:
sdf::ElementPtr
horzElem
;
246
protected
:
sdf::ElementPtr
vertElem
;
247
protected
:
sdf::ElementPtr
rangeElem
;
248
protected
:
sdf::ElementPtr
cameraElem
;
249
250
protected
:
unsigned
int
cameraCount
;
251
252
protected
:
double
hfov
,
vfov
,
chfov
,
cvfov
,
hang
,
vang
;
253
protected
:
double
near
,
far
;
254
protected
:
unsigned
int
width_1st
,
height_1st
;
255
protected
:
unsigned
int
width_2nd
,
height_2nd
;
256
protected
:
double
ratio_1st
,
ratio_2nd
;
257
protected
:
bool
isHorizontal
;
258
259
private
:
rendering::GpuLaserPtr
laserCam;
260
private
:
rendering::ScenePtr
scene;
261
262
private
:
transport::PublisherPtr
scanPub;
263
private
: boost::mutex *mutex;
264
private
: msgs::LaserScan laserMsg;
265
};
267
}
268
}
269
270
#endif