Collision.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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: Collision class
18  * Author: Nate Koenig
19  * Date: 13 Feb 2006
20  */
21 
22 #ifndef _COLLISION_HH_
23 #define _COLLISION_HH_
24 
25 #include <string>
26 #include <vector>
27 
28 #include "gazebo/common/Event.hh"
30 
33 #include "gazebo/physics/Entity.hh"
34 #include "gazebo/util/system.hh"
35 
36 namespace gazebo
37 {
38  namespace physics
39  {
42 
45  {
48  public: explicit Collision(LinkPtr _link);
49 
51  public: virtual ~Collision();
52 
54  public: virtual void Fini();
55 
58  public: virtual void Load(sdf::ElementPtr _sdf);
59 
61  public: virtual void Init();
62 
65  public: virtual void UpdateParameters(sdf::ElementPtr _sdf);
66 
69  public: void SetCollision(bool _placeable);
70 
74  public: bool IsPlaceable() const;
75 
78  public: virtual void SetCategoryBits(unsigned int _bits) = 0;
79 
82  public: virtual void SetCollideBits(unsigned int _bits) = 0;
83 
86  public: void SetLaserRetro(float _retro);
87 
90  public: float GetLaserRetro() const;
91 
94  public: LinkPtr GetLink() const;
95 
98  public: ModelPtr GetModel() const;
99 
102  public: virtual math::Box GetBoundingBox() const = 0;
103 
107  public: unsigned int GetShapeType() const;
108 
113  public: unsigned int GetShapeType()
114  GAZEBO_DEPRECATED(4.0);
115 
118  public: void SetShape(ShapePtr _shape);
119 
122  public: ShapePtr GetShape() const;
123 
126  public: void SetScale(const math::Vector3 &_scale);
127 
130  public: virtual math::Vector3 GetRelativeLinearVel() const;
131 
135  public: virtual math::Vector3 GetWorldLinearVel() const;
136 
139  public: virtual math::Vector3 GetRelativeAngularVel() const;
140 
143  public: virtual math::Vector3 GetWorldAngularVel() const;
144 
147  public: virtual math::Vector3 GetRelativeLinearAccel() const;
148 
152  public: virtual math::Vector3 GetWorldLinearAccel() const;
153 
156  public: virtual math::Vector3 GetRelativeAngularAccel() const;
157 
161  public: virtual math::Vector3 GetWorldAngularAccel() const;
162 
165  public: CollisionState GetState();
166 
169  public: void SetState(const CollisionState &_state);
170 
173  public: void FillMsg(msgs::Collision &_msg);
174 
177  public: void ProcessMsg(const msgs::Collision &_msg);
178 
181  public: inline SurfaceParamsPtr GetSurface() const
182  {return this->surface;}
183 
187  public: virtual void SetMaxContacts(unsigned int _maxContacts);
188 
192  public: virtual unsigned int GetMaxContacts();
193 
197  public: void SetWorldPoseDirty();
198 
199  // Documentation inherited.
200  public: virtual const math::Pose &GetWorldPose() const;
201 
204  private: msgs::Visual CreateCollisionVisual();
205 
207  protected: LinkPtr link;
208 
210  protected: bool placeable;
211 
213  protected: ShapePtr shape;
214 
217 
219  private: float laserRetro;
220 
222  private: CollisionState state;
223 
225  private: unsigned int maxContacts;
226 
228  private: uint32_t collisionVisualId;
229 
231  private: mutable bool worldPoseDirty;
232  };
234  }
235 }
236 #endif
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:82
ShapePtr shape
Pointer to physics::Shape.
Definition: Collision.hh:213
Forward declarations for the common classes.
Definition: Animation.hh:24
Encapsulates a position and rotation in three space.
Definition: Pose.hh:40
Base class for all collision entities.
Definition: Collision.hh:44
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
Mathematical representation of a box and related functions.
Definition: Box.hh:33
boost::shared_ptr< Shape > ShapePtr
Definition: PhysicsTypes.hh:110
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:44
default namespace for gazebo
LinkPtr link
The link this collision belongs to.
Definition: Collision.hh:207
boost::shared_ptr< SurfaceParams > SurfaceParamsPtr
Definition: PhysicsTypes.hh:134
SurfaceParamsPtr surface
The surface parameters.
Definition: Collision.hh:216
Base class for all physics objects in Gazebo.
Definition: Entity.hh:56
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:42
SurfaceParamsPtr GetSurface() const
Get the surface parameters.
Definition: Collision.hh:181
bool placeable
Flag for placeable.
Definition: Collision.hh:210
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:90