All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:144
sdf::ElementPtr rayElem
Ray SDF element pointer.
Definition: MultiRayShape.hh:157
Encapsulates a position and rotation in three space.
Definition: Pose.hh:40
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
math::Pose offset
Pose offset of all the rays.
Definition: MultiRayShape.hh:154
Laser collision contains a set of ray-collisions, structured to simulate a laser range scanner...
Definition: MultiRayShape.hh:41
void DisconnectNewLaserScans(event::ConnectionPtr &_conn)
Disconnect from the new laser scans signal.
Definition: MultiRayShape.hh:138
sdf::ElementPtr vertElem
Vertical SDF element pointer.
Definition: MultiRayShape.hh:166
event::EventT< void()> newLaserScans
New laser scans event.
Definition: MultiRayShape.hh:172
sdf::ElementPtr scanElem
Scan SDF element pointer.
Definition: MultiRayShape.hh:160
Base class for all shapes.
Definition: Shape.hh:40
sdf::ElementPtr rangeElem
Range SDF element pointer.
Definition: MultiRayShape.hh:169
std::vector< RayShapePtr > rays
Ray data.
Definition: MultiRayShape.hh:151
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:94
event::ConnectionPtr ConnectNewLaserScans(T _subscriber)
Connect a to the new laser scan signal.
Definition: MultiRayShape.hh:133
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
An angle and related functions.
Definition: Angle.hh:52
sdf::ElementPtr horzElem
Horizontal SDF element pointer.
Definition: MultiRayShape.hh:163
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48