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
24#include "gazebo/util/system.hh"
25
26namespace 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 };
168
169 }
170}
171#endif
default namespace for gazebo
void SetFiducial(int _fid)
Set the fiducial id detected by this ray.
ignition::math::Vector3d End() const
Get the end point.
ignition::math::Vector3d relativeStartPos
Start position of the ray, relative to the body.
Definition RayShape.hh:150
virtual void SetScale(const ignition::math::Vector3d &_scale)
Set the scale of the ray.
virtual void GetIntersection(double &_dist, std::string &_entity)=0
Get the nearest intersection.
ignition::math::Vector3d relativeEndPos
End position of the ray, relative to the body.
Definition RayShape.hh:153
float GetRetro() const
Get the retro-reflectivness detected by this ray.
virtual void Update()=0
Update the ray collision.
int contactFiducial
Fiducial ID value.
Definition RayShape.hh:147
virtual double ComputeVolume() const
Documentation inherited.
void SetCollisionName(const std::string &_name)
Set the name of the object this ray has collided with.
virtual void Init()
In the ray.
friend class ODEMultiRayShape
ODEMultiRayShape needs to call SetCollisionName when it is updated.
Definition RayShape.hh:166
virtual void GlobalPoints(ignition::math::Vector3d &_posA, ignition::math::Vector3d &_posB)
Get the global starting and ending points.
ignition::math::Vector3d globalEndPos
End position of the ray in global cs.
Definition RayShape.hh:159
ignition::math::Vector3d Start() const
Get the start point.
RayShape(PhysicsEnginePtr _physicsEngine)
Constructor for a global ray.
std::string CollisionName() const
Get the name of the object this ray collided with.
double contactRetro
Retro reflectance value.
Definition RayShape.hh:144
virtual ~RayShape()
Destructor.
double contactLen
Length of the ray.
Definition RayShape.hh:141
RayShape(CollisionPtr _parent)
Constructor.
virtual void SetLength(double _len)
Set the length of the ray.
double GetLength() const
Get the length of the ray.
virtual void SetPoints(const ignition::math::Vector3d &_posStart, const ignition::math::Vector3d &_posEnd)
Set the ray based on starting and ending points relative to the body.
int GetFiducial() const
Get the fiducial id detected by this ray.
virtual void RelativePoints(ignition::math::Vector3d &_posA, ignition::math::Vector3d &_posB)
Get the relative starting and ending points.
void SetRetro(float _retro)
Set the retro-reflectivness detected by this ray.
virtual void ProcessMsg(const msgs::Geometry &_msg)
Update this shape from a message.
void FillMsg(msgs::Geometry &_msg)
Fill a message with data from this object.
ignition::math::Vector3d globalStartPos
Start position of the ray in global cs.
Definition RayShape.hh:156
Shape(CollisionPtr _parent)
Constructor.
namespace for physics
Definition Actor.hh:41
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition PhysicsTypes.hh:125
boost::shared_ptr< Collision > CollisionPtr
Definition PhysicsTypes.hh:113
Forward declarations for the common classes.
Definition Animation.hh:27