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 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 #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 
30 namespace gazebo
31 {
32  namespace physics
33  {
36 
40  class MultiRayShape : public Shape
41  {
44  public: explicit MultiRayShape(CollisionPtr _parent);
45 
47  public: virtual ~MultiRayShape();
48 
50  public: virtual void Init();
51 
55  public: double GetRange(int _index);
56 
60  public: double GetRetro(int _index);
61 
65  public: int GetFiducial(int _index);
66 
69  public: double GetMinRange() const;
70 
73  public: double GetMaxRange() const;
74 
77  public: double GetResRange() const;
78 
81  public: int GetSampleCount() const;
82 
85  public: double GetScanResolution() const;
86 
89  public: math::Angle GetMinAngle() const;
90 
93  public: math::Angle GetMaxAngle() const;
94 
97  public: int GetVerticalSampleCount() const;
98 
101  public: double GetVerticalScanResolution() const;
102 
105  public: math::Angle GetVerticalMinAngle() const;
106 
109  public: math::Angle GetVerticalMaxAngle() const;
110 
112  public: void Update();
113 
117  public: void FillMsg(msgs::Geometry &_msg);
118 
122  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
123 
127  public: template<typename T>
129  {return newLaserScans.Connect(_subscriber);}
130 
134  {newLaserScans.Disconnect(_conn);}
135 
137  protected: virtual void UpdateRays() = 0;
138 
142  protected: virtual void AddRay(const math::Vector3 &_start,
143  const math::Vector3 &_end);
144 
146  protected: std::vector<RayShapePtr> rays;
147 
149  protected: math::Pose offset;
150 
153 
156 
159 
162 
165 
168  };
170  }
171 }
172 #endif