MultiRayShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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 
41  class GZ_PHYSICS_VISIBLE MultiRayShape : public Shape
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 
130  public: virtual double ComputeVolume() const;
131 
135  public: template<typename T>
137  {return this->newLaserScans.Connect(_subscriber);}
138 
142  {this->newLaserScans.Disconnect(_conn);}
143 
145  protected: virtual void UpdateRays() = 0;
146 
150  protected: virtual void AddRay(const math::Vector3 &_start,
151  const math::Vector3 &_end);
152 
154  protected: std::vector<RayShapePtr> rays;
155 
157  protected: math::Pose offset;
158 
160  protected: sdf::ElementPtr rayElem;
161 
163  protected: sdf::ElementPtr scanElem;
164 
166  protected: sdf::ElementPtr horzElem;
167 
169  protected: sdf::ElementPtr vertElem;
170 
172  protected: sdf::ElementPtr rangeElem;
173 
176  };
178  }
179 }
180 #endif
sdf::ElementPtr scanElem
Scan SDF element pointer.
Definition: MultiRayShape.hh:163
math::Pose offset
Pose offset of all the rays.
Definition: MultiRayShape.hh:157
Forward declarations for the common classes.
Definition: Animation.hh:33
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Laser collision contains a set of ray-collisions, structured to simulate a laser range scanner...
Definition: MultiRayShape.hh:41
Base class for all shapes.
Definition: Shape.hh:46
void DisconnectNewLaserScans(event::ConnectionPtr &_conn)
Disconnect from the new laser scans signal.
Definition: MultiRayShape.hh:141
sdf::ElementPtr rayElem
Ray SDF element pointer.
Definition: MultiRayShape.hh:160
sdf::ElementPtr horzElem
Horizontal SDF element pointer.
Definition: MultiRayShape.hh:166
sdf::ElementPtr rangeElem
Range SDF element pointer.
Definition: MultiRayShape.hh:172
std::vector< RayShapePtr > rays
Ray data.
Definition: MultiRayShape.hh:154
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:153
event::ConnectionPtr ConnectNewLaserScans(T _subscriber)
Connect a to the new laser scan signal.
Definition: MultiRayShape.hh:136
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
An angle and related functions.
Definition: Angle.hh:53
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:104
event::EventT< void()> newLaserScans
New laser scans event.
Definition: MultiRayShape.hh:175
sdf::ElementPtr vertElem
Vertical SDF element pointer.
Definition: MultiRayShape.hh:169