Contact.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 #ifndef GAZEBO_PHYSICS_CONTACT_HH_
18 #define GAZEBO_PHYSICS_CONTACT_HH_
19 
20 #include <vector>
21 #include <string>
22 #include <ignition/math/Vector3.hh>
23 
24 #include "gazebo/common/Time.hh"
25 #include "gazebo/msgs/msgs.hh"
28 #include "gazebo/util/system.hh"
29 
30 // For the sake of efficiency, use fixed size arrays for collision
31 // MAX_COLLIDE_RETURNS limits contact detection, needs to be large
32 // for proper contact dynamics.
33 // MAX_CONTACT_JOINTS truncates <max_contacts> specified in SDF
34 #define MAX_COLLIDE_RETURNS 250
35 #define MAX_CONTACT_JOINTS 250
36 
37 namespace gazebo
38 {
39  namespace physics
40  {
41  class Collision;
44 
48  class GZ_PHYSICS_VISIBLE Contact
49  {
51  public: Contact();
52 
55  public: Contact(const Contact &_contact);
56 
58  public: virtual ~Contact();
59 
63  public: Contact &operator =(const Contact &_contact);
64 
68  public: Contact &operator =(const msgs::Contact &_contact);
69 
72  public: void FillMsg(msgs::Contact &_msg) const;
73 
76  public: std::string DebugString() const;
77 
79  public: void Reset();
80 
83 
86 
92 
94  public: ignition::math::Vector3d positions[MAX_CONTACT_JOINTS];
95 
97  public: ignition::math::Vector3d normals[MAX_CONTACT_JOINTS];
98 
100  public: double depths[MAX_CONTACT_JOINTS];
101 
103  public: int count;
104 
107 
109  public: WorldPtr world;
110  };
112  }
113 }
114 #endif
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
Base class for all collision entities.
Definition: Collision.hh:38
common::Time time
Time at which the contact occurred.
Definition: Contact.hh:106
A contact between two collisions.
Definition: Contact.hh:48
default namespace for gazebo
int count
Length of all the arrays.
Definition: Contact.hh:103
Collision * collision1
Pointer to the first collision object.
Definition: Contact.hh:82
#define MAX_CONTACT_JOINTS
Definition: Contact.hh:35
Collision * collision2
Pointer to the second collision object.
Definition: Contact.hh:85
Wrench information from a joint.
Definition: JointWrench.hh:40
WorldPtr world
World in which the contact occurred.
Definition: Contact.hh:109
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44