RayShape.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_RAYSHAPE_HH_
18 #define GAZEBO_PHYSICS_RAYSHAPE_HH_
19 
20 #include <string>
21 
23 #include "gazebo/physics/Shape.hh"
24 #include "gazebo/util/system.hh"
25 
26 namespace gazebo
27 {
28  namespace physics
29  {
32 
35  class GZ_PHYSICS_VISIBLE RayShape : public Shape
36  {
39  public: explicit RayShape(PhysicsEnginePtr _physicsEngine);
40 
43  public: explicit RayShape(CollisionPtr _parent);
44 
46  public: virtual ~RayShape();
47 
53  public: virtual void SetPoints(const math::Vector3 &_posStart,
54  const math::Vector3 &_posEnd) GAZEBO_DEPRECATED(8.0);
55 
60  public: virtual void SetPoints(const ignition::math::Vector3d &_posStart,
61  const ignition::math::Vector3d &_posEnd);
62 
65  public: ignition::math::Vector3d Start() const;
66 
69  public: ignition::math::Vector3d End() const;
70 
75  public: virtual void GetRelativePoints(math::Vector3 &_posA,
76  math::Vector3 &_posB) GAZEBO_DEPRECATED(8.0);
77 
81  public: virtual void RelativePoints(ignition::math::Vector3d &_posA,
82  ignition::math::Vector3d &_posB);
83 
88  public: virtual void GetGlobalPoints(math::Vector3 &_posA,
89  math::Vector3 &_posB) GAZEBO_DEPRECATED(8.0);
90 
94  public: virtual void GlobalPoints(ignition::math::Vector3d &_posA,
95  ignition::math::Vector3d &_posB);
96 
99  public: virtual void SetLength(double _len);
100 
103  public: double GetLength() const;
104 
106  public: virtual void SetScale(const ignition::math::Vector3d &_scale);
107 
109  public: virtual void Update() = 0;
110 
114  public: virtual void GetIntersection(double &_dist,
115  std::string &_entity) = 0;
116 
119  public: void SetRetro(float _retro);
120 
123  public: std::string CollisionName() const;
124 
127  public: float GetRetro() const;
128 
131  public: void SetFiducial(int _fid);
132 
135  public: int GetFiducial() const;
136 
138  public: virtual void Init();
139 
143  public: void FillMsg(msgs::Geometry &_msg);
144 
148  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
149 
151  public: virtual double ComputeVolume() const;
152 
158  protected: void SetCollisionName(const std::string &_name);
159 
160  // Contact information; this is filled out during collision
161  // detection.
163  protected: double contactLen;
164 
166  protected: double contactRetro;
167 
169  protected: int contactFiducial;
170 
172  protected: ignition::math::Vector3d relativeStartPos;
173 
175  protected: ignition::math::Vector3d relativeEndPos;
176 
178  protected: ignition::math::Vector3d globalStartPos;
179 
181  protected: ignition::math::Vector3d globalEndPos;
182 
184  private: std::string collisionName;
185 
188  protected: friend class ODEMultiRayShape;
189  };
191  }
192 }
193 #endif
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
double contactRetro
Retro reflectance value.
Definition: RayShape.hh:166
Base class for all shapes.
Definition: Shape.hh:45
default namespace for gazebo
ignition::math::Vector3d relativeStartPos
Start position of the ray, relative to the body.
Definition: RayShape.hh:172
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
ignition::math::Vector3d relativeEndPos
End position of the ray, relative to the body.
Definition: RayShape.hh:175
ignition::math::Vector3d globalStartPos
Start position of the ray in global cs.
Definition: RayShape.hh:178
int contactFiducial
Fiducial ID value.
Definition: RayShape.hh:169
Base class for Ray collision geometry.
Definition: RayShape.hh:35
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:302
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
double contactLen
Length of the ray.
Definition: RayShape.hh:163
ignition::math::Vector3d globalEndPos
End position of the ray in global cs.
Definition: RayShape.hh:181
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
ODE specific version of MultiRayShape.
Definition: ODEMultiRayShape.hh:31