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 
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 
60 
64  public: virtual void GetRelativePoints(math::Vector3 &_posA,
65  math::Vector3 &_posB);
66 
70  public: virtual void GetGlobalPoints(math::Vector3 &_posA,
71  math::Vector3 &_posB);
72 
75  public: virtual void SetLength(double _len);
76 
79  public: double GetLength() const;
80 
82  public: virtual void SetScale(const math::Vector3 &_scale);
83 
85  public: virtual void Update() = 0;
86 
90  public: virtual void GetIntersection(double &_dist,
91  std::string &_entity) = 0;
92 
95  public: void SetRetro(float _retro);
96 
99  public: float GetRetro() const;
100 
103  public: void SetFiducial(int _fid);
104 
107  public: int GetFiducial() const;
108 
110  public: virtual void Init();
111 
115  public: void FillMsg(msgs::Geometry &_msg);
116 
120  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
121 
123  public: virtual double ComputeVolume() const;
124 
125  // Contact information; this is filled out during collision
126  // detection.
128  protected: double contactLen;
130  protected: double contactRetro;
132  protected: int contactFiducial;
133 
138 
141 
144  };
146  }
147 }
148 #endif
math::Vector3 relativeStartPos
Start position of the ray, relative to the body.
Definition: RayShape.hh:135
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:259
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Base class for all shapes.
Definition: Shape.hh:46
int contactFiducial
Fiducial ID value.
Definition: RayShape.hh:132
double contactLen
Length of the ray.
Definition: RayShape.hh:128
default namespace for gazebo
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:104
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:116
Base class for Ray collision geometry.
Definition: RayShape.hh:40
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
math::Vector3 globalEndPos
End position of the ray in global cs.
Definition: RayShape.hh:143
math::Vector3 relativeEndPos
End position of the ray, relative to the body.
Definition: RayShape.hh:137
math::Vector3 globalStartPos
Start position of the ray in global cs.
Definition: RayShape.hh:140
double contactRetro
Retro reflectance value.
Definition: RayShape.hh:130