Collision.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_COLLISION_HH_
18 #define GAZEBO_PHYSICS_COLLISION_HH_
19 
20 #include <string>
21 #include <vector>
22 
23 #include "gazebo/common/Event.hh"
24 
27 #include "gazebo/physics/Entity.hh"
28 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
32  namespace physics
33  {
36 
38  class GZ_PHYSICS_VISIBLE Collision : public Entity
39  {
42  public: explicit Collision(LinkPtr _link);
43 
45  public: virtual ~Collision();
46 
48  public: virtual void Fini();
49 
52  public: virtual void Load(sdf::ElementPtr _sdf);
53 
55  public: virtual void Init();
56 
59  public: virtual void UpdateParameters(sdf::ElementPtr _sdf);
60 
64  public: void SetCollision(bool _placeable);
65 
68  public: void SetPlaceable(const bool _placeable);
69 
73  public: bool IsPlaceable() const;
74 
77  public: virtual void SetCategoryBits(unsigned int _bits) = 0;
78 
81  public: virtual void SetCollideBits(unsigned int _bits) = 0;
82 
85  public: void SetLaserRetro(float _retro);
86 
89  public: float GetLaserRetro() const;
90 
93  public: LinkPtr GetLink() const;
94 
97  public: ModelPtr GetModel() const;
98 
101  public: virtual ignition::math::Box BoundingBox() const = 0;
102 
106  public: unsigned int GetShapeType() const;
107 
110  public: void SetShape(ShapePtr _shape);
111 
114  public: ShapePtr GetShape() const;
115 
119  public: void SetScale(const math::Vector3 &_scale) GAZEBO_DEPRECATED(8.0);
120 
123  public: void SetScale(const ignition::math::Vector3d &_scale);
124 
128  public: virtual math::Vector3 GetRelativeLinearVel() const
129  GAZEBO_DEPRECATED(8.0);
130 
133  public: virtual ignition::math::Vector3d RelativeLinearVel() const;
134 
139  public: virtual math::Vector3 GetWorldLinearVel() const
140  GAZEBO_DEPRECATED(8.0);
141 
145  public: virtual ignition::math::Vector3d WorldLinearVel() const;
146 
150  public: virtual math::Vector3 GetRelativeAngularVel() const
151  GAZEBO_DEPRECATED(8.0);
152 
155  public: virtual ignition::math::Vector3d RelativeAngularVel() const;
156 
160  public: virtual math::Vector3 GetWorldAngularVel() const
161  GAZEBO_DEPRECATED(8.0);
162 
165  public: virtual ignition::math::Vector3d WorldAngularVel() const;
166 
170  public: virtual math::Vector3 GetRelativeLinearAccel() const
171  GAZEBO_DEPRECATED(8.0);
172 
175  public: virtual ignition::math::Vector3d RelativeLinearAccel() const;
176 
181  public: virtual math::Vector3 GetWorldLinearAccel() const
182  GAZEBO_DEPRECATED(8.0);
183 
187  public: virtual ignition::math::Vector3d WorldLinearAccel() const;
188 
192  public: virtual math::Vector3 GetRelativeAngularAccel() const
193  GAZEBO_DEPRECATED(8.0);
194 
197  public: virtual ignition::math::Vector3d RelativeAngularAccel() const;
198 
203  public: virtual math::Vector3 GetWorldAngularAccel() const
204  GAZEBO_DEPRECATED(8.0);
205 
209  public: virtual ignition::math::Vector3d WorldAngularAccel() const;
210 
213  public: CollisionState GetState();
214 
217  public: void SetState(const CollisionState &_state);
218 
221  public: void FillMsg(msgs::Collision &_msg);
222 
225  public: void ProcessMsg(const msgs::Collision &_msg);
226 
229  public: inline SurfaceParamsPtr GetSurface() const
230  {return this->surface;}
231 
235  public: virtual void SetMaxContacts(unsigned int _maxContacts);
236 
240  public: virtual unsigned int GetMaxContacts();
241 
245  public: void SetWorldPoseDirty();
246 
247  // Documentation inherited.
249  public: virtual const math::Pose GetWorldPose() const
250  GAZEBO_DEPRECATED(8.0);
251 
252  // Documentation inherited.
253  public: virtual const ignition::math::Pose3d &WorldPose() const;
254 
257  private: msgs::Visual CreateCollisionVisual();
258 
260  protected: LinkPtr link;
261 
263  protected: bool placeable;
264 
266  protected: ShapePtr shape;
267 
269  protected: SurfaceParamsPtr surface;
270 
272  private: float laserRetro;
273 
275  private: CollisionState state;
276 
278  private: unsigned int maxContacts;
279 
281  private: uint32_t collisionVisualId;
282 
284  private: mutable bool worldPoseDirty;
285  };
287  }
288 }
289 #endif
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
Encapsulates a position and rotation in three space.
Definition: Pose.hh:42
Base class for all collision entities.
Definition: Collision.hh:38
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
default namespace for gazebo
boost::shared_ptr< SurfaceParams > SurfaceParamsPtr
Definition: PhysicsTypes.hh:169
SurfaceParamsPtr GetSurface() const
Get the surface parameters.
Definition: Collision.hh:229
Base class for all physics objects in Gazebo.
Definition: Entity.hh:56
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:302
boost::shared_ptr< Shape > ShapePtr
Definition: PhysicsTypes.hh:141
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
Store state information of a physics::Collision object.
Definition: CollisionState.hh:44