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 _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
Forward declarations for transport.
physics::MultiRayShapePtr GetLaserShape() const
Returns a pointer to the internal physics::MultiRayShape.
Definition: RaySensor.hh:162
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:94
boost::shared_ptr< MultiRayShape > MultiRayShapePtr
Definition: PhysicsTypes.hh:122
boost::shared_ptr< Entity > EntityPtr
Definition: PhysicsTypes.hh:74
Sensor with one or more rays.
Definition: RaySensor.hh:48
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
An angle and related functions.
Definition: Angle.hh:52
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
Base class for sensors.
Definition: Sensor.hh:67
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48