Gazebo Sim

API Reference

10.1.1
TouchPlugin Class Reference

Plugin which publishes a message if the model it is attached to has touched one or more specified targets continuously during a given time. More...

#include <TouchPlugin.hh>

Public Member Functions

 TouchPlugin ()
 Constructor.
 
 ~TouchPlugin () override=default
 Destructor.
 
void Configure (const Entity &_entity, const std::shared_ptr< const sdf::Element > &_sdf, EntityComponentManager &_ecm, EventManager &_eventMgr) override
 Configure the system.
 
void PostUpdate (const UpdateInfo &_info, const EntityComponentManager &_ecm) override
 
void PreUpdate (const UpdateInfo &_info, EntityComponentManager &_ecm) final
 Documentation inherited.
 
void Reset (const UpdateInfo &_info, EntityComponentManager &_ecm) final
 
- Public Member Functions inherited from System
 System ()=default
 Constructor.
 
virtual ~System ()=default
 Destructor.
 
- Public Member Functions inherited from ISystemConfigure
virtual ~ISystemConfigure ()=default
 
- Public Member Functions inherited from ISystemPreUpdate
virtual ~ISystemPreUpdate ()=default
 
- Public Member Functions inherited from ISystemPostUpdate
virtual ~ISystemPostUpdate ()=default
 
- Public Member Functions inherited from ISystemReset
virtual ~ISystemReset ()=default
 

Additional Inherited Members

- Public Types inherited from System
using PriorityType = int32_t
 Signed integer type used for specifying priority of the execution order of PreUpdate and Update phases.
 
- Static Public Attributes inherited from System
static constexpr PriorityType kDefaultPriority = {0}
 Default priority value for execution order of the PreUpdate and Update phases.
 
static constexpr std::string_view kPriorityElementName
 Name of the XML element from which the priority value will be parsed.
 

Detailed Description

Plugin which publishes a message if the model it is attached to has touched one or more specified targets continuously during a given time.

After publishing, the plugin is disabled. It can be re-enabled through a Gazebo Transport service call.

The plugin requires that a contact sensors is placed in at least one link on the model on which this plugin is attached.

System Parameters

  • <target> Name, or substring of a name, that identifies the target collision entity/entities. This value is searched in the scoped name of all collision entities, so it can possibly match more than one collision. For example, using the name of a model will match all of its collisions (scoped name /model_name/link_name/collision_name).
  • <collision> Optional parameter. Multiple <collision> elements are allowed. If specified, a touch event will only be emitted if contact occurs with the specified contact sensor collision in the model that the touch plugin is attached to. If no <collision> elements are specified, all contact sensor collisions are used.
  • <create_contact_sensor_for_collision> Optional parameter. If true, automatically create a contact sensor for the collision if the sensor does not exist already. This allows the TouchPlugin system to be used without explicitly defining contact sensors inside links in SDF. Default to false.
  • <time> Target time in seconds to maintain contact.
  • <namespace> Namespace for transport topics/services:
    • /<namespace>/enable : Service used to enable and disable the plugin.
    • /<namespace>/touched : Topic where a message is published once the touch event occurs.
  • <enabled> Set this to true so the plugin works from the start and doesn't need to be enabled.

Constructor & Destructor Documentation

◆ TouchPlugin()

Constructor.

◆ ~TouchPlugin()

~TouchPlugin ( )
overridedefault

Destructor.

Member Function Documentation

◆ Configure()

void Configure ( const Entity _entity,
const std::shared_ptr< const sdf::Element > &  _sdf,
EntityComponentManager _ecm,
EventManager _eventMgr 
)
overridevirtual

Configure the system.

Parameters
[in]_entityThe entity this plugin is attached to.
[in]_sdfThe SDF Element associated with this system plugin.
[in]_ecmThe EntityComponentManager of the given simulation instance.
[in]_eventMgrThe EventManager of the given simulation instance.

Implements ISystemConfigure.

◆ PostUpdate()

void PostUpdate ( const UpdateInfo _info,
const EntityComponentManager _ecm 
)
overridevirtual

Implements ISystemPostUpdate.

◆ PreUpdate()

void PreUpdate ( const UpdateInfo _info,
EntityComponentManager _ecm 
)
finalvirtual

Documentation inherited.

Implements ISystemPreUpdate.

◆ Reset()

void Reset ( const UpdateInfo _info,
EntityComponentManager _ecm 
)
finalvirtual

Implements ISystemReset.


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