Drake
CollisionFilterGroupManager< T > Class Template Reference

This class provides management utilities for the definition of collision filter groups for RigidBodyTree instances. More...

#include <multibody/collision/collision_filter.h>

Collaboration diagram for CollisionFilterGroupManager< T >:
[legend]

Public Member Functions

 CollisionFilterGroupManager ()
 Default constructor. More...
 
void CompileGroups ()
 Based on the current specification, builds the appropriate collision filter bitmasks and assigns them to the previously provided rigid bodies. More...
 
void DefineCollisionFilterGroup (const std::string &name)
 Attempts to define a new collision filter group. More...
 
bool AddCollisionFilterGroupMember (const std::string &group_name, const RigidBody< T > &body)
 Adds a RigidBody to a collision filter group. More...
 
void AddCollisionFilterIgnoreTarget (const std::string &group_name, const std::string &target_group_name)
 Adds a collision group to the set of groups ignored by the specified collision filter group. More...
 
int GetGroupId (const std::string &group_name)
 Reports the collision filter group assigned to the given group name. More...
 
const bitmaskget_group_mask (const RigidBody< T > &body)
 Returns the group membership bitmask for the given body. More...
 
const bitmaskget_ignore_mask (const RigidBody< T > &body)
 Returns the ignored group bitmask for the given body. More...
 
void SetBodyCollisionFilters (const RigidBody< T > &body, const bitmask &group, const bitmask &ignores)
 Directly set the masks for a body. More...
 
void Clear ()
 Clears the cached collision filter group specification data from the current session. More...
 
Does not allow copy, move, or assignment
 CollisionFilterGroupManager (const CollisionFilterGroupManager &)=delete
 
CollisionFilterGroupManageroperator= (const CollisionFilterGroupManager &)=delete
 
 CollisionFilterGroupManager (CollisionFilterGroupManager &&)=delete
 
CollisionFilterGroupManageroperator= (CollisionFilterGroupManager &&)=delete
 

Static Public Attributes

static const int kInvalidGroupId = -1
 Reported value for group names that do not map to known collision filter groups. More...
 

Detailed Description

template<typename T>
class drake::multibody::collision::CollisionFilterGroupManager< T >

This class provides management utilities for the definition of collision filter groups for RigidBodyTree instances.

The intent of the manager is to serve as an accumulator during the parsing process. It serves as an intermediate representation of the collision filter group semantics. A unique instance should be owned by each RigidBodyTree instance.

The manager is used in parsing sessions. By design, one session maps to parsing a single file. The session ends with a call to Clear() (called in RigidBodyTree::compile()). Multiple sessions can be run on a single manager (this naturally arises from parsing multiple files). Collision filter groups defined during a single session must all have unique group names. Names repeated in different sessions are treated as being different collision filter groups. The names of the groups are only maintained during parsing. During compilation, the names are replaced with integer identifiers.

The group manager can handle a finite number of groups (kMaxNumCollisionFilterGroups). Each session contributes towards reaching that total. If the maximum number of groups has been defined, subsequent efforts to define a new collision filter group will cause exceptions to be thrown.

There are several implications of this design:

  • Collision filter groups have a scope limited to a single URDF file. That means a collision filter group cannot be configured between bodies defined in different URDF files.
  • Even if the same file is parsed multiple times, leading to collision filter groups with identical names in each session, the groups will be considered different. Bodies from one parsing of the file will not be in groups visible to another parsing.
  • A user cannot change the collision filter groups a body belongs to or which groups it ignores outside of the URDF specification.
Template Parameters
TA valid Eigen scalar type.

Constructor & Destructor Documentation

Default constructor.

Member Function Documentation

bool AddCollisionFilterGroupMember ( const std::string &  group_name,
const RigidBody< T > &  body 
)

Adds a RigidBody to a collision filter group.

The process will fail if the group cannot be found.

Parameters
group_nameThe name of the collision filter group to add the body to.
bodyThe body to add.
Returns
False if the group could not be found.

Here is the call graph for this function:

void AddCollisionFilterIgnoreTarget ( const std::string &  group_name,
const std::string &  target_group_name 
)

Adds a collision group to the set of groups ignored by the specified collision filter group.

Will fail if the specified specified group name does not refer to an existing collision filter group. (Although, the target group name need not exist at this time.) An exception is thrown upon failure.

Parameters
group_nameThe name of the group to modify.
target_group_nameThe name of the group to ignore.
void Clear ( )

Clears the cached collision filter group specification data from the current session.

It does not reset the counter for available collision filter groups. This is what makes it possible for a file to be read multiple times in sequence, but to have each parsing produce a unique set of collision filter groups. Or if two files are parsed, and both use a common name for a collision filter group. They are treated as unique collision filter groups and all of those groups count against the total number of groups supported by a single instance of the manager.

Here is the call graph for this function:

void CompileGroups ( )

Based on the current specification, builds the appropriate collision filter bitmasks and assigns them to the previously provided rigid bodies.

Here is the call graph for this function:

void DefineCollisionFilterGroup ( const std::string &  name)

Attempts to define a new collision filter group.

The given name must be unique in this session. Duplicate names or attempting to add more collision filter groups than the system can handle will lead to failure. In the event of failure, an exception is thrown.

Parameters
nameThe unique name of the new group.
const bitmask & get_group_mask ( const RigidBody< T > &  body)

Returns the group membership bitmask for the given body.

If there is no information for this body, the zero bitmask will be returned. This should only be called after CompileGroups.

Here is the call graph for this function:

const bitmask & get_ignore_mask ( const RigidBody< T > &  body)

Returns the ignored group bitmask for the given body.

If there is no information for this body, the zero bitmask will be returned. This should only be called after CompileGroups.

Here is the call graph for this function:

int GetGroupId ( const std::string &  group_name)

Reports the collision filter group assigned to the given group name.

Parameters
group_nameThe group name to query.
Returns
the assigned group id (kInvalidGroupId if an valid group name).
CollisionFilterGroupManager& operator= ( const CollisionFilterGroupManager< T > &  )
delete
void SetBodyCollisionFilters ( const RigidBody< T > &  body,
const bitmask group,
const bitmask ignores 
)

Directly set the masks for a body.

The values will remain in the current session (i.e., until Clear() is called). This is a convenience function for Matlab integration. The Matlab parser handles the mapping of collision filter group names to ids and passes the mapped ids directly the manager for when the tree gets compiled. The input bitmasks are in no way validated. Bitmasks initialized in this manner are not guaranteed to include membership in the DEFAULT_GROUP.

Member Data Documentation

const int kInvalidGroupId = -1
static

Reported value for group names that do not map to known collision filter groups.


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