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 
52  public: virtual void SetPoints(const ignition::math::Vector3d &_posStart,
53  const ignition::math::Vector3d &_posEnd);
54 
57  public: ignition::math::Vector3d Start() const;
58 
61  public: ignition::math::Vector3d End() const;
62 
66  public: virtual void RelativePoints(ignition::math::Vector3d &_posA,
67  ignition::math::Vector3d &_posB);
68 
72  public: virtual void GlobalPoints(ignition::math::Vector3d &_posA,
73  ignition::math::Vector3d &_posB);
74 
77  public: virtual void SetLength(double _len);
78 
81  public: double GetLength() const;
82 
84  public: virtual void SetScale(const ignition::math::Vector3d &_scale);
85 
87  public: virtual void Update() = 0;
88 
92  public: virtual void GetIntersection(double &_dist,
93  std::string &_entity) = 0;
94 
97  public: void SetRetro(float _retro);
98 
101  public: std::string CollisionName() const;
102 
105  public: float GetRetro() const;
106 
109  public: void SetFiducial(int _fid);
110 
113  public: int GetFiducial() const;
114 
116  public: virtual void Init();
117 
121  public: void FillMsg(msgs::Geometry &_msg);
122 
126  public: virtual void ProcessMsg(const msgs::Geometry &_msg);
127 
129  public: virtual double ComputeVolume() const;
130 
136  protected: void SetCollisionName(const std::string &_name);
137 
138  // Contact information; this is filled out during collision
139  // detection.
141  protected: double contactLen;
142 
144  protected: double contactRetro;
145 
147  protected: int contactFiducial;
148 
150  protected: ignition::math::Vector3d relativeStartPos;
151 
153  protected: ignition::math::Vector3d relativeEndPos;
154 
156  protected: ignition::math::Vector3d globalStartPos;
157 
159  protected: ignition::math::Vector3d globalEndPos;
160 
162  private: std::string collisionName;
163 
166  protected: friend class ODEMultiRayShape;
167  };
169  }
170 }
171 #endif
double contactRetro
Retro reflectance value.
Definition: RayShape.hh:144
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:150
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:153
ignition::math::Vector3d globalStartPos
Start position of the ray in global cs.
Definition: RayShape.hh:156
int contactFiducial
Fiducial ID value.
Definition: RayShape.hh:147
Base class for Ray collision geometry.
Definition: RayShape.hh:35
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
double contactLen
Length of the ray.
Definition: RayShape.hh:141
ignition::math::Vector3d globalEndPos
End position of the ray in global cs.
Definition: RayShape.hh:159
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
ODE specific version of MultiRayShape.
Definition: ODEMultiRayShape.hh:31