##

Contact.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PHYSICS_CONTACT_HH_
#define GAZEBO_PHYSICS_CONTACT_HH_
#include <vector>
#include <string>
#include <ignition/math/Vector3.hh>
#include "gazebo/common/Time.hh"
#include "gazebo/msgs/msgs.hh"
#include "gazebo/physics/JointWrench.hh"
#include "gazebo/physics/PhysicsTypes.hh"
#include "gazebo/util/system.hh"
// For the sake of efficiency, use fixed size arrays for collision
// MAX_COLLIDE_RETURNS limits contact detection, needs to be large
// for proper contact dynamics.
// MAX_CONTACT_JOINTS truncates <max_contacts> specified in SDF
#define MAX_COLLIDE_RETURNS 250
#define MAX_CONTACT_JOINTS 250
namespace gazebo
{
namespace physics
{
class Collision;
class GZ_PHYSICS_VISIBLE Contact
{
public: Contact();
public: Contact(const Contact &_contact);
public: virtual ~Contact();
public: Contact &operator =(const Contact &_contact);
public: Contact &operator =(const msgs::Contact &_contact);
public: void FillMsg(msgs::Contact &_msg) const;
public: std::string DebugString() const;
public: void Reset();
public: Collision *collision1;
public: Collision *collision2;
public: JointWrench wrench[MAX_CONTACT_JOINTS];
public: ignition::math::Vector3d positions[MAX_CONTACT_JOINTS];
public: ignition::math::Vector3d normals[MAX_CONTACT_JOINTS];
public: double depths[MAX_CONTACT_JOINTS];
public: int count;
public: common::Time time;
public: WorldPtr world;
};
}
}
#endif
Time.hh
gazebo::physics::Contact
A contact between two collisions. Each contact can consist of a number of contact points.
Definition: Contact.hh:48
gazebo::physics::Collision
Base class for all collision entities.
Definition: Collision.hh:38
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
gazebo::physics::Contact::wrench
JointWrench wrench[250]
Array of forces for the contact.
Definition: Contact.hh:91
gazebo::physics::Contact::normals
ignition::math::Vector3d normals[250]
Array of force normals.
Definition: Contact.hh:97
system.hh
gazebo::physics::Contact::depths
double depths[250]
Array of contact depths.
Definition: Contact.hh:100
msgs.hh
gazebo::physics::Contact::FillMsg
void FillMsg(msgs::Contact &_msg) const
Populate a msgs::Contact with data from this.
gazebo::physics::Contact::collision2
Collision * collision2
Pointer to the second collision object.
Definition: Contact.hh:85
PhysicsTypes.hh
default namespace for gazebo
gazebo::physics::Contact::world
WorldPtr world
World in which the contact occurred.
Definition: Contact.hh:109
gazebo::physics::Contact::positions
ignition::math::Vector3d positions[250]
Array of force positions.
Definition: Contact.hh:94
gazebo::physics::Contact::Reset
void Reset()
Reset to default values.
gazebo::physics::Contact::time
common::Time time
Time at which the contact occurred.
Definition: Contact.hh:106
gazebo::physics::Contact::DebugString
std::string DebugString() const
Produce a debug string.
gazebo::physics::Contact::operator=
Contact & operator=(const Contact &_contact)
Operator =.
JointWrench.hh
MAX_CONTACT_JOINTS
#define MAX_CONTACT_JOINTS
Definition: Contact.hh:35
gazebo::physics::Contact::Contact
Contact()
Constructor.
gazebo::physics::WorldPtr
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
gazebo::physics::JointWrench
Wrench information from a joint. These are forces and torques on parent and child Links,...
Definition: JointWrench.hh:40
gazebo::physics::Contact::count
int count
Length of all the arrays.
Definition: Contact.hh:103
gazebo::physics::Contact::~Contact
virtual ~Contact()
Destructor.
gazebo::physics::Contact::collision1
Collision * collision1
Pointer to the first collision object.
Definition: Contact.hh:82