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 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: 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  {
45 
52  class RaySensor: public Sensor
53  {
55  public: RaySensor();
56 
58  public: virtual ~RaySensor();
59 
60  // Documentation inherited
61  public: virtual void Load(const std::string &_worldName);
62 
63  // Documentation inherited
64  public: virtual void Init();
65 
66  // Documentation inherited
67  protected: virtual void UpdateImpl(bool _force);
68 
69  // Documentation inherited
70  protected: virtual void Fini();
71 
72  // Documentation inherited
73  public: virtual std::string GetTopic() const;
74 
77  public: math::Angle GetAngleMin() const;
78 
81  public: math::Angle GetAngleMax() const;
82 
85  public: double GetAngleResolution() const;
86 
89  public: double GetRangeMin() const;
90 
93  public: double GetRangeMax() const;
94 
97  public: double GetRangeResolution() const;
98 
101  public: int GetRayCount() const;
102 
105  public: int GetRangeCount() const;
106 
109  public: int GetVerticalRayCount() const;
110 
113  public: int GetVerticalRangeCount() const;
114 
117  public: math::Angle GetVerticalAngleMin() const;
118 
121  public: math::Angle GetVerticalAngleMax() const;
122 
132  public: double GetRange(int _index);
133 
136  public: void GetRanges(std::vector<double> &_ranges);
137 
147  public: double GetRetro(int _index);
148 
158  public: int GetFiducial(int _index);
159 
163  {return this->laserShape;}
164 
165  // Documentation inherited
166  public: virtual bool IsActive();
167 
168  private: physics::CollisionPtr laserCollision;
169  private: physics::MultiRayShapePtr laserShape;
170  private: physics::EntityPtr parentEntity;
171 
172  private: transport::PublisherPtr scanPub;
173  private: boost::mutex mutex;
174  private: msgs::LaserScanStamped laserMsg;
175  };
177  }
178 }
179 
180 #endif