RaySensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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_RAYSENSOR_HH_
18 #define _GAZEBO_RAYSENSOR_HH_
19 
20 #include <vector>
21 #include <string>
22 
23 #include <ignition/math/Angle.hh>
24 #include <ignition/math/Pose3.hh>
25 
26 #include "gazebo/math/Angle.hh"
27 #include "gazebo/math/Pose.hh"
29 #include "gazebo/sensors/Sensor.hh"
30 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
34  class OgreDynamicLines;
35  class Collision;
36  class MultiRayShape;
37 
40  namespace sensors
41  {
44 
52  {
54  public: RaySensor();
55 
57  public: virtual ~RaySensor();
58 
59  // Documentation inherited
60  public: virtual void Load(const std::string &_worldName);
61 
62  // Documentation inherited
63  public: virtual void Init();
64 
65  // Documentation inherited
66  protected: virtual bool UpdateImpl(bool _force);
67 
68  // Documentation inherited
69  protected: virtual void Fini();
70 
71  // Documentation inherited
72  public: virtual std::string GetTopic() const;
73 
78  public: math::Angle GetAngleMin() const GAZEBO_DEPRECATED(6.0);
79 
82  public: ignition::math::Angle AngleMin() const;
83 
88  public: math::Angle GetAngleMax() const GAZEBO_DEPRECATED(6.0);
89 
92  public: ignition::math::Angle AngleMax() const;
93 
96  public: double GetAngleResolution() const;
97 
100  public: double GetRangeMin() const;
101 
104  public: double GetRangeMax() const;
105 
108  public: double GetRangeResolution() const;
109 
112  public: int GetRayCount() const;
113 
116  public: int GetRangeCount() const;
117 
120  public: int GetVerticalRayCount() const;
121 
124  public: int GetVerticalRangeCount() const;
125 
130  public: math::Angle GetVerticalAngleMin() const GAZEBO_DEPRECATED(6.0);
131 
134  public: ignition::math::Angle VerticalAngleMin() const;
135 
140  public: math::Angle GetVerticalAngleMax() const GAZEBO_DEPRECATED(6.0);
141 
144  public: ignition::math::Angle VerticalAngleMax() const;
145 
148  public: double GetVerticalAngleResolution() const;
149 
159  public: double GetRange(unsigned int _index);
160 
163  public: void GetRanges(std::vector<double> &_ranges);
164 
174  public: double GetRetro(unsigned int _index);
175 
185  public: int GetFiducial(unsigned int _index);
186 
190  {return this->laserShape;}
191 
192  // Documentation inherited
193  public: virtual bool IsActive();
194 
195  private: physics::CollisionPtr laserCollision;
196  private: physics::MultiRayShapePtr laserShape;
197  private: physics::EntityPtr parentEntity;
198 
199  private: transport::PublisherPtr scanPub;
200  private: boost::mutex mutex;
201  private: msgs::LaserScanStamped laserMsg;
202  };
204  }
205 }
206 
207 #endif
Forward declarations for transport.
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:47
physics::MultiRayShapePtr GetLaserShape() const
Returns a pointer to the internal physics::MultiRayShape.
Definition: RaySensor.hh:189
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:96
boost::shared_ptr< MultiRayShape > MultiRayShapePtr
Definition: PhysicsTypes.hh:128
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:76
Sensor with one or more rays.
Definition: RaySensor.hh:51
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
An angle and related functions.
Definition: Angle.hh:53
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
Base class for sensors.
Definition: Sensor.hh:69
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:66