Drake
QueryObject< T > Class Template Reference

The QueryObject serves as a mechanism to perform geometry queries on the world's geometry. More...

#include <drake/geometry/query_object.h>

Public Member Functions

 QueryObject (const QueryObject &other)
 
QueryObjectoperator= (const QueryObject &)
 
State queries
const std::string & GetSourceName (SourceId id) const
 Reports the name for the given source id. More...
 
FrameId GetFrameId (GeometryId geometry_id) const
 Reports the id of the frame to which the given geometry id is registered. More...
 
Collision Queries

These queries detect collisions between geometry.

Two geometries collide if they overlap each other and are not explicitly excluded through collision filtering. These algorithms find those colliding cases, characterize them, and report the essential characteristics of that collision.

std::vector< PenetrationAsPointPair< double > > ComputePointPairPenetration () const
 Computes the penetrations across all pairs of geometries in the world. More...
 

Friends

class SceneGraph< T >
 
class QueryObjectTester
 

Detailed Description

template<typename T>
class drake::geometry::QueryObject< T >

The QueryObject serves as a mechanism to perform geometry queries on the world's geometry.

The SceneGraph has an abstract-valued port that contains a QueryObject (i.e., a QueryObject-valued output port).

To perform geometry queries on SceneGraph:

  • a LeafSystem must have a QueryObject-valued input port and connect it to the corresponding query output port on SceneGraph,
  • the querying LeafSystem can evaluate the input port, retrieving a const QueryObject& in return, and, finally,
  • invoke the appropriate method on the QueryObject.

The const reference returned by the input port is considered "live" - it is linked to the context, system, and cache (making full use of all of those mechanisms). This const reference should never be persisted; doing so can lead to erroneous query results. It is simpler and more advisable to acquire it for evaluation in a limited scope (e.g., CalcTimeDerivatives()) and then discard it. If a QueryObject is needed for many separate functions in a LeafSystem, each should re-evaluate the input port. The underlying caching mechanism should make the cost of this negligible.

In addition to not persisting the reference from the output port, the QueryObject shouldn't be copied. Strictly speaking, it is an allowed operation, but the result is not live, and any geometry query performed on the copy will throw an exception.

A QueryObject cannot be converted to a different scalar type. A QueryObject of scalar type S can only be acquired from the output port of a SceneGraph of type S evaluated on a corresponding GeometryContext, also of type S.

Template Parameters
TThe scalar type. Must be a valid Eigen scalar.

Instantiated templates for the following kinds of T's are provided:

  • double
  • AutoDiffXd

They are already available to link against in the containing library. No other values for T are currently supported.

Constructor & Destructor Documentation

QueryObject ( const QueryObject< T > &  other)

Member Function Documentation

std::vector< PenetrationAsPointPair< double > > ComputePointPairPenetration ( ) const

Computes the penetrations across all pairs of geometries in the world.

Only reports results for penetrating geometries; if two geometries are separated, there will be no result for that pair. Pairs of anchored geometry are also not reported. The penetration between two geometries is characterized as a point pair (see PenetrationAsPointPair).

Returns
A vector populated with all detected penetrations characterized as point pairs.

Here is the call graph for this function:

Here is the caller graph for this function:

FrameId GetFrameId ( GeometryId  geometry_id) const

Reports the id of the frame to which the given geometry id is registered.

Exceptions
std::runtime_errorif the QueryObject is in default configuration.
std::logic_errorif the geometry id is invalid.
const std::string & GetSourceName ( SourceId  id) const

Reports the name for the given source id.

Exceptions
std::runtime_errorif the QueryObject is in default configuration.
std::logic_errorif the identifier is invalid.
QueryObject< T > & operator= ( const QueryObject< T > &  )

Friends And Related Function Documentation

friend class QueryObjectTester
friend
friend class SceneGraph< T >
friend

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