RayShape.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 /* Desc: A ray
18  * Author: Nate Koenig
19  * Date: 14 Oct 2009
20 */
21 
22 #ifndef _RAYSHAPE_HH_
23 #define _RAYSHAPE_HH_
24 
25 #include <string>
26 
28 #include "gazebo/physics/Shape.hh"
29 #include "gazebo/util/system.hh"
30 
31 namespace gazebo
32 {
33  namespace physics
34  {
37 
40  class GZ_PHYSICS_VISIBLE RayShape : public Shape
41  {
44  public: explicit RayShape(PhysicsEnginePtr _physicsEngine);
45 
48  public: explicit RayShape(CollisionPtr _parent);
49 
51  public: virtual ~RayShape();
52 
57  public: virtual void SetPoints(const math::Vector3 &_posStart,
58  const math::Vector3 &_posEnd);
59 
62  public: ignition::math::Vector3d Start() const;
63 
66  public: ignition::math::Vector3d End() const;
67 
68 
72  public: virtual void GetRelativePoints(math::Vector3 &_posA,
73  math::Vector3 &_posB);
74 
78  public: virtual void GetGlobalPoints(math::Vector3 &_posA,
79  math::Vector3 &_posB);
80 
83  public: virtual void SetLength(double _len);
84 
87  public: double GetLength() const;
88 
90  public: virtual void SetScale(const math::Vector3 &_scale);
91 
93  public: virtual void Update() = 0;
94 
98  public: virtual void GetIntersection(double &_dist,
99  std::string &_entity) = 0;
100 
103  public: void SetRetro(float _retro);
104 
107  public: std::string CollisionName() const;
108 
111  public: float GetRetro() const;
112 
115  public: void SetFiducial(int _fid);
116 
119  public: int GetFiducial() const;
120 
122  public: virtual void Init();
123 
127  public: void FillMsg(msgs::Geometry &_msg);
128 
132  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
133 
135  public: virtual double ComputeVolume() const;
136 
142  protected: void SetCollisionName(const std::string &_name);
143 
144  // Contact information; this is filled out during collision
145  // detection.
147  protected: double contactLen;
148 
150  protected: double contactRetro;
151 
153  protected: int contactFiducial;
154 
157 
160 
163 
166 
168  private: std::string collisionName;
169 
172  protected: friend class ODEMultiRayShape;
173  };
175  }
176 }
177 #endif
math::Vector3 relativeEndPos
End position of the ray, relative to the body.
Definition: RayShape.hh:159
math::Vector3 relativeStartPos
Start position of the ray, relative to the body.
Definition: RayShape.hh:156
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
double contactRetro
Retro reflectance value.
Definition: RayShape.hh:150
Base class for all shapes.
Definition: Shape.hh:46
default namespace for gazebo
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
int contactFiducial
Fiducial ID value.
Definition: RayShape.hh:153
math::Vector3 globalStartPos
Start position of the ray in global cs.
Definition: RayShape.hh:162
Base class for Ray collision geometry.
Definition: RayShape.hh:40
math::Vector3 globalEndPos
End position of the ray in global cs.
Definition: RayShape.hh:165
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
double contactLen
Length of the ray.
Definition: RayShape.hh:147
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
ODE specific version of MultiRayShape.
Definition: ODEMultiRayShape.hh:31