All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RaySensor.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: Nate Koenig
19  * Date: 23 february 2004
20 */
21 
22 #ifndef RAYSENSOR_HH
23 #define RAYSENSOR_HH
24 
25 #include <vector>
26 #include <string>
27 
28 #include "math/Angle.hh"
29 #include "math/Pose.hh"
31 #include "sensors/Sensor.hh"
32 
33 namespace gazebo
34 {
35  class OgreDynamicLines;
36  class Collision;
37  class MultiRayShape;
38 
41  namespace sensors
42  {
51  class RaySensor: public Sensor
52  {
54  public: RaySensor();
55 
57  public: virtual ~RaySensor();
58 
62  public: virtual void Load(const std::string &_worldName,
63  sdf::ElementPtr _sdf);
64 
67  public: virtual void Load(const std::string &_worldName);
68 
70  public: virtual void Init();
71 
73  protected: virtual void UpdateImpl(bool _force);
74 
76  protected: virtual void Fini();
77 
80  public: virtual std::string GetTopic() const;
81 
84  public: math::Angle GetAngleMin() const;
85 
88  public: math::Angle GetAngleMax() const;
89 
92  public: double GetAngleResolution() const;
93 
96  public: double GetRangeMin() const;
97 
100  public: double GetRangeMax() const;
101 
104  public: double GetRangeResolution() const;
105 
108  public: int GetRayCount() const;
109 
112  public: int GetRangeCount() const;
113 
116  public: int GetVerticalRayCount() const;
117 
120  public: int GetVerticalRangeCount() const;
121 
124  public: math::Angle GetVerticalAngleMin() const;
125 
128  public: math::Angle GetVerticalAngleMax() const;
129 
139  public: double GetRange(int _index);
140 
143  public: void GetRanges(std::vector<double> &_ranges);
144 
154  public: double GetRetro(int _index);
155 
165  public: int GetFiducial(int _index);
166 
170  {return this->laserShape;}
171 
172  private: physics::CollisionPtr laserCollision;
173  private: physics::MultiRayShapePtr laserShape;
174  private: physics::EntityPtr parentEntity;
175 
176  private: transport::PublisherPtr scanPub;
177  private: boost::mutex *mutex;
178  private: msgs::LaserScan laserMsg;
179  };
181  }
182 }
183 
184 #endif