All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiRayShape.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 _MULTIRAYSHAPE_HH_
18 #define _MULTIRAYSHAPE_HH_
19 
20 #include <vector>
21 #include <string>
22 
23 #include "gazebo/math/Vector3.hh"
24 #include "gazebo/math/Angle.hh"
25 
27 #include "gazebo/physics/Shape.hh"
29 #include "gazebo/util/system.hh"
30 
31 namespace gazebo
32 {
33  namespace physics
34  {
37 
42  {
45  public: explicit MultiRayShape(CollisionPtr _parent);
46 
48  public: virtual ~MultiRayShape();
49 
51  public: virtual void Init();
52 
55  public: virtual void SetScale(const math::Vector3 &_scale);
56 
60  public: double GetRange(unsigned int _index);
61 
65  public: double GetRetro(unsigned int _index);
66 
70  public: int GetFiducial(unsigned int _index);
71 
74  public: double GetMinRange() const;
75 
78  public: double GetMaxRange() const;
79 
82  public: double GetResRange() const;
83 
86  public: int GetSampleCount() const;
87 
90  public: double GetScanResolution() const;
91 
94  public: math::Angle GetMinAngle() const;
95 
98  public: math::Angle GetMaxAngle() const;
99 
102  public: int GetVerticalSampleCount() const;
103 
106  public: double GetVerticalScanResolution() const;
107 
110  public: math::Angle GetVerticalMinAngle() const;
111 
114  public: math::Angle GetVerticalMaxAngle() const;
115 
117  public: void Update();
118 
122  public: void FillMsg(msgs::Geometry &_msg);
123 
127  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
128 
132  public: template<typename T>
134  {return this->newLaserScans.Connect(_subscriber);}
135 
139  {this->newLaserScans.Disconnect(_conn);}
140 
142  protected: virtual void UpdateRays() = 0;
143 
147  protected: virtual void AddRay(const math::Vector3 &_start,
148  const math::Vector3 &_end);
149 
151  protected: std::vector<RayShapePtr> rays;
152 
154  protected: math::Pose offset;
155 
157  protected: sdf::ElementPtr rayElem;
158 
160  protected: sdf::ElementPtr scanElem;
161 
163  protected: sdf::ElementPtr horzElem;
164 
166  protected: sdf::ElementPtr vertElem;
167 
169  protected: sdf::ElementPtr rangeElem;
170 
173  };
175  }
176 }
177 #endif