MultiRayShape.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 GAZEBO_PHYSICS_MULTIRAYSHAPE_HH_
18 #define GAZEBO_PHYSICS_MULTIRAYSHAPE_HH_
19 
20 #include <vector>
21 #include <string>
22 #include <ignition/math/Angle.hh>
23 
24 #include "gazebo/math/Vector3.hh"
25 #include "gazebo/math/Angle.hh"
26 
28 #include "gazebo/physics/Shape.hh"
30 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
34  namespace physics
35  {
38 
42  class GZ_PHYSICS_VISIBLE MultiRayShape : public Shape
43  {
46  public: explicit MultiRayShape(CollisionPtr _parent);
47 
59  public: explicit MultiRayShape(PhysicsEnginePtr _physicsEngine);
60 
62  public: virtual ~MultiRayShape();
63 
65  public: virtual void Init();
66 
69  public: virtual void SetScale(const ignition::math::Vector3d &_scale);
70 
74  public: double GetRange(unsigned int _index);
75 
79  public: double GetRetro(unsigned int _index);
80 
84  public: int GetFiducial(unsigned int _index);
85 
88  public: double GetMinRange() const;
89 
92  public: double GetMaxRange() const;
93 
96  public: double GetResRange() const;
97 
100  public: int GetSampleCount() const;
101 
104  public: double GetScanResolution() const;
105 
109  public: math::Angle GetMinAngle() const GAZEBO_DEPRECATED(8.0);
110 
113  public: ignition::math::Angle MinAngle() const;
114 
118  public: math::Angle GetMaxAngle() const GAZEBO_DEPRECATED(8.0);
119 
122  public: ignition::math::Angle MaxAngle() const;
123 
126  public: int GetVerticalSampleCount() const;
127 
130  public: double GetVerticalScanResolution() const;
131 
135  public: math::Angle GetVerticalMinAngle() const GAZEBO_DEPRECATED(8.0);
136 
139  public: ignition::math::Angle VerticalMinAngle() const;
140 
144  public: math::Angle GetVerticalMaxAngle() const GAZEBO_DEPRECATED(8.0);
145 
148  public: ignition::math::Angle VerticalMaxAngle() const;
149 
151  public: void Update();
152 
156  public: void FillMsg(msgs::Geometry &_msg);
157 
161  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
162 
164  public: virtual double ComputeVolume() const;
165 
169  public: template<typename T>
171  {return this->newLaserScans.Connect(_subscriber);}
172 
177  GAZEBO_DEPRECATED(8.0)
178  {this->newLaserScans.Disconnect(_conn->Id());}
179 
184  public: virtual void UpdateRays() = 0;
185 
190  public: virtual void AddRay(const math::Vector3 &_start,
191  const math::Vector3 &_end) GAZEBO_DEPRECATED(8.0);
192 
196  public: virtual void AddRay(const ignition::math::Vector3d &_start,
197  const ignition::math::Vector3d &_end);
198 
205  public: bool SetRay(const unsigned int _rayIndex,
206  const ignition::math::Vector3d &_start,
207  const ignition::math::Vector3d &_end);
208 
211  public: unsigned int RayCount() const;
212 
217  public: RayShapePtr Ray(const unsigned int _rayIndex) const;
218 
220  protected: std::vector<RayShapePtr> rays;
221 
223  protected: ignition::math::Pose3d offset;
224 
226  protected: sdf::ElementPtr rayElem;
227 
229  protected: sdf::ElementPtr scanElem;
230 
232  protected: sdf::ElementPtr horzElem;
233 
235  protected: sdf::ElementPtr vertElem;
236 
238  protected: sdf::ElementPtr rangeElem;
239 
242 
244  private: double minRange = 0;
245 
247  private: double maxRange = 1000;
248  };
250  }
251 }
252 #endif
sdf::ElementPtr scanElem
Scan SDF element pointer.
Definition: MultiRayShape.hh:229
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
Laser collision contains a set of ray-collisions, structured to simulate a laser range scanner...
Definition: MultiRayShape.hh:42
void DisconnectNewLaserScans(event::ConnectionPtr &_conn) GAZEBO_DEPRECATED(8.0)
Disconnect from the new laser scans signal.
Definition: MultiRayShape.hh:176
Base class for all shapes.
Definition: Shape.hh:45
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
ignition::math::Pose3d offset
Pose offset of all the rays.
Definition: MultiRayShape.hh:223
sdf::ElementPtr rayElem
Ray SDF element pointer.
Definition: MultiRayShape.hh:226
sdf::ElementPtr horzElem
Horizontal SDF element pointer.
Definition: MultiRayShape.hh:232
sdf::ElementPtr rangeElem
Range SDF element pointer.
Definition: MultiRayShape.hh:238
std::vector< RayShapePtr > rays
Ray data.
Definition: MultiRayShape.hh:220
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:302
boost::shared_ptr< RayShape > RayShapePtr
Definition: PhysicsTypes.hh:145
event::ConnectionPtr ConnectNewLaserScans(T _subscriber)
Connect a to the new laser scan signal.
Definition: MultiRayShape.hh:170
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:113
event::EventT< void()> newLaserScans
New laser scans event.
Definition: MultiRayShape.hh:241
sdf::ElementPtr vertElem
Vertical SDF element pointer.
Definition: MultiRayShape.hh:235