GpuRaySensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 #ifndef _GAZEBO_SENSORS_GPURAYSENSOR_HH_
18 #define _GAZEBO_SENSORS_GPURAYSENSOR_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include <ignition/math/Angle.hh>
25 #include <ignition/math/Pose3.hh>
26 
28 #include "gazebo/sensors/Sensor.hh"
30 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
36  namespace sensors
37  {
38  // Forward declare private data pointer.
39  class GpuRaySensorPrivate;
40 
44 
50  class GZ_SENSORS_VISIBLE GpuRaySensor: public Sensor
51  {
53  public: GpuRaySensor();
54 
56  public: virtual ~GpuRaySensor();
57 
61  public: virtual void Load(const std::string &_worldName,
62  sdf::ElementPtr _sdf);
63 
66  public: virtual void Load(const std::string &_worldName);
67 
69  public: virtual void Init();
70 
71  // Documentation inherited
72  protected: virtual bool UpdateImpl(const bool _force);
73 
75  protected: virtual void Fini();
76 
77  // Documentation inherited
78  public: virtual std::string Topic() const;
79 
83 
86  public: ignition::math::Angle AngleMin() const;
87 
90  public: void SetAngleMin(const double _angle);
91 
94  public: ignition::math::Angle AngleMax() const;
95 
98  public: void SetAngleMax(const double _angle);
99 
102  public: double AngleResolution() const;
103 
106  public: double RangeMin() const;
107 
110  public: double RangeMax() const;
111 
119  public: double RangeResolution() const;
120 
123  public: int RayCount() const;
124 
127  public: int RangeCount() const;
128 
131  public: int VerticalRayCount() const;
132 
135  public: int VerticalRangeCount() const;
136 
139  public: ignition::math::Angle VerticalAngleMin() const;
140 
143  public: void SetVerticalAngleMin(const double _angle);
144 
147  public: ignition::math::Angle VerticalAngleMax() const;
148 
151  public: void SetVerticalAngleMax(const double _angle);
152 
155  public: double VerticalAngleResolution() const;
156 
166  public: double Range(const int _index) const;
167 
170  public: void Ranges(std::vector<double> &_ranges) const;
171 
181  public: double Retro(const int _index) const;
182 
192  public: int Fiducial(const unsigned int _index) const;
193 
196  public: unsigned int CameraCount() const;
197 
200  public: bool IsHorizontal() const;
201 
208  public: double RayCountRatio() const;
209 
216  public: double RangeCountRatio() const;
217 
220  public: double HorzFOV() const;
221 
224  public: double CosHorzFOV() const;
225 
228  public: double VertFOV() const;
229 
232  public: double CosVertFOV() const;
233 
236  public: double HorzHalfAngle() const;
237 
240  public: double VertHalfAngle() const;
241 
245  std::function<void(const float *, unsigned int, unsigned int,
246  unsigned int, const std::string &)> _subscriber);
247 
248  // Documentation inherited
249  public: virtual bool IsActive() const;
250 
252  private: void Render();
253 
256  private: std::unique_ptr<GpuRaySensorPrivate> dataPtr;
257  };
259  }
260 }
261 #endif
sensors
Definition: SensorManager.hh:35
Forward declarations for transport.
GPU based laser sensor.
Definition: GpuRaySensor.hh:51
double Range(const int _index) const
Get detected range for a ray.
event::ConnectionPtr ConnectNewLaserFrame(std::function< void(const float *, unsigned int, unsigned int, unsigned int, const std::string &)> _subscriber)
Connect to the new laser frame event.
double HorzFOV() const
Get the horizontal field of view of the laser sensor.
double HorzHalfAngle() const
Get (horizontal_max_angle + horizontal_min_angle) * 0.5.
double RangeMax() const
Get the maximum range.
double VerticalAngleResolution() const
Get the vertical angle in radians between each range.
double VertFOV() const
Get the vertical field-of-view.
int RayCount() const
Get the ray count.
void SetAngleMax(const double _angle)
Set the scan maximum angle.
virtual void Fini()
Finalize the ray.
double CosHorzFOV() const
Get Cos Horz field-of-view.
ignition::math::Angle AngleMin() const
Get the minimum angle.
virtual void Init()
Initialize the ray.
int VerticalRangeCount() const
Get the vertical scan line count.
double RangeCountRatio() const
Return the ratio of horizontal range count to vertical range count.
double RangeMin() const
Get the minimum range.
virtual void Load(const std::string &_worldName, sdf::ElementPtr _sdf)
Load the sensor with SDF parameters.
void SetVerticalAngleMax(const double _angle)
Set the vertical scan line top angle.
virtual void Load(const std::string &_worldName)
Load the sensor with default parameters.
double RangeResolution() const
Get the range resolution If RangeResolution is 1, the number of simulated rays is equal to the number...
int VerticalRayCount() const
Get the vertical scan line count.
double VertHalfAngle() const
Get (vertical_max_angle + vertical_min_angle) * 0.5.
double RayCountRatio() const
Return the ratio of horizontal ray count to vertical ray count.
void Ranges(std::vector< double > &_ranges) const
Get all the ranges.
virtual bool IsActive() const
Returns true if sensor generation is active.
virtual std::string Topic() const
Returns the topic name as set in SDF.
unsigned int CameraCount() const
Gets the camera count.
rendering::GpuLaserPtr LaserCamera() const
Returns a pointer to the internally kept rendering::GpuLaser.
double AngleResolution() const
Get radians between each range.
double Retro(const int _index) const
Get detected retro (intensity) value for a ray.
ignition::math::Angle VerticalAngleMin() const
Get the vertical scan bottom angle.
virtual bool UpdateImpl(const bool _force)
This gets overwritten by derived sensor types.
void SetAngleMin(const double _angle)
Set the scan minimum angle.
ignition::math::Angle AngleMax() const
Get the maximum angle.
int Fiducial(const unsigned int _index) const
Get detected fiducial value for a ray.
void SetVerticalAngleMin(const double _angle)
Set the vertical scan bottom angle.
double CosVertFOV() const
Get Cos Vert field-of-view.
bool IsHorizontal() const
Gets if sensor is horizontal.
int RangeCount() const
Get the range count.
virtual ~GpuRaySensor()
Destructor.
ignition::math::Angle VerticalAngleMax() const
Get the vertical scan line top angle.
Base class for sensors.
Definition: Sensor.hh:53
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
boost::shared_ptr< GpuLaser > GpuLaserPtr
Definition: RenderTypes.hh:106
Forward declarations for the common classes.
Definition: Animation.hh:27