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
37namespace 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
110 };
112 }
113}
114#endif
#define MAX_CONTACT_JOINTS
Definition Contact.hh:35
default namespace for gazebo
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
Base class for all collision entities.
Definition Collision.hh:39
A contact between two collisions.
Definition Contact.hh:49
double depths[250]
Array of contact depths.
Definition Contact.hh:100
Collision * collision1
Pointer to the first collision object.
Definition Contact.hh:82
virtual ~Contact()
Destructor.
ignition::math::Vector3d normals[250]
Array of force normals.
Definition Contact.hh:97
void Reset()
Reset to default values.
Contact & operator=(const Contact &_contact)
Operator =.
Collision * collision2
Pointer to the second collision object.
Definition Contact.hh:85
std::string DebugString() const
Produce a debug string.
void FillMsg(msgs::Contact &_msg) const
Populate a msgs::Contact with data from this.
common::Time time
Time at which the contact occurred.
Definition Contact.hh:106
WorldPtr world
World in which the contact occurred.
Definition Contact.hh:109
int count
Length of all the arrays.
Definition Contact.hh:103
ignition::math::Vector3d positions[250]
Array of force positions.
Definition Contact.hh:94
JointWrench wrench[250]
Array of forces for the contact.
Definition Contact.hh:91
Contact(const Contact &_contact)
Copy constructor.
Wrench information from a joint.
Definition JointWrench.hh:41
boost::shared_ptr< World > WorldPtr
Definition PhysicsTypes.hh:89
Forward declarations for the common classes.
Definition Animation.hh:27