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 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 
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 
54  public: virtual void SetScale(const math::Vector3 &_scale);
55 
59  public: double GetRange(int _index);
60 
64  public: double GetRetro(int _index);
65 
69  public: int GetFiducial(int _index);
70 
73  public: double GetMinRange() const;
74 
77  public: double GetMaxRange() const;
78 
81  public: double GetResRange() const;
82 
85  public: int GetSampleCount() const;
86 
89  public: double GetScanResolution() const;
90 
93  public: math::Angle GetMinAngle() const;
94 
97  public: math::Angle GetMaxAngle() const;
98 
101  public: int GetVerticalSampleCount() const;
102 
105  public: double GetVerticalScanResolution() const;
106 
109  public: math::Angle GetVerticalMinAngle() const;
110 
113  public: math::Angle GetVerticalMaxAngle() const;
114 
116  public: void Update();
117 
121  public: void FillMsg(msgs::Geometry &_msg);
122 
126  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
127 
131  public: template<typename T>
133  {return this->newLaserScans.Connect(_subscriber);}
134 
138  {this->newLaserScans.Disconnect(_conn);}
139 
141  protected: virtual void UpdateRays() = 0;
142 
146  protected: virtual void AddRay(const math::Vector3 &_start,
147  const math::Vector3 &_end);
148 
150  protected: std::vector<RayShapePtr> rays;
151 
153  protected: math::Pose offset;
154 
156  protected: sdf::ElementPtr rayElem;
157 
159  protected: sdf::ElementPtr scanElem;
160 
162  protected: sdf::ElementPtr horzElem;
163 
165  protected: sdf::ElementPtr vertElem;
166 
168  protected: sdf::ElementPtr rangeElem;
169 
172  };
174  }
175 }
176 #endif