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 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 /* 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 
122  public: void SetContactsEnabled(bool _enable) GAZEBO_DEPRECATED(1.10);
123 
126  public: bool GetContactsEnabled() const GAZEBO_DEPRECATED(1.10);
127 
131  public: void AddContact(const Contact &_contact) GAZEBO_DEPRECATED(1.10);
132 
135  public: virtual math::Vector3 GetRelativeLinearVel() const;
136 
140  public: virtual math::Vector3 GetWorldLinearVel() const;
141 
144  public: virtual math::Vector3 GetRelativeAngularVel() const;
145 
148  public: virtual math::Vector3 GetWorldAngularVel() const;
149 
152  public: virtual math::Vector3 GetRelativeLinearAccel() const;
153 
157  public: virtual math::Vector3 GetWorldLinearAccel() const;
158 
161  public: virtual math::Vector3 GetRelativeAngularAccel() const;
162 
166  public: virtual math::Vector3 GetWorldAngularAccel() const;
167 
170  public: CollisionState GetState();
171 
174  public: void SetState(const CollisionState &_state);
175 
178  public: void FillMsg(msgs::Collision &_msg);
179 
182  public: void ProcessMsg(const msgs::Collision &_msg);
183 
186  public: inline SurfaceParamsPtr GetSurface() const
187  {return this->surface;}
188 
192  public: virtual void SetMaxContacts(double _maxContacts);
193 
197  public: virtual int GetMaxContacts();
198 
201  private: msgs::Visual CreateCollisionVisual();
202 
204  protected: LinkPtr link;
205 
207  protected: bool placeable;
208 
210  protected: ShapePtr shape;
211 
213  private: SurfaceParamsPtr surface;
214 
216  private: float laserRetro;
217 
219  private: CollisionState state;
220 
222  private: int maxContacts;
223 
225  private: uint32_t collisionVisualId;
226  };
228  }
229 }
230 #endif