Contact.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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: Specification of a contact
18  * Author: Nate Koenig
19  * Date: 10 Nov 2009
20  */
21 
22 #ifndef _CONTACT_HH_
23 #define _CONTACT_HH_
24 
25 #include <vector>
26 #include <string>
27 
28 #include "gazebo/msgs/msgs.hh"
29 
31 #include "gazebo/common/Time.hh"
32 #include "gazebo/math/Vector3.hh"
34 #include "gazebo/util/system.hh"
35 
36 // For the sake of efficiency, use fixed size arrays for collision
37 // MAX_COLLIDE_RETURNS limits contact detection, needs to be large
38 // for proper contact dynamics.
39 // MAX_CONTACT_JOINTS truncates <max_contacts> specified in SDF
40 #define MAX_COLLIDE_RETURNS 250
41 #define MAX_CONTACT_JOINTS 250
42 
43 namespace gazebo
44 {
45  namespace physics
46  {
47  class Collision;
50 
54  class GZ_PHYSICS_VISIBLE Contact
55  {
57  public: Contact();
58 
61  public: Contact(const Contact &_contact);
62 
64  public: virtual ~Contact();
65 
69  public: Contact &operator =(const Contact &_contact);
70 
74  public: Contact &operator =(const msgs::Contact &_contact);
75 
78  public: void FillMsg(msgs::Contact &_msg) const;
79 
82  public: std::string DebugString() const;
83 
85  public: void Reset();
86 
89 
92 
98 
100  public: math::Vector3 positions[MAX_CONTACT_JOINTS];
101 
104 
106  public: double depths[MAX_CONTACT_JOINTS];
107 
109  public: int count;
110 
113 
115  public: WorldPtr world;
116  };
118  }
119 }
120 #endif
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:84
Forward declarations for the common classes.
Definition: Animation.hh:33
Base class for all collision entities.
Definition: Collision.hh:44
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
common::Time time
Time at which the contact occurred.
Definition: Contact.hh:112
A contact between two collisions.
Definition: Contact.hh:54
default namespace for gazebo
int count
Length of all the arrays.
Definition: Contact.hh:109
Collision * collision1
Pointer to the first collision object.
Definition: Contact.hh:88
#define MAX_CONTACT_JOINTS
Definition: Contact.hh:41
Collision * collision2
Pointer to the second collision object.
Definition: Contact.hh:91
Wrench information from a joint.
Definition: JointWrench.hh:39
WorldPtr world
World in which the contact occurred.
Definition: Contact.hh:115
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44