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 (C) 2012-2014 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 _RAYSENSOR_HH_
18 #define _RAYSENSOR_HH_
19 
20 #include <vector>
21 #include <string>
22 
23 #include "gazebo/math/Angle.hh"
24 #include "gazebo/math/Pose.hh"
26 #include "gazebo/sensors/Sensor.hh"
27 #include "gazebo/util/system.hh"
28 
29 namespace gazebo
30 {
31  class OgreDynamicLines;
32  class Collision;
33  class MultiRayShape;
34 
37  namespace sensors
38  {
41 
49  {
51  public: RaySensor();
52 
54  public: virtual ~RaySensor();
55 
56  // Documentation inherited
57  public: virtual void Load(const std::string &_worldName);
58 
59  // Documentation inherited
60  public: virtual void Init();
61 
62  // Documentation inherited
63  protected: virtual bool UpdateImpl(bool _force);
64 
65  // Documentation inherited
66  protected: virtual void Fini();
67 
68  // Documentation inherited
69  public: virtual std::string GetTopic() const;
70 
73  public: math::Angle GetAngleMin() const;
74 
77  public: math::Angle GetAngleMax() const;
78 
81  public: double GetAngleResolution() const;
82 
85  public: double GetRangeMin() const;
86 
89  public: double GetRangeMax() const;
90 
93  public: double GetRangeResolution() const;
94 
97  public: int GetRayCount() const;
98 
101  public: int GetRangeCount() const;
102 
105  public: int GetVerticalRayCount() const;
106 
109  public: int GetVerticalRangeCount() const;
110 
113  public: math::Angle GetVerticalAngleMin() const;
114 
117  public: math::Angle GetVerticalAngleMax() const;
118 
121  public: double GetVerticalAngleResolution() const;
122 
132  public: double GetRange(unsigned int _index);
133 
136  public: void GetRanges(std::vector<double> &_ranges);
137 
147  public: double GetRetro(unsigned int _index);
148 
158  public: int GetFiducial(unsigned 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