All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
gazebo::physics::ContactManager Class Reference

Aggregates all the contact information generated by the collision detection engine. More...

#include <physics/physics.hh>

Public Member Functions

 ContactManager ()
 Constructor. More...
 
virtual ~ContactManager ()
 Destructor. More...
 
void Clear ()
 Clear all stored contacts. More...
 
std::string CreateFilter (const std::string &_topic, const std::vector< std::string > &_collisions)
 Create a filter for contacts. More...
 
std::string CreateFilter (const std::string &_topic, const std::string &_collision)
 Create a filter for contacts. More...
 
std::string CreateFilter (const std::string &_name, const std::map< std::string, physics::CollisionPtr > &_collisions)
 Create a filter for contacts. More...
 
ContactGetContact (unsigned int _index) const
 Get a single contact by index. More...
 
unsigned int GetContactCount () const
 Return the number of valid contacts. More...
 
const std::vector< Contact * > & GetContacts () const
 Get all the contacts. More...
 
void Init (WorldPtr _world)
 Initialize the ContactManager. More...
 
ContactNewContact (Collision *_collision1, Collision *_collision2, const common::Time &_time)
 Add a new contact. More...
 
void PublishContacts ()
 Publish all contacts in a msgs::Contacts message. More...
 
void ResetCount ()
 Set the contact count to zero. More...
 

Detailed Description

Aggregates all the contact information generated by the collision detection engine.

Constructor & Destructor Documentation

gazebo::physics::ContactManager::ContactManager ( )

Constructor.

virtual gazebo::physics::ContactManager::~ContactManager ( )
virtual

Destructor.

Member Function Documentation

void gazebo::physics::ContactManager::Clear ( )

Clear all stored contacts.

std::string gazebo::physics::ContactManager::CreateFilter ( const std::string &  _topic,
const std::vector< std::string > &  _collisions 
)

Create a filter for contacts.

A new publisher will be created that publishes contacts associated to the input collisions. param[in] _name Filter name. param[in] _collisions A list of collision names used for filtering.

Returns
New topic where filtered messages will be published to.
std::string gazebo::physics::ContactManager::CreateFilter ( const std::string &  _topic,
const std::string &  _collision 
)

Create a filter for contacts.

A new publisher will be created that publishes contacts associated to the input collision. param[in] _name Filter name. param[in] _collision A collision name used for filtering.

Returns
New topic where filtered messages will be published to.
std::string gazebo::physics::ContactManager::CreateFilter ( const std::string &  _name,
const std::map< std::string, physics::CollisionPtr > &  _collisions 
)

Create a filter for contacts.

A new publisher will be created that publishes contacts associated to the input collision. param[in] _name Filter name. param[in] _collisions A map of collision name to collision object.

Returns
New topic where filtered messages will be published to.
Contact* gazebo::physics::ContactManager::GetContact ( unsigned int  _index) const

Get a single contact by index.

The index must be between 0 and ContactManager::GetContactCount.

Parameters
[in]_indexIndex of the Contact to return.
Returns
Pointer to a contact, NULL If index is invalid.
unsigned int gazebo::physics::ContactManager::GetContactCount ( ) const

Return the number of valid contacts.

const std::vector<Contact *>& gazebo::physics::ContactManager::GetContacts ( ) const

Get all the contacts.

The return vector may have invalid contacts. Only use contents of the vector between 0 and ContactManager::GetContactCount

Returns
Vector of contact pointers.
void gazebo::physics::ContactManager::Init ( WorldPtr  _world)

Initialize the ContactManager.

This is required in order to publish contact messages via the ContactManager::PublishContacts method.

Parameters
[in]_worldPointer to the world that is initializing the contact manager.
Contact* gazebo::physics::ContactManager::NewContact ( Collision _collision1,
Collision _collision2,
const common::Time _time 
)

Add a new contact.

Noramlly this is only used by a Physics/Collision engine when a new contact is generated. All other users should just make use of the accessor functions.

If no one is listening, then the return value will be NULL. This is a signal to the Physics engine that it can skip the extra processing necessary to get back contact information.

Returns
The new contact. The physics engine should populate the contact's parameters. NULL will be returned if there are no subscribers to the contact topic.
void gazebo::physics::ContactManager::PublishContacts ( )

Publish all contacts in a msgs::Contacts message.

void gazebo::physics::ContactManager::ResetCount ( )

Set the contact count to zero.


The documentation for this class was generated from the following file: