All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
35 namespace gazebo
36 {
37  namespace physics
38  {
41 
43  class Collision : public Entity
44  {
47  public: explicit Collision(LinkPtr _link);
48 
50  public: virtual ~Collision();
51 
53  public: virtual void Fini();
54 
57  public: virtual void Load(sdf::ElementPtr _sdf);
58 
60  public: virtual void Init();
61 
64  public: virtual void UpdateParameters(sdf::ElementPtr _sdf);
65 
68  public: void SetCollision(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 math::Box GetBoundingBox() const = 0;
102 
106  public: unsigned int GetShapeType();
107 
110  public: void SetShape(ShapePtr _shape);
111 
114  public: ShapePtr GetShape() const;
115 
118  public: void SetScale(const math::Vector3 &_scale);
119 
123  public: void SetContactsEnabled(bool _enable) GAZEBO_DEPRECATED(2.0);
124 
128  public: bool GetContactsEnabled() const GAZEBO_DEPRECATED(2.0);
129 
134  public: void AddContact(const Contact &_contact) GAZEBO_DEPRECATED(2.0);
135 
138  public: virtual math::Vector3 GetRelativeLinearVel() const;
139 
143  public: virtual math::Vector3 GetWorldLinearVel() const;
144 
147  public: virtual math::Vector3 GetRelativeAngularVel() const;
148 
151  public: virtual math::Vector3 GetWorldAngularVel() const;
152 
155  public: virtual math::Vector3 GetRelativeLinearAccel() const;
156 
160  public: virtual math::Vector3 GetWorldLinearAccel() const;
161 
164  public: virtual math::Vector3 GetRelativeAngularAccel() const;
165 
169  public: virtual math::Vector3 GetWorldAngularAccel() const;
170 
173  public: CollisionState GetState();
174 
177  public: void SetState(const CollisionState &_state);
178 
181  public: void FillMsg(msgs::Collision &_msg);
182 
185  public: void ProcessMsg(const msgs::Collision &_msg);
186 
189  public: inline SurfaceParamsPtr GetSurface() const
190  {return this->surface;}
191 
195  public: virtual void SetMaxContacts(double _maxContacts);
196 
200  public: virtual int GetMaxContacts();
201 
204  private: msgs::Visual CreateCollisionVisual();
205 
207  protected: LinkPtr link;
208 
210  protected: bool placeable;
211 
213  protected: ShapePtr shape;
214 
216  private: SurfaceParamsPtr surface;
217 
219  private: float laserRetro;
220 
222  private: CollisionState state;
223 
225  private: int maxContacts;
226 
228  private: uint32_t collisionVisualId;
229  };
231  }
232 }
233 #endif