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 #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();
108 
111  public: void SetShape(ShapePtr _shape);
112 
115  public: ShapePtr GetShape() const;
116 
119  public: void SetScale(const math::Vector3 &_scale);
120 
124  public: void SetContactsEnabled(bool _enable) GAZEBO_DEPRECATED(2.0);
125 
129  public: bool GetContactsEnabled() const GAZEBO_DEPRECATED(2.0);
130 
135  public: void AddContact(const Contact &_contact) GAZEBO_DEPRECATED(2.0);
136 
139  public: virtual math::Vector3 GetRelativeLinearVel() const;
140 
144  public: virtual math::Vector3 GetWorldLinearVel() const;
145 
148  public: virtual math::Vector3 GetRelativeAngularVel() const;
149 
152  public: virtual math::Vector3 GetWorldAngularVel() const;
153 
156  public: virtual math::Vector3 GetRelativeLinearAccel() const;
157 
161  public: virtual math::Vector3 GetWorldLinearAccel() const;
162 
165  public: virtual math::Vector3 GetRelativeAngularAccel() const;
166 
170  public: virtual math::Vector3 GetWorldAngularAccel() const;
171 
174  public: CollisionState GetState();
175 
178  public: void SetState(const CollisionState &_state);
179 
182  public: void FillMsg(msgs::Collision &_msg);
183 
186  public: void ProcessMsg(const msgs::Collision &_msg);
187 
190  public: inline SurfaceParamsPtr GetSurface() const
191  {return this->surface;}
192 
196  public: virtual void SetMaxContacts(unsigned int _maxContacts);
197 
201  public: virtual unsigned int GetMaxContacts();
202 
205  private: msgs::Visual CreateCollisionVisual();
206 
208  protected: LinkPtr link;
209 
211  protected: bool placeable;
212 
214  protected: ShapePtr shape;
215 
218 
220  private: float laserRetro;
221 
223  private: CollisionState state;
224 
226  private: unsigned int maxContacts;
227 
229  private: uint32_t collisionVisualId;
230  };
232  }
233 }
234 #endif