Dynamic geometry can move; more specifically, its kinematics (e.g., pose) depends on a system’s Context. Particularly, dynamic geometry is fixed to a frame whose kinematics values depend on a context. As the frame moves, the geometries fixed to it move with it. Therefore, to register dynamic geometry a frame must be registered first. These registered frames serve as the basis for repositioning geometry in the shared world. The geometry source is responsible for providing up-to-date kinematics values for those registered frames upon request (via an appropriate output port on the source LeafSystem connecting to the appropriate input port on SceneGraph). The work flow is as follows: 1. A LeafSystem registers itself as a geometry source, acquiring a SourceId (RegisterSource()). 2. The source registers a frame (GeometrySource::RegisterFrame()). - A frame always has a “parent” frame. It can implicitly be the world frame, or another frame registered by the source. 3. Register one or more geometries to a frame (GeometrySource::RegisterGeometry()). - The registered geometry is posed relative to the frame to which it is fixed. - The geometry can also be posed relative to another registered geometry. It will be affixed to that geometry’s frame.
Anchored geometry is independent of the context (i.e., it doesn’t move). Anchored geometries are always affixed to the immobile world frame. As such, registering a frame is not required for registering anchored geometry (see GeometrySource::RegisterAnchoredGeometry()). However, the source still “owns” the anchored geometry.
Updating Kinematics
Registering dynamic geometry implies a contract between the geometry source and SceneGraph. The geometry source must do the following: - It must provide, populate, and connect two output ports: the “id” port and the “pose” port. - The id port must contain all the frame ids returned as a result of frame registration. - The pose port must contain one pose per registered frame; the pose value is expressed relative to the registered frame’s parent frame. As mentioned above, the iᵗʰ pose value should describe the frame indicated by the iᵗʰ id in the id output port.
Failure to meet these requirements will lead to a run-time error.
Many (and eventually all) methods that configure the population of SceneGraph have two variants that differ by whether they accept a mutable Context or not. When no Context is provided, this SceneGraph instance’s underlying model is modified. When the SceneGraph instance allocates a context, its model is copied into that context.
The second variant causes SceneGraph to modify the data stored in the provided Context to be modified instead of the internal model.
The two interfaces can be used interchangeably. However, modifications to
this
SceneGraph’s underlying model will not affect previously allocated Context instances. A new Context should be allocated after modifying the model.Note
In this initial version, the only methods with the Context-modifying variant are those methods that do not change the the semantics of the input or output ports. Modifications that make such changes must be coordinated across systems.
-
__init__
(self: pydrake.geometry.SceneGraph_[AutoDiffXd]) → None¶ Constructs a default (empty) scene graph.
-
AddRenderer
(self: pydrake.geometry.SceneGraph_[AutoDiffXd], name: str, renderer: drake::geometry::render::RenderEngine) → None¶ Adds a new render engine to this SceneGraph. The SceneGraph owns the render engine. The render engine’s name should be referenced in the render::CameraProperties “CameraProperties” provided in the render queries (see QueryObject::RenderColorImage() as an example).
There is no restriction on when a renderer is added relative to geometry registration and role assignment. Given a representative sequence of registration and perception role assignment, the addition of the renderer can be introduced anywhere in the sequence and the end result would be the same.
GeometryId id1 = scene_graph.RegisterGeometry(source_id, ...); scene_graph.AssignRole(source_id, id1, PerceptionProperties()); GeometryId id2 = scene_graph.RegisterGeometry(source_id, ...); scene_graph.AssignRole(source_id, id2, PerceptionProperties()); GeometryId id3 = scene_graph.RegisterGeometry(source_id, ...); scene_graph.AssignRole(source_id, id3, PerceptionProperties());
- Parameter
name
: - The unique name of the renderer.
- Parameter
renderer
: - The
renderer
to add.
Raises: RuntimeError if the name is not unique. - Parameter
-
AssignRole
(*args, **kwargs)¶ Overloaded function.
- AssignRole(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.ProximityProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
Assigns the proximity role to the geometry indicated by
geometry_id
.- AssignRole(self: pydrake.geometry.SceneGraph_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.ProximityProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
systems::Context-modifying variant of AssignRole(SourceId,GeometryId,ProximityProperties) “AssignRole()” for proximity properties. Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
- AssignRole(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.PerceptionProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
Assigns the perception role to the geometry indicated by
geometry_id
.By default, a geometry with a perception role will be reified by all render::RenderEngine instances. This behavior can be changed. Renderers can be explicitly whitelisted via the (‘renderer’, ‘accepting’) perception property. Its type is std::set<std::string> and it contains the names of all the renderers that may reify it. If no property is defined (or an empty set is given), then the default behavior of all renderers attempting to reify it will be restored.
- AssignRole(self: pydrake.geometry.SceneGraph_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.PerceptionProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
systems::Context-modifying variant of AssignRole(SourceId,GeometryId,PerceptionProperties) “AssignRole()” for perception properties. Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
- AssignRole(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.IllustrationProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
Assigns the illustration role to the geometry indicated by
geometry_id
.Warning
When changing illustration properties (
assign = RoleAssign::kReplace
), there is no guarantee that these changes will affect the visualization. The visualizer needs to be able to “initialize” itself after changes to properties that will affect how a geometry appears. If changing a geometry’s illustration properties doesn’t seem to be affecting the visualization, retrigger its initialization action.- AssignRole(self: pydrake.geometry.SceneGraph_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.IllustrationProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
systems::Context-modifying variant of AssignRole(SourceId,GeometryId,IllustrationProperties) “AssignRole()” for illustration properties. Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
Warning
When changing illustration properties (
assign = RoleAssign::kReplace
), there is no guarantee that these changes will affect the visualization. The visualizer needs to be able to “initialize” itself after changes to properties that will affect how a geometry appears. If changing a geometry’s illustration properties doesn’t seem to be affecting the visualization, retrigger its initialization action.Warning
Due to a bug (see issue #13597), changing the illustration roles or properties in a systems::Context will not have any apparent effect in, at least, drake_visualizer. Please change the illustration role in the model prior to allocating the context.
-
ExcludeCollisionsBetween
(*args, **kwargs)¶ Overloaded function.
- ExcludeCollisionsBetween(self: pydrake.geometry.SceneGraph_[AutoDiffXd], setA: pydrake.geometry.GeometrySet, setB: pydrake.geometry.GeometrySet) -> None
Excludes geometry pairs from collision evaluation by updating the candidate pair set
C = C - P
, whereP = {(a, b)}, ∀ a ∈ A, b ∈ B
andA = {a₀, a₁, ..., aₘ}
andB = {b₀, b₁, ..., bₙ}
are the input sets of geometriessetA
andsetB
, respectively. This does not preclude collisions between members of the same set.See also
scene_graph_collision_filtering for requirements and how collision filtering works.
Raises: - RuntimeError if the groups include ids that don’t exist in the
- scene graph.
- ExcludeCollisionsBetween(self: pydrake.geometry.SceneGraph_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], setA: pydrake.geometry.GeometrySet, setB: pydrake.geometry.GeometrySet) -> None
systems::Context-modifying variant of ExcludeCollisionsBetween(). Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
-
ExcludeCollisionsWithin
(*args, **kwargs)¶ Overloaded function.
- ExcludeCollisionsWithin(self: pydrake.geometry.SceneGraph_[AutoDiffXd], set: pydrake.geometry.GeometrySet) -> None
Excludes geometry pairs from collision evaluation by updating the candidate pair set
C = C - P
, whereP = {(gᵢ, gⱼ)}, ∀ gᵢ, gⱼ ∈ G
andG = {g₀, g₁, ..., gₘ}
is the inputset
of geometries.This method modifies the underlying model and requires a new Context to be allocated.
See also
scene_graph_collision_filtering for requirements and how collision filtering works.
Raises: - RuntimeError if the set includes ids that don’t exist in the scene
graph.
- ExcludeCollisionsWithin(self: pydrake.geometry.SceneGraph_[AutoDiffXd], context: pydrake.systems.framework.Context_[AutoDiffXd], set: pydrake.geometry.GeometrySet) -> None
systems::Context-modifying variant of ExcludeCollisionsWithin(). Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
-
get_pose_bundle_output_port
(self: pydrake.geometry.SceneGraph_[AutoDiffXd]) → pydrake.systems.framework.OutputPort_[AutoDiffXd]¶ Returns the output port which produces the PoseBundle for LCM communication to drake visualizer.
-
get_query_output_port
(self: pydrake.geometry.SceneGraph_[AutoDiffXd]) → pydrake.systems.framework.OutputPort_[AutoDiffXd]¶ Returns the output port which produces the QueryObject for performing geometric queries.
-
get_source_pose_port
(self: pydrake.geometry.SceneGraph_[AutoDiffXd], arg0: pydrake.geometry.SourceId) → pydrake.systems.framework.InputPort_[AutoDiffXd]¶ Given a valid source
id
, returns a pose input port associated with thatid
. This port is used to communicate pose data for registered frames.Raises: RuntimeError if the source_id is not recognized.
-
HasRenderer
(self: pydrake.geometry.SceneGraph_[AutoDiffXd], name: str) → bool¶ Reports if this SceneGraph has a renderer registered to the given name.
-
model_inspector
(self: pydrake.geometry.SceneGraph_[AutoDiffXd]) → pydrake.geometry.SceneGraphInspector_[AutoDiffXd]¶ Returns an inspector on the system’s model scene graph data.
-
RegisterAnchoredGeometry
(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry: pydrake.geometry.GeometryInstance) → pydrake.geometry.GeometryId¶ Registers a new anchored geometry G for this source. This hangs geometry G from the world frame (W). Its pose is defined in that frame (i.e.,
X_WG
). Returns the corresponding unique geometry id.Roles will be assigned to the registered geometry if the corresponding GeometryInstance
geometry
has had properties assigned.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the frame.
- Parameter
geometry
: - The anchored geometry G to add to the world.
Returns: A unique identifier for the added geometry.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source or b) the geometry’s name doesn’t satisfy the
- requirements outlined in GeometryInstance.
- Parameter
-
RegisterFrame
(*args, **kwargs)¶ Overloaded function.
- RegisterFrame(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, frame: pydrake.geometry.GeometryFrame) -> pydrake.geometry.FrameId
Registers a new frame F for this source. This hangs frame F on the world frame (W). Its pose is defined relative to the world frame (i.e,
X_WF
). Returns the corresponding unique frame id.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the frame.
- Parameter
frame
: - The frame to register.
Returns: A unique identifier for the added frame.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source, or b)
frame
has an id that has already been registered.
- RegisterFrame(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, parent_id: pydrake.geometry.FrameId, frame: pydrake.geometry.GeometryFrame) -> pydrake.geometry.FrameId
Registers a new frame F for this source. This hangs frame F on another previously registered frame P (indicated by
parent_id
). The pose of the new frame is defined relative to the parent frame (i.e.,X_PF
). Returns the corresponding unique frame id.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the frame.
- Parameter
parent_id
: - The id of the parent frame P.
- Parameter
frame
: - The frame to register.
Returns: A unique identifier for the added frame.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source, b) the
parent_id
does not map to a known - frame or does not belong to the source, or c)
frame
has an id - that has already been registered.
-
RegisterGeometry
(*args, **kwargs)¶ Overloaded function.
- RegisterGeometry(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, frame_id: pydrake.geometry.FrameId, geometry: pydrake.geometry.GeometryInstance) -> pydrake.geometry.GeometryId
Registers a new geometry G for this source. This hangs geometry G on a previously registered frame F (indicated by
frame_id
). The pose of the geometry is defined in a fixed pose relative to F (i.e.,X_FG
). Returns the corresponding unique geometry id.Roles will be assigned to the registered geometry if the corresponding GeometryInstance
geometry
has had properties assigned.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the geometry.
- Parameter
frame_id
: - The id for the frame F to hang the geometry on.
- Parameter
geometry
: - The geometry G to affix to frame F.
Returns: A unique identifier for the added geometry.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source, b) the
frame_id
doesn’t belong to the - source, c) the
geometry
is equal tonullptr
, or d) the - geometry’s name doesn’t satisfy the requirements outlined in
GeometryInstance.
- RegisterGeometry(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, geometry: pydrake.geometry.GeometryInstance) -> pydrake.geometry.GeometryId
Registers a new geometry G for this source. This hangs geometry G on a previously registered geometry P (indicated by
geometry_id
). The pose of the geometry is defined in a fixed pose relative to geometry P (i.e.,X_PG
). By induction, this geometry is effectively rigidly affixed to the frame that P is affixed to. Returns the corresponding unique geometry id.Roles will be assigned to the registered geometry if the corresponding GeometryInstance
geometry
has had properties assigned.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the geometry.
- Parameter
geometry_id
: - The id for the parent geometry P.
- Parameter
geometry
: - The geometry G to add.
Returns: A unique identifier for the added geometry.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source, b) the
geometry_id
doesn’t belong to the - source, c) the
geometry
is equal tonullptr
, or d) the - geometry’s name doesn’t satisfy the requirements outlined in
GeometryInstance.
-
RegisterSource
(self: pydrake.geometry.SceneGraph_[AutoDiffXd], name: str = '') → pydrake.geometry.SourceId¶ Registers a new, named source to the geometry system. The caller must save the returned SourceId; it is the token by which all other operations on the geometry world are conducted.
This source id can be used to register arbitrary anchored geometry. But if dynamic geometry is registered (via RegisterGeometry/RegisterFrame), then the context-dependent pose values must be provided on an input port. See get_source_pose_port().
This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
name
: - The optional name of the source. If none is provided (or the empty string) a default name will be defined by SceneGraph’s logic.
Raises: RuntimeError if the name is not unique. - Parameter
-
RemoveRole
(self: pydrake.geometry.SceneGraph_[AutoDiffXd], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, role: pydrake.geometry.Role) → int¶ Removes the indicated
role
from the geometry indicated bygeometry_id
.Returns: One if the geometry had the role removed and zero if the geometry did not have the role assigned in the first place.
Raises: - RuntimeError if a)
source_id
does not map to a registered - source, b)
geometry_id
does not map to a registered geometry, geometry_id
does not belong tosource_id
, or d) the
- context has already been allocated.
- RuntimeError if a)
-
RendererCount
(self: pydrake.geometry.SceneGraph_[AutoDiffXd]) → int¶ Reports the number of renderers registered to this SceneGraph.
-
static
world_frame_id
() → pydrake.geometry.FrameId¶ Reports the identifier for the world frame.
-
class
pydrake.geometry.
SceneGraph_[float]
¶ Bases:
pydrake.systems.framework.LeafSystem_[float]
SceneGraph serves as the nexus for all geometry (and geometry-based operations) in a Diagram. Through SceneGraph, other systems that introduce geometry can register that geometry as part of a common global domain, including it in geometric queries (e.g., cars controlled by one LeafSystem can be observed by a different sensor system). SceneGraph provides the interface for registering the geometry, updating its position based on the current context, and performing geometric queries.
source_pose{0}→ ...→ source_pose{N-1}→ SceneGraph → lcm_visualization → query Only registered “geometry sources” can introduce geometry into SceneGraph. Geometry sources will typically be other leaf systems, but, in the case of anchored (i.e., stationary) geometry, it could also be some other block of code (e.g., adding a common ground plane with which all systems’ geometries interact). For dynamic geometry (geometry whose pose depends on a Context), the geometry source must also provide pose values for all of the geometries the source owns, via a port connection on SceneGraph. For N geometry sources, the SceneGraph instance will have N pose input ports.
The basic workflow for interacting with SceneGraph is:
- Register as a geometry source, acquiring a unique SourceId.
- Register geometry (anchored and dynamic) with the system.
- Connect source’s geometry output ports to the corresponding SceneGraph
input ports. - Implement appropriate
Calc*
methods on the geometry output ports to update geometry pose values.For each registered geometry source, there is one input port for each order of kinematics values (e.g., pose, velocity, and acceleration). If a source registers a frame, it must connect to these ports (although, in the current version, only pose is supported). Failure to connect to the port (or to provide valid kinematics values) will lead to runtime exceptions.
pose port: An abstract-valued port providing an instance of FramePoseVector. For each registered frame, this “pose vector” maps the registered FrameId to a pose value. All registered frames must be accounted for and only frames registered by a source can be included in its output port. See the details in FrameKinematicsVector for details on how to provide values for this port.
SceneGraph has two output ports:
query port: An abstract-valued port containing an instance of QueryObject. It provides a “ticket” for downstream LeafSystem instances to perform geometric queries on the SceneGraph. To perform geometric queries, downstream LeafSystem instances acquire the QueryObject from SceneGraph’s output port and provide it as a parameter to one of SceneGraph’s query methods (e.g., SceneGraph::ComputeContact()). This assumes that the querying system has access to a const pointer to the connected SceneGraph instance. Use get_query_output_port() to acquire the output port for the query handle.
lcm visualization port: An abstract-valued port containing an instance of PoseBundle. This is a convenience port designed to feed LCM update messages to drake_visualizer for the purpose of visualizing the state of the world’s geometry. Additional uses of this port are strongly discouraged; instead, use an appropriate geometric query to obtain the state of the world’s geometry.
LeafSystem instances can relate to SceneGraph in one of two ways: as a consumer that performs queries, or as a producer that introduces geometry into the shared world and defines its context-dependent kinematics values. It is reasonable for systems to perform either role singly, or both.
Consumer
Consumers perform geometric queries upon the world geometry. SceneGraph serves those queries. As indicated above, in order for a LeafSystem to act as a consumer, it must: 1. define a QueryObject-valued input port and connect it to SceneGraph’s corresponding output port, and 2. have a reference to the connected SceneGraph instance.
With those two requirements satisfied, a LeafSystem can perform geometry queries by: 1. evaluating the QueryObject input port, and 2. passing the returned query object into the appropriate query method on SceneGraph (e.g., SceneGraph::ComputeContact()).
Producer
All producers introduce geometry into the shared geometric world. This is called registering geometry. Depending on what exactly has been registered, a producer may also have to update kinematics. Producers themselves must be registered with SceneGraph as producers (a.k.a. geometry sources). They do this by acquiring a SourceId (via SceneGraph::RegisterSource()). The SourceId serves as a unique handle through which the producer’s identity is validated and its ownership of its registered geometry is maintained.
Registering Geometry
SceneGraph cannot know what geometry should be part of the shared world. Other systems are responsible for introducing geometry into the world. This process (defining geometry and informing SceneGraph) is called registering the geometry. The source that registers the geometry “owns” the geometry; the source’s unique SourceId is required to perform any operations on the geometry registered with that SourceId. Geometry can be registered as anchored or dynamic.
Dynamic geometry can move; more specifically, its kinematics (e.g., pose) depends on a system’s Context. Particularly, dynamic geometry is fixed to a frame whose kinematics values depend on a context. As the frame moves, the geometries fixed to it move with it. Therefore, to register dynamic geometry a frame must be registered first. These registered frames serve as the basis for repositioning geometry in the shared world. The geometry source is responsible for providing up-to-date kinematics values for those registered frames upon request (via an appropriate output port on the source LeafSystem connecting to the appropriate input port on SceneGraph). The work flow is as follows: 1. A LeafSystem registers itself as a geometry source, acquiring a SourceId (RegisterSource()). 2. The source registers a frame (GeometrySource::RegisterFrame()). - A frame always has a “parent” frame. It can implicitly be the world frame, or another frame registered by the source. 3. Register one or more geometries to a frame (GeometrySource::RegisterGeometry()). - The registered geometry is posed relative to the frame to which it is fixed. - The geometry can also be posed relative to another registered geometry. It will be affixed to that geometry’s frame.
Anchored geometry is independent of the context (i.e., it doesn’t move). Anchored geometries are always affixed to the immobile world frame. As such, registering a frame is not required for registering anchored geometry (see GeometrySource::RegisterAnchoredGeometry()). However, the source still “owns” the anchored geometry.
Updating Kinematics
Registering dynamic geometry implies a contract between the geometry source and SceneGraph. The geometry source must do the following: - It must provide, populate, and connect two output ports: the “id” port and the “pose” port. - The id port must contain all the frame ids returned as a result of frame registration. - The pose port must contain one pose per registered frame; the pose value is expressed relative to the registered frame’s parent frame. As mentioned above, the iᵗʰ pose value should describe the frame indicated by the iᵗʰ id in the id output port.
Failure to meet these requirements will lead to a run-time error.
Many (and eventually all) methods that configure the population of SceneGraph have two variants that differ by whether they accept a mutable Context or not. When no Context is provided, this SceneGraph instance’s underlying model is modified. When the SceneGraph instance allocates a context, its model is copied into that context.
The second variant causes SceneGraph to modify the data stored in the provided Context to be modified instead of the internal model.
The two interfaces can be used interchangeably. However, modifications to
this
SceneGraph’s underlying model will not affect previously allocated Context instances. A new Context should be allocated after modifying the model.Note
In this initial version, the only methods with the Context-modifying variant are those methods that do not change the the semantics of the input or output ports. Modifications that make such changes must be coordinated across systems.
-
__init__
(self: pydrake.geometry.SceneGraph_[float]) → None¶ Constructs a default (empty) scene graph.
-
AddRenderer
(self: pydrake.geometry.SceneGraph_[float], name: str, renderer: drake::geometry::render::RenderEngine) → None¶ Adds a new render engine to this SceneGraph. The SceneGraph owns the render engine. The render engine’s name should be referenced in the render::CameraProperties “CameraProperties” provided in the render queries (see QueryObject::RenderColorImage() as an example).
There is no restriction on when a renderer is added relative to geometry registration and role assignment. Given a representative sequence of registration and perception role assignment, the addition of the renderer can be introduced anywhere in the sequence and the end result would be the same.
GeometryId id1 = scene_graph.RegisterGeometry(source_id, ...); scene_graph.AssignRole(source_id, id1, PerceptionProperties()); GeometryId id2 = scene_graph.RegisterGeometry(source_id, ...); scene_graph.AssignRole(source_id, id2, PerceptionProperties()); GeometryId id3 = scene_graph.RegisterGeometry(source_id, ...); scene_graph.AssignRole(source_id, id3, PerceptionProperties());
- Parameter
name
: - The unique name of the renderer.
- Parameter
renderer
: - The
renderer
to add.
Raises: RuntimeError if the name is not unique. - Parameter
-
AssignRole
(*args, **kwargs)¶ Overloaded function.
- AssignRole(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.ProximityProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
Assigns the proximity role to the geometry indicated by
geometry_id
.- AssignRole(self: pydrake.geometry.SceneGraph_[float], context: pydrake.systems.framework.Context_[float], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.ProximityProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
systems::Context-modifying variant of AssignRole(SourceId,GeometryId,ProximityProperties) “AssignRole()” for proximity properties. Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
- AssignRole(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.PerceptionProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
Assigns the perception role to the geometry indicated by
geometry_id
.By default, a geometry with a perception role will be reified by all render::RenderEngine instances. This behavior can be changed. Renderers can be explicitly whitelisted via the (‘renderer’, ‘accepting’) perception property. Its type is std::set<std::string> and it contains the names of all the renderers that may reify it. If no property is defined (or an empty set is given), then the default behavior of all renderers attempting to reify it will be restored.
- AssignRole(self: pydrake.geometry.SceneGraph_[float], context: pydrake.systems.framework.Context_[float], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.PerceptionProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
systems::Context-modifying variant of AssignRole(SourceId,GeometryId,PerceptionProperties) “AssignRole()” for perception properties. Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
- AssignRole(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.IllustrationProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
Assigns the illustration role to the geometry indicated by
geometry_id
.Warning
When changing illustration properties (
assign = RoleAssign::kReplace
), there is no guarantee that these changes will affect the visualization. The visualizer needs to be able to “initialize” itself after changes to properties that will affect how a geometry appears. If changing a geometry’s illustration properties doesn’t seem to be affecting the visualization, retrigger its initialization action.- AssignRole(self: pydrake.geometry.SceneGraph_[float], context: pydrake.systems.framework.Context_[float], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, properties: pydrake.geometry.IllustrationProperties, assign: pydrake.geometry.RoleAssign = RoleAssign.kNew) -> None
systems::Context-modifying variant of AssignRole(SourceId,GeometryId,IllustrationProperties) “AssignRole()” for illustration properties. Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
Warning
When changing illustration properties (
assign = RoleAssign::kReplace
), there is no guarantee that these changes will affect the visualization. The visualizer needs to be able to “initialize” itself after changes to properties that will affect how a geometry appears. If changing a geometry’s illustration properties doesn’t seem to be affecting the visualization, retrigger its initialization action.Warning
Due to a bug (see issue #13597), changing the illustration roles or properties in a systems::Context will not have any apparent effect in, at least, drake_visualizer. Please change the illustration role in the model prior to allocating the context.
-
ExcludeCollisionsBetween
(*args, **kwargs)¶ Overloaded function.
- ExcludeCollisionsBetween(self: pydrake.geometry.SceneGraph_[float], setA: pydrake.geometry.GeometrySet, setB: pydrake.geometry.GeometrySet) -> None
Excludes geometry pairs from collision evaluation by updating the candidate pair set
C = C - P
, whereP = {(a, b)}, ∀ a ∈ A, b ∈ B
andA = {a₀, a₁, ..., aₘ}
andB = {b₀, b₁, ..., bₙ}
are the input sets of geometriessetA
andsetB
, respectively. This does not preclude collisions between members of the same set.See also
scene_graph_collision_filtering for requirements and how collision filtering works.
Raises: - RuntimeError if the groups include ids that don’t exist in the
- scene graph.
- ExcludeCollisionsBetween(self: pydrake.geometry.SceneGraph_[float], context: pydrake.systems.framework.Context_[float], setA: pydrake.geometry.GeometrySet, setB: pydrake.geometry.GeometrySet) -> None
systems::Context-modifying variant of ExcludeCollisionsBetween(). Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
-
ExcludeCollisionsWithin
(*args, **kwargs)¶ Overloaded function.
- ExcludeCollisionsWithin(self: pydrake.geometry.SceneGraph_[float], set: pydrake.geometry.GeometrySet) -> None
Excludes geometry pairs from collision evaluation by updating the candidate pair set
C = C - P
, whereP = {(gᵢ, gⱼ)}, ∀ gᵢ, gⱼ ∈ G
andG = {g₀, g₁, ..., gₘ}
is the inputset
of geometries.This method modifies the underlying model and requires a new Context to be allocated.
See also
scene_graph_collision_filtering for requirements and how collision filtering works.
Raises: - RuntimeError if the set includes ids that don’t exist in the scene
graph.
- ExcludeCollisionsWithin(self: pydrake.geometry.SceneGraph_[float], context: pydrake.systems.framework.Context_[float], set: pydrake.geometry.GeometrySet) -> None
systems::Context-modifying variant of ExcludeCollisionsWithin(). Rather than modifying SceneGraph’s model, it modifies the copy of the model stored in the provided context.
-
get_pose_bundle_output_port
(self: pydrake.geometry.SceneGraph_[float]) → pydrake.systems.framework.OutputPort_[float]¶ Returns the output port which produces the PoseBundle for LCM communication to drake visualizer.
-
get_query_output_port
(self: pydrake.geometry.SceneGraph_[float]) → pydrake.systems.framework.OutputPort_[float]¶ Returns the output port which produces the QueryObject for performing geometric queries.
-
get_source_pose_port
(self: pydrake.geometry.SceneGraph_[float], arg0: pydrake.geometry.SourceId) → pydrake.systems.framework.InputPort_[float]¶ Given a valid source
id
, returns a pose input port associated with thatid
. This port is used to communicate pose data for registered frames.Raises: RuntimeError if the source_id is not recognized.
-
HasRenderer
(self: pydrake.geometry.SceneGraph_[float], name: str) → bool¶ Reports if this SceneGraph has a renderer registered to the given name.
-
model_inspector
(self: pydrake.geometry.SceneGraph_[float]) → pydrake.geometry.SceneGraphInspector_[float]¶ Returns an inspector on the system’s model scene graph data.
-
RegisterAnchoredGeometry
(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, geometry: pydrake.geometry.GeometryInstance) → pydrake.geometry.GeometryId¶ Registers a new anchored geometry G for this source. This hangs geometry G from the world frame (W). Its pose is defined in that frame (i.e.,
X_WG
). Returns the corresponding unique geometry id.Roles will be assigned to the registered geometry if the corresponding GeometryInstance
geometry
has had properties assigned.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the frame.
- Parameter
geometry
: - The anchored geometry G to add to the world.
Returns: A unique identifier for the added geometry.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source or b) the geometry’s name doesn’t satisfy the
- requirements outlined in GeometryInstance.
- Parameter
-
RegisterFrame
(*args, **kwargs)¶ Overloaded function.
- RegisterFrame(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, frame: pydrake.geometry.GeometryFrame) -> pydrake.geometry.FrameId
Registers a new frame F for this source. This hangs frame F on the world frame (W). Its pose is defined relative to the world frame (i.e,
X_WF
). Returns the corresponding unique frame id.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the frame.
- Parameter
frame
: - The frame to register.
Returns: A unique identifier for the added frame.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source, or b)
frame
has an id that has already been registered.
- RegisterFrame(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, parent_id: pydrake.geometry.FrameId, frame: pydrake.geometry.GeometryFrame) -> pydrake.geometry.FrameId
Registers a new frame F for this source. This hangs frame F on another previously registered frame P (indicated by
parent_id
). The pose of the new frame is defined relative to the parent frame (i.e.,X_PF
). Returns the corresponding unique frame id.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the frame.
- Parameter
parent_id
: - The id of the parent frame P.
- Parameter
frame
: - The frame to register.
Returns: A unique identifier for the added frame.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source, b) the
parent_id
does not map to a known - frame or does not belong to the source, or c)
frame
has an id - that has already been registered.
-
RegisterGeometry
(*args, **kwargs)¶ Overloaded function.
- RegisterGeometry(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, frame_id: pydrake.geometry.FrameId, geometry: pydrake.geometry.GeometryInstance) -> pydrake.geometry.GeometryId
Registers a new geometry G for this source. This hangs geometry G on a previously registered frame F (indicated by
frame_id
). The pose of the geometry is defined in a fixed pose relative to F (i.e.,X_FG
). Returns the corresponding unique geometry id.Roles will be assigned to the registered geometry if the corresponding GeometryInstance
geometry
has had properties assigned.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the geometry.
- Parameter
frame_id
: - The id for the frame F to hang the geometry on.
- Parameter
geometry
: - The geometry G to affix to frame F.
Returns: A unique identifier for the added geometry.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source, b) the
frame_id
doesn’t belong to the - source, c) the
geometry
is equal tonullptr
, or d) the - geometry’s name doesn’t satisfy the requirements outlined in
GeometryInstance.
- RegisterGeometry(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, geometry: pydrake.geometry.GeometryInstance) -> pydrake.geometry.GeometryId
Registers a new geometry G for this source. This hangs geometry G on a previously registered geometry P (indicated by
geometry_id
). The pose of the geometry is defined in a fixed pose relative to geometry P (i.e.,X_PG
). By induction, this geometry is effectively rigidly affixed to the frame that P is affixed to. Returns the corresponding unique geometry id.Roles will be assigned to the registered geometry if the corresponding GeometryInstance
geometry
has had properties assigned.This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
source_id
: - The id for the source registering the geometry.
- Parameter
geometry_id
: - The id for the parent geometry P.
- Parameter
geometry
: - The geometry G to add.
Returns: A unique identifier for the added geometry.
Raises: - RuntimeError if a) the
source_id
does not map to a - registered source, b) the
geometry_id
doesn’t belong to the - source, c) the
geometry
is equal tonullptr
, or d) the - geometry’s name doesn’t satisfy the requirements outlined in
GeometryInstance.
-
RegisterSource
(self: pydrake.geometry.SceneGraph_[float], name: str = '') → pydrake.geometry.SourceId¶ Registers a new, named source to the geometry system. The caller must save the returned SourceId; it is the token by which all other operations on the geometry world are conducted.
This source id can be used to register arbitrary anchored geometry. But if dynamic geometry is registered (via RegisterGeometry/RegisterFrame), then the context-dependent pose values must be provided on an input port. See get_source_pose_port().
This method modifies the underlying model and requires a new Context to be allocated.
- Parameter
name
: - The optional name of the source. If none is provided (or the empty string) a default name will be defined by SceneGraph’s logic.
Raises: RuntimeError if the name is not unique. - Parameter
-
RemoveRole
(self: pydrake.geometry.SceneGraph_[float], source_id: pydrake.geometry.SourceId, geometry_id: pydrake.geometry.GeometryId, role: pydrake.geometry.Role) → int¶ Removes the indicated
role
from the geometry indicated bygeometry_id
.Returns: One if the geometry had the role removed and zero if the geometry did not have the role assigned in the first place.
Raises: - RuntimeError if a)
source_id
does not map to a registered - source, b)
geometry_id
does not map to a registered geometry, geometry_id
does not belong tosource_id
, or d) the
- context has already been allocated.
- RuntimeError if a)
-
RendererCount
(self: pydrake.geometry.SceneGraph_[float]) → int¶ Reports the number of renderers registered to this SceneGraph.
-
static
world_frame_id
() → pydrake.geometry.FrameId¶ Reports the identifier for the world frame.
-
pydrake.geometry.
SceneGraphInspector
¶
-
template
pydrake.geometry.
SceneGraphInspector_
¶ Instantiations:
SceneGraphInspector_[float]
,SceneGraphInspector_[AutoDiffXd]
-
class
SceneGraphInspector_[float]
¶ The SceneGraphInspector serves as a mechanism to query the topological structure of a SceneGraph instance. The topological structure consists of all of the SceneGraph data that does not depend on input pose data. Including, but not limited to:
- names of frames and geometries
- hierarchies (parents of geometries, parents of frames, etc.)
- geometry parameters (e.g., contact, rendering, visualization)
- fixed poses of geometries relative to frames
In contrast, the following pieces of data do depend on input pose data and cannot be performed with the SceneGraphInspector (see the QueryObject instead):
- world pose of frames or geometry
- collision queries
- proximity queries
A SceneGraphInspector cannot be instantiated explicitly. Nor can it be copied or moved. A reference to a SceneGraphInspector instance can be acquired from
- a SceneGraph instance (to inspect the state of the system’s model), or
- a QueryObject instance (to inspect the state of the scene graph data stored
in the context).
The reference should not be persisted (and, as previously indicated, cannot be copied). SceneGraphInspector instances are cheap; they can be created, queried, and thrown out. If there is any doubt about the valid lifespan of a SceneGraphInspector, throw out the old instance and request a new instance.
- Template parameter
T
: - The scalar of the associated SceneGraph instance. The template parameter is provided for the sake of compatibility, although no queries (or their results) depend on the scalar.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
CloneGeometryInstance
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.GeometryInstance¶ Obtains a new GeometryInstance that copies the geometry indicated by the given
id
.Returns: A new GeometryInstance that is ready to be added as a new geometry. All roles/properties will be copied, the shape will be cloned based off of the original, but the returned id() will completely unique. Raises: RuntimeError if the id
does not refer to a valid geometry.
-
GetAllGeometryIds
(self: pydrake.geometry.SceneGraphInspector_[float]) → List[pydrake.geometry.GeometryId]¶ Returns the set of all ids for registered geometries. The order is not guaranteed to have any particular meaning. But the order is guaranteed to remain fixed until a topological change is made (e.g., removal or addition of geometry/frames).
-
GetFrameId
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.FrameId¶ Reports the id of the frame to which the given geometry with the given
id
is registered.Raises: RuntimeError if id
does not map to a registered geometry.
-
GetGeometryIdByName
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId, role: pydrake.geometry.Role, name: str) → pydrake.geometry.GeometryId¶ Reports the id of the geometry with the given
name
androle
, attached to the frame with the given frameid
.- Parameter
id
: - The id of the frame whose geometry is being queried.
- Parameter
role
: - The assigned role of the desired geometry.
- Parameter
name
: - The name of the geometry to query for. The name will be canonicalized prior to lookup (see canonicalized_geometry_names “GeometryInstance” for details).
Returns: The id of the queried geometry.
Raises: - RuntimeError if no such geometry exists, multiple geometries have
- that name, or if the
id
does not map to a registered frame.
- Parameter
-
GetIllustrationProperties
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.IllustrationProperties¶ Returns a pointer to the const illustration properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetName
(*args, **kwargs)¶ Overloaded function.
- GetName(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) -> str
Reports the name of the frame with the given
id
.Raises: RuntimeError if id
does not map to a registered frame.- GetName(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) -> str
Reports the stored, canonical name of the geometry with the given
id
(see canonicalized_geometry_names “GeometryInstance” for details).Raises: RuntimeError if id
does not map to a registered geometry.
-
GetNameByFrameId
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) → str¶ Please use SceneGraphInspector.GetName() instead. This method will be removed on or after 2020-10-01.
-
GetNameByGeometryId
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → str¶ Please use SceneGraphInspector.GetName() instead. This method will be removed on or after 2020-10-01.
-
GetPerceptionProperties
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.PerceptionProperties¶ Returns a pointer to the const perception properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetPoseInFrame
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[float]¶ Reports the pose of the geometry G with the given
id
in its registered frame F (regardless of whether its topological parent is another geometry P or not). If the geometry was registered directly to the frame F, thenX_PG = X_FG
.See also
GetPoseInParent()
Raises: RuntimeError if id
does not map to a registered geometry.
-
GetPoseInParent
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[float]¶ Reports the pose of the geometry G with the given
id
in its registered topological parent P,X_PG
. That topological parent may be a frame F or another geometry. If the geometry was registered directly to F, thenX_PG = X_FG
.See also
GetPoseInFrame()
Raises: RuntimeError if id
does not map to a registered geometry.
-
GetProximityProperties
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.ProximityProperties¶ Returns a pointer to the const proximity properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetShape
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.Shape¶ Returns the shape specified for the geometry with the given
id
. In order to extract the details of the shape, it should be passed through an implementation of a ShapeReifier.
-
GetSourceName
(self: pydrake.geometry.SceneGraphInspector_[float], id: pydrake.geometry.SourceId) → str¶ Reports the name for the source with the given
id
.Raises: RuntimeError if id
does not map to a registered source.
-
num_frames
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the total number of frames registered in the scene graph (including the world frame).
-
num_geometries
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the total number of geometries in the scene graph.
-
num_sources
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the number of registered sources – whether they have registered frames/geometries or not. This will always be at least 1; the SceneGraph itself counts as a source.
-
NumAnchoredGeometries
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the total number of anchored geometries. This should provide the same answer as calling NumGeometriesForFrame() with the world frame id.
-
NumDynamicGeometries
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the total number of dynamic geometries in the scene graph.
-
NumGeometriesWithRole
(self: pydrake.geometry.SceneGraphInspector_[float], role: pydrake.geometry.Role) → int¶ Reports the total number of geometries in the scene graph with the indicated role.
-
SourceIsRegistered
(self: pydrake.geometry.SceneGraphInspector_[float], id: pydrake.geometry.SourceId) → bool¶ Reports
True
if the givenid
maps to a registered source.
-
class
-
class
pydrake.geometry.
SceneGraphInspector_[AutoDiffXd]
¶ The SceneGraphInspector serves as a mechanism to query the topological structure of a SceneGraph instance. The topological structure consists of all of the SceneGraph data that does not depend on input pose data. Including, but not limited to:
- names of frames and geometries
- hierarchies (parents of geometries, parents of frames, etc.)
- geometry parameters (e.g., contact, rendering, visualization)
- fixed poses of geometries relative to frames
In contrast, the following pieces of data do depend on input pose data and cannot be performed with the SceneGraphInspector (see the QueryObject instead):
- world pose of frames or geometry
- collision queries
- proximity queries
A SceneGraphInspector cannot be instantiated explicitly. Nor can it be copied or moved. A reference to a SceneGraphInspector instance can be acquired from
- a SceneGraph instance (to inspect the state of the system’s model), or
- a QueryObject instance (to inspect the state of the scene graph data stored
in the context).
The reference should not be persisted (and, as previously indicated, cannot be copied). SceneGraphInspector instances are cheap; they can be created, queried, and thrown out. If there is any doubt about the valid lifespan of a SceneGraphInspector, throw out the old instance and request a new instance.
- Template parameter
T
: - The scalar of the associated SceneGraph instance. The template parameter is provided for the sake of compatibility, although no queries (or their results) depend on the scalar.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
CloneGeometryInstance
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.GeometryInstance¶ Obtains a new GeometryInstance that copies the geometry indicated by the given
id
.Returns: A new GeometryInstance that is ready to be added as a new geometry. All roles/properties will be copied, the shape will be cloned based off of the original, but the returned id() will completely unique. Raises: RuntimeError if the id
does not refer to a valid geometry.
-
GetAllGeometryIds
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → List[pydrake.geometry.GeometryId]¶ Returns the set of all ids for registered geometries. The order is not guaranteed to have any particular meaning. But the order is guaranteed to remain fixed until a topological change is made (e.g., removal or addition of geometry/frames).
-
GetFrameId
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.FrameId¶ Reports the id of the frame to which the given geometry with the given
id
is registered.Raises: RuntimeError if id
does not map to a registered geometry.
-
GetGeometryIdByName
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId, role: pydrake.geometry.Role, name: str) → pydrake.geometry.GeometryId¶ Reports the id of the geometry with the given
name
androle
, attached to the frame with the given frameid
.- Parameter
id
: - The id of the frame whose geometry is being queried.
- Parameter
role
: - The assigned role of the desired geometry.
- Parameter
name
: - The name of the geometry to query for. The name will be canonicalized prior to lookup (see canonicalized_geometry_names “GeometryInstance” for details).
Returns: The id of the queried geometry.
Raises: - RuntimeError if no such geometry exists, multiple geometries have
- that name, or if the
id
does not map to a registered frame.
- Parameter
-
GetIllustrationProperties
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.IllustrationProperties¶ Returns a pointer to the const illustration properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetName
(*args, **kwargs)¶ Overloaded function.
- GetName(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId) -> str
Reports the name of the frame with the given
id
.Raises: RuntimeError if id
does not map to a registered frame.- GetName(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) -> str
Reports the stored, canonical name of the geometry with the given
id
(see canonicalized_geometry_names “GeometryInstance” for details).Raises: RuntimeError if id
does not map to a registered geometry.
-
GetNameByFrameId
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId) → str¶ Please use SceneGraphInspector.GetName() instead. This method will be removed on or after 2020-10-01.
-
GetNameByGeometryId
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → str¶ Please use SceneGraphInspector.GetName() instead. This method will be removed on or after 2020-10-01.
-
GetPerceptionProperties
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.PerceptionProperties¶ Returns a pointer to the const perception properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetPoseInFrame
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[float]¶ Reports the pose of the geometry G with the given
id
in its registered frame F (regardless of whether its topological parent is another geometry P or not). If the geometry was registered directly to the frame F, thenX_PG = X_FG
.See also
GetPoseInParent()
Raises: RuntimeError if id
does not map to a registered geometry.
-
GetPoseInParent
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[float]¶ Reports the pose of the geometry G with the given
id
in its registered topological parent P,X_PG
. That topological parent may be a frame F or another geometry. If the geometry was registered directly to F, thenX_PG = X_FG
.See also
GetPoseInFrame()
Raises: RuntimeError if id
does not map to a registered geometry.
-
GetProximityProperties
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.ProximityProperties¶ Returns a pointer to the const proximity properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetShape
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.Shape¶ Returns the shape specified for the geometry with the given
id
. In order to extract the details of the shape, it should be passed through an implementation of a ShapeReifier.
-
GetSourceName
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], id: pydrake.geometry.SourceId) → str¶ Reports the name for the source with the given
id
.Raises: RuntimeError if id
does not map to a registered source.
-
num_frames
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → int¶ Reports the total number of frames registered in the scene graph (including the world frame).
-
num_geometries
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → int¶ Reports the total number of geometries in the scene graph.
-
num_sources
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → int¶ Reports the number of registered sources – whether they have registered frames/geometries or not. This will always be at least 1; the SceneGraph itself counts as a source.
-
NumAnchoredGeometries
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → int¶ Reports the total number of anchored geometries. This should provide the same answer as calling NumGeometriesForFrame() with the world frame id.
-
NumDynamicGeometries
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → int¶ Reports the total number of dynamic geometries in the scene graph.
-
NumGeometriesWithRole
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], role: pydrake.geometry.Role) → int¶ Reports the total number of geometries in the scene graph with the indicated role.
-
SourceIsRegistered
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], id: pydrake.geometry.SourceId) → bool¶ Reports
True
if the givenid
maps to a registered source.
-
class
pydrake.geometry.
SceneGraphInspector_[float]
¶ The SceneGraphInspector serves as a mechanism to query the topological structure of a SceneGraph instance. The topological structure consists of all of the SceneGraph data that does not depend on input pose data. Including, but not limited to:
- names of frames and geometries
- hierarchies (parents of geometries, parents of frames, etc.)
- geometry parameters (e.g., contact, rendering, visualization)
- fixed poses of geometries relative to frames
In contrast, the following pieces of data do depend on input pose data and cannot be performed with the SceneGraphInspector (see the QueryObject instead):
- world pose of frames or geometry
- collision queries
- proximity queries
A SceneGraphInspector cannot be instantiated explicitly. Nor can it be copied or moved. A reference to a SceneGraphInspector instance can be acquired from
- a SceneGraph instance (to inspect the state of the system’s model), or
- a QueryObject instance (to inspect the state of the scene graph data stored
in the context).
The reference should not be persisted (and, as previously indicated, cannot be copied). SceneGraphInspector instances are cheap; they can be created, queried, and thrown out. If there is any doubt about the valid lifespan of a SceneGraphInspector, throw out the old instance and request a new instance.
- Template parameter
T
: - The scalar of the associated SceneGraph instance. The template parameter is provided for the sake of compatibility, although no queries (or their results) depend on the scalar.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
CloneGeometryInstance
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.GeometryInstance¶ Obtains a new GeometryInstance that copies the geometry indicated by the given
id
.Returns: A new GeometryInstance that is ready to be added as a new geometry. All roles/properties will be copied, the shape will be cloned based off of the original, but the returned id() will completely unique. Raises: RuntimeError if the id
does not refer to a valid geometry.
-
GetAllGeometryIds
(self: pydrake.geometry.SceneGraphInspector_[float]) → List[pydrake.geometry.GeometryId]¶ Returns the set of all ids for registered geometries. The order is not guaranteed to have any particular meaning. But the order is guaranteed to remain fixed until a topological change is made (e.g., removal or addition of geometry/frames).
-
GetFrameId
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.FrameId¶ Reports the id of the frame to which the given geometry with the given
id
is registered.Raises: RuntimeError if id
does not map to a registered geometry.
-
GetGeometryIdByName
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId, role: pydrake.geometry.Role, name: str) → pydrake.geometry.GeometryId¶ Reports the id of the geometry with the given
name
androle
, attached to the frame with the given frameid
.- Parameter
id
: - The id of the frame whose geometry is being queried.
- Parameter
role
: - The assigned role of the desired geometry.
- Parameter
name
: - The name of the geometry to query for. The name will be canonicalized prior to lookup (see canonicalized_geometry_names “GeometryInstance” for details).
Returns: The id of the queried geometry.
Raises: - RuntimeError if no such geometry exists, multiple geometries have
- that name, or if the
id
does not map to a registered frame.
- Parameter
-
GetIllustrationProperties
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.IllustrationProperties¶ Returns a pointer to the const illustration properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetName
(*args, **kwargs)¶ Overloaded function.
- GetName(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) -> str
Reports the name of the frame with the given
id
.Raises: RuntimeError if id
does not map to a registered frame.- GetName(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) -> str
Reports the stored, canonical name of the geometry with the given
id
(see canonicalized_geometry_names “GeometryInstance” for details).Raises: RuntimeError if id
does not map to a registered geometry.
-
GetNameByFrameId
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) → str¶ Please use SceneGraphInspector.GetName() instead. This method will be removed on or after 2020-10-01.
-
GetNameByGeometryId
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → str¶ Please use SceneGraphInspector.GetName() instead. This method will be removed on or after 2020-10-01.
-
GetPerceptionProperties
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.PerceptionProperties¶ Returns a pointer to the const perception properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetPoseInFrame
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[float]¶ Reports the pose of the geometry G with the given
id
in its registered frame F (regardless of whether its topological parent is another geometry P or not). If the geometry was registered directly to the frame F, thenX_PG = X_FG
.See also
GetPoseInParent()
Raises: RuntimeError if id
does not map to a registered geometry.
-
GetPoseInParent
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[float]¶ Reports the pose of the geometry G with the given
id
in its registered topological parent P,X_PG
. That topological parent may be a frame F or another geometry. If the geometry was registered directly to F, thenX_PG = X_FG
.See also
GetPoseInFrame()
Raises: RuntimeError if id
does not map to a registered geometry.
-
GetProximityProperties
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.ProximityProperties¶ Returns a pointer to the const proximity properties of the geometry with the given
id
.- Parameter
id
: - The identifier for the queried geometry.
Returns: A pointer to the properties (or nullptr if there are no such properties). Raises: RuntimeError if id
does not map to a registered geometry.- Parameter
-
GetShape
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) → pydrake.geometry.Shape¶ Returns the shape specified for the geometry with the given
id
. In order to extract the details of the shape, it should be passed through an implementation of a ShapeReifier.
-
GetSourceName
(self: pydrake.geometry.SceneGraphInspector_[float], id: pydrake.geometry.SourceId) → str¶ Reports the name for the source with the given
id
.Raises: RuntimeError if id
does not map to a registered source.
-
num_frames
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the total number of frames registered in the scene graph (including the world frame).
-
num_geometries
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the total number of geometries in the scene graph.
-
num_sources
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the number of registered sources – whether they have registered frames/geometries or not. This will always be at least 1; the SceneGraph itself counts as a source.
-
NumAnchoredGeometries
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the total number of anchored geometries. This should provide the same answer as calling NumGeometriesForFrame() with the world frame id.
-
NumDynamicGeometries
(self: pydrake.geometry.SceneGraphInspector_[float]) → int¶ Reports the total number of dynamic geometries in the scene graph.
-
NumGeometriesWithRole
(self: pydrake.geometry.SceneGraphInspector_[float], role: pydrake.geometry.Role) → int¶ Reports the total number of geometries in the scene graph with the indicated role.
-
SourceIsRegistered
(self: pydrake.geometry.SceneGraphInspector_[float], id: pydrake.geometry.SourceId) → bool¶ Reports
True
if the givenid
maps to a registered source.
-
class
pydrake.geometry.
Shape
¶ The base interface for all shape specifications. It has no public constructor and cannot be instantiated directly. The Shape class has two key properties:
- it is cloneable, and
- it can be “reified” (see ShapeReifier).
When you add a new subclass of Shape, you must:
1. add a virtual function ImplementGeometry() for the new shape in ShapeReifier that invokes the ThrowUnsupportedGeometry method, and add to the test for it in shape_specification_test.cc. 2. implement ImplementGeometry in derived ShapeReifiers to continue support if desired, otherwise ensure unimplemented functions are not hidden in new derivations of ShapeReifier with
using
, for example,using ShapeReifier::ImplementGeometry
. Existing subclasses should already have this.Otherwise, you might get a runtime error. We do not have an automatic way to enforce them at compile time.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
Clone
(self: pydrake.geometry.Shape) → pydrake.geometry.Shape¶
-
pydrake.geometry.
SignedDistancePair
¶
-
template
pydrake.geometry.
SignedDistancePair_
¶ Instantiations:
SignedDistancePair_[float]
,SignedDistancePair_[AutoDiffXd]
-
class
SignedDistancePair_[float]
¶ The data for reporting the signed distance between two geometries, A and B. It provides the id’s of the two geometries, the witness points Ca and Cb on the surfaces of A and B, the signed distance, and nhat_BA_W a direction of fastest increasing distance (always unit length and always point outward from B’s surface).
- When A and B are separated, distance > 0.
- When A and B are touching or penetrating, distance <= 0.
- By definition, nhat_AB_W must be in the opposite direction of nhat_BA_W.
- (p_WCa - p_Wcb) = distance · nhat_BA_W.
- In some cases, nhat_BA_W is not unique, and is_nhat_BA_W_unique is false.
Warning
For two geometries that are just touching (i.e., distance = 0), the underlying code can guarantee a correct value for nhat_BA_W only when one geometry is a sphere, and the other geometry is a sphere, a box, or a cylinder. Otherwise, the underlying code is not in place yet to guarantee a correct value for nhat_BA_W when surfaces are just touching, and the vector will be populated by NaN values.
- Template parameter
T
: - The underlying scalar type. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SignedDistancePair_[float], **kwargs) → None¶ Constructor
- Parameter
a
: - The id of the first geometry (A).
- Parameter
b
: - The id of the second geometry (B).
- Parameter
p_ACa_in
: - The witness point on geometry A’s surface, in A’s frame.
- Parameter
p_BCb_in
: - The witness point on geometry B’s surface, in B’s frame.
- Parameter
dist
: - The signed distance between p_A and p_B.
- Parameter
nhat_BA_W_in
: - A direction of fastest increasing distance.
- Parameter
is_nhat_BA_W_unique_in
: - True if nhat_BA_W is unique.
- Precondition:
- nhat_BA_W_in is unit-length.
- Parameter
-
distance
¶ The signed distance between p_ACa and p_BCb.
-
id_A
¶ The id of the first geometry in the pair.
-
id_B
¶ The id of the second geometry in the pair.
-
is_nhat_BA_W_unique
¶
-
nhat_BA_W
¶ A direction of fastest increasing distance.
-
p_ACa
¶ The witness point on geometry A’s surface, expressed in A’s frame.
-
p_BCb
¶ The witness point on geometry B’s surface, expressed in B’s frame.
-
class
-
class
pydrake.geometry.
SignedDistancePair_[AutoDiffXd]
¶ The data for reporting the signed distance between two geometries, A and B. It provides the id’s of the two geometries, the witness points Ca and Cb on the surfaces of A and B, the signed distance, and nhat_BA_W a direction of fastest increasing distance (always unit length and always point outward from B’s surface).
- When A and B are separated, distance > 0.
- When A and B are touching or penetrating, distance <= 0.
- By definition, nhat_AB_W must be in the opposite direction of nhat_BA_W.
- (p_WCa - p_Wcb) = distance · nhat_BA_W.
- In some cases, nhat_BA_W is not unique, and is_nhat_BA_W_unique is false.
Warning
For two geometries that are just touching (i.e., distance = 0), the underlying code can guarantee a correct value for nhat_BA_W only when one geometry is a sphere, and the other geometry is a sphere, a box, or a cylinder. Otherwise, the underlying code is not in place yet to guarantee a correct value for nhat_BA_W when surfaces are just touching, and the vector will be populated by NaN values.
- Template parameter
T
: - The underlying scalar type. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SignedDistancePair_[AutoDiffXd], **kwargs) → None¶ Constructor
- Parameter
a
: - The id of the first geometry (A).
- Parameter
b
: - The id of the second geometry (B).
- Parameter
p_ACa_in
: - The witness point on geometry A’s surface, in A’s frame.
- Parameter
p_BCb_in
: - The witness point on geometry B’s surface, in B’s frame.
- Parameter
dist
: - The signed distance between p_A and p_B.
- Parameter
nhat_BA_W_in
: - A direction of fastest increasing distance.
- Parameter
is_nhat_BA_W_unique_in
: - True if nhat_BA_W is unique.
- Precondition:
- nhat_BA_W_in is unit-length.
- Parameter
-
distance
¶ The signed distance between p_ACa and p_BCb.
-
id_A
¶ The id of the first geometry in the pair.
-
id_B
¶ The id of the second geometry in the pair.
-
is_nhat_BA_W_unique
¶
-
nhat_BA_W
¶ A direction of fastest increasing distance.
-
p_ACa
¶ The witness point on geometry A’s surface, expressed in A’s frame.
-
p_BCb
¶ The witness point on geometry B’s surface, expressed in B’s frame.
-
class
pydrake.geometry.
SignedDistancePair_[float]
¶ The data for reporting the signed distance between two geometries, A and B. It provides the id’s of the two geometries, the witness points Ca and Cb on the surfaces of A and B, the signed distance, and nhat_BA_W a direction of fastest increasing distance (always unit length and always point outward from B’s surface).
- When A and B are separated, distance > 0.
- When A and B are touching or penetrating, distance <= 0.
- By definition, nhat_AB_W must be in the opposite direction of nhat_BA_W.
- (p_WCa - p_Wcb) = distance · nhat_BA_W.
- In some cases, nhat_BA_W is not unique, and is_nhat_BA_W_unique is false.
Warning
For two geometries that are just touching (i.e., distance = 0), the underlying code can guarantee a correct value for nhat_BA_W only when one geometry is a sphere, and the other geometry is a sphere, a box, or a cylinder. Otherwise, the underlying code is not in place yet to guarantee a correct value for nhat_BA_W when surfaces are just touching, and the vector will be populated by NaN values.
- Template parameter
T
: - The underlying scalar type. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SignedDistancePair_[float], **kwargs) → None¶ Constructor
- Parameter
a
: - The id of the first geometry (A).
- Parameter
b
: - The id of the second geometry (B).
- Parameter
p_ACa_in
: - The witness point on geometry A’s surface, in A’s frame.
- Parameter
p_BCb_in
: - The witness point on geometry B’s surface, in B’s frame.
- Parameter
dist
: - The signed distance between p_A and p_B.
- Parameter
nhat_BA_W_in
: - A direction of fastest increasing distance.
- Parameter
is_nhat_BA_W_unique_in
: - True if nhat_BA_W is unique.
- Precondition:
- nhat_BA_W_in is unit-length.
- Parameter
-
distance
¶ The signed distance between p_ACa and p_BCb.
-
id_A
¶ The id of the first geometry in the pair.
-
id_B
¶ The id of the second geometry in the pair.
-
is_nhat_BA_W_unique
¶
-
nhat_BA_W
¶ A direction of fastest increasing distance.
-
p_ACa
¶ The witness point on geometry A’s surface, expressed in A’s frame.
-
p_BCb
¶ The witness point on geometry B’s surface, expressed in B’s frame.
-
pydrake.geometry.
SignedDistanceToPoint
¶
-
template
pydrake.geometry.
SignedDistanceToPoint_
¶ Instantiations:
SignedDistanceToPoint_[float]
,SignedDistanceToPoint_[AutoDiffXd]
-
class
SignedDistanceToPoint_[float]
¶ The data for reporting the signed distance from a query point to a geometry. Reports the result of a signed distance query between a query point Q and geometry G. This includes G’s id, the signed distance, the nearest point N on the surface of G, and the gradient of the signed distance with respect to the position of Q. Generally, the gradient of the signed distance function is not defined everywhere. The value reported in this struct depends on the query function returning it. Refer to the query function’s documentation for what value it will report for otherwise undefined gradient values.
- Template parameter
T
: - The underlying scalar type. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SignedDistanceToPoint_[float], **kwargs) → None¶ Constructs SignedDistanceToPoint struct from calculated results.
- Parameter
id_G_in
: - The id of the geometry G to which we measure distance from the query point Q.
- Parameter
p_GN_in
: - The position of the nearest point N on G’s surface from the query point Q, expressed in G’s frame.
- Parameter
distance_in
: - The signed distance from the query point Q to the nearest point N on the surface of geometry G. It is positive if Q is outside G. It is negative if Q is inside G. It is zero if Q is on the boundary of G.
- Parameter
grad_W_in
: - The gradient vector of the distance function with respect to the query point Q, expressed in world frame W.
- Parameter
is_grad_W_unique_in
: - True if grad_W is unique, false otherwise.
Note
grad_W is not well defined everywhere. For example, when computing the distance from a point to a sphere, and the point coincides with the center of the sphere, grad_W is not well defined (as it can be computed as p_GQ / |p_GQ|, but the denominator is 0). When grad_W is not well defined, and we instantiate SignedDistanceToPoint<T> with T being an AutoDiffScalar (like AutoDiffXd), the gradient of the query result is not well defined either, so the user should use the gradient in p_GN, distance and grad_W with caution.
- Precondition:
- grad_W_in must not contain NaN.
- Parameter
-
distance
¶ The signed distance from the query point Q to the nearest point N on the surface of geometry G. It is positive if Q is outside G. It is negative if Q is inside G. It is zero if Q is on the boundary of G.
-
grad_W
¶ The gradient vector of the distance function with respect to the query point Q, expressed in world frame W.
-
id_G
¶ The id of the geometry G to which we measure distance from the query point Q.
-
p_GN
¶ The position of the nearest point N on G’s surface from the query point Q, expressed in G’s frame.
- Template parameter
-
class
-
class
pydrake.geometry.
SignedDistanceToPoint_[AutoDiffXd]
¶ The data for reporting the signed distance from a query point to a geometry. Reports the result of a signed distance query between a query point Q and geometry G. This includes G’s id, the signed distance, the nearest point N on the surface of G, and the gradient of the signed distance with respect to the position of Q. Generally, the gradient of the signed distance function is not defined everywhere. The value reported in this struct depends on the query function returning it. Refer to the query function’s documentation for what value it will report for otherwise undefined gradient values.
- Template parameter
T
: - The underlying scalar type. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SignedDistanceToPoint_[AutoDiffXd], **kwargs) → None¶ Constructs SignedDistanceToPoint struct from calculated results.
- Parameter
id_G_in
: - The id of the geometry G to which we measure distance from the query point Q.
- Parameter
p_GN_in
: - The position of the nearest point N on G’s surface from the query point Q, expressed in G’s frame.
- Parameter
distance_in
: - The signed distance from the query point Q to the nearest point N on the surface of geometry G. It is positive if Q is outside G. It is negative if Q is inside G. It is zero if Q is on the boundary of G.
- Parameter
grad_W_in
: - The gradient vector of the distance function with respect to the query point Q, expressed in world frame W.
- Parameter
is_grad_W_unique_in
: - True if grad_W is unique, false otherwise.
Note
grad_W is not well defined everywhere. For example, when computing the distance from a point to a sphere, and the point coincides with the center of the sphere, grad_W is not well defined (as it can be computed as p_GQ / |p_GQ|, but the denominator is 0). When grad_W is not well defined, and we instantiate SignedDistanceToPoint<T> with T being an AutoDiffScalar (like AutoDiffXd), the gradient of the query result is not well defined either, so the user should use the gradient in p_GN, distance and grad_W with caution.
- Precondition:
- grad_W_in must not contain NaN.
- Parameter
-
distance
¶ The signed distance from the query point Q to the nearest point N on the surface of geometry G. It is positive if Q is outside G. It is negative if Q is inside G. It is zero if Q is on the boundary of G.
-
grad_W
¶ The gradient vector of the distance function with respect to the query point Q, expressed in world frame W.
-
id_G
¶ The id of the geometry G to which we measure distance from the query point Q.
-
p_GN
¶ The position of the nearest point N on G’s surface from the query point Q, expressed in G’s frame.
- Template parameter
-
class
pydrake.geometry.
SignedDistanceToPoint_[float]
¶ The data for reporting the signed distance from a query point to a geometry. Reports the result of a signed distance query between a query point Q and geometry G. This includes G’s id, the signed distance, the nearest point N on the surface of G, and the gradient of the signed distance with respect to the position of Q. Generally, the gradient of the signed distance function is not defined everywhere. The value reported in this struct depends on the query function returning it. Refer to the query function’s documentation for what value it will report for otherwise undefined gradient values.
- Template parameter
T
: - The underlying scalar type. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SignedDistanceToPoint_[float], **kwargs) → None¶ Constructs SignedDistanceToPoint struct from calculated results.
- Parameter
id_G_in
: - The id of the geometry G to which we measure distance from the query point Q.
- Parameter
p_GN_in
: - The position of the nearest point N on G’s surface from the query point Q, expressed in G’s frame.
- Parameter
distance_in
: - The signed distance from the query point Q to the nearest point N on the surface of geometry G. It is positive if Q is outside G. It is negative if Q is inside G. It is zero if Q is on the boundary of G.
- Parameter
grad_W_in
: - The gradient vector of the distance function with respect to the query point Q, expressed in world frame W.
- Parameter
is_grad_W_unique_in
: - True if grad_W is unique, false otherwise.
Note
grad_W is not well defined everywhere. For example, when computing the distance from a point to a sphere, and the point coincides with the center of the sphere, grad_W is not well defined (as it can be computed as p_GQ / |p_GQ|, but the denominator is 0). When grad_W is not well defined, and we instantiate SignedDistanceToPoint<T> with T being an AutoDiffScalar (like AutoDiffXd), the gradient of the query result is not well defined either, so the user should use the gradient in p_GN, distance and grad_W with caution.
- Precondition:
- grad_W_in must not contain NaN.
- Parameter
-
distance
¶ The signed distance from the query point Q to the nearest point N on the surface of geometry G. It is positive if Q is outside G. It is negative if Q is inside G. It is zero if Q is on the boundary of G.
-
grad_W
¶ The gradient vector of the distance function with respect to the query point Q, expressed in world frame W.
-
id_G
¶ The id of the geometry G to which we measure distance from the query point Q.
-
p_GN
¶ The position of the nearest point N on G’s surface from the query point Q, expressed in G’s frame.
- Template parameter
-
class
pydrake.geometry.
SourceId
¶ Type used to identify geometry sources in SceneGraph.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
static
get_new_id
() → pydrake.geometry.SourceId¶ Generates a new identifier for this id type. This new identifier will be different from all previous identifiers created. This method does not make any guarantees about the values of ids from successive invocations. This method is guaranteed to be thread safe.
-
get_value
(self: pydrake.geometry.SourceId) → int¶ Extracts the underlying representation from the identifier. This is considered invalid for invalid ids and is strictly enforced in Debug builds.
-
is_valid
(self: pydrake.geometry.SourceId) → bool¶ Reports if the id is valid.
-
-
class
pydrake.geometry.
Sphere
¶ Bases:
pydrake.geometry.Shape
Definition of sphere. It is centered in its canonical frame with the given radius.
-
__init__
(self: pydrake.geometry.Sphere, radius: float) → None¶ Constructs a sphere with the given
radius
.Raises: - RuntimeError if
radius
is negative. Note that a zero radius is - is considered valid.
- RuntimeError if
-
radius
(self: pydrake.geometry.Sphere) → float¶
-
-
pydrake.geometry.
SurfaceMesh
¶ alias of
pydrake.geometry.SurfaceMesh_[float]
-
template
pydrake.geometry.
SurfaceMesh_
¶ Instantiations:
SurfaceMesh_[float]
,SurfaceMesh_[AutoDiffXd]
-
class
SurfaceMesh_[float]
¶ SurfaceMesh represents a triangulated surface.
- Template parameter
T
: - The underlying scalar type for coordinates, e.g., double or AutoDiffXd. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SurfaceMesh_[float], faces: List[drake::geometry::SurfaceFace], vertices: List[pydrake.geometry.SurfaceVertex_[float]]) → None¶ Constructs a SurfaceMesh from faces and vertices.
- Parameter
faces
: - The triangular faces.
- Parameter
vertices
: - The vertices.
- Parameter
-
faces
(self: pydrake.geometry.SurfaceMesh_[float]) → List[drake::geometry::SurfaceFace]¶ Returns the faces.
-
vertices
(self: pydrake.geometry.SurfaceMesh_[float]) → List[pydrake.geometry.SurfaceVertex_[float]]¶ Returns the vertices.
- Template parameter
-
class
-
class
pydrake.geometry.
SurfaceMesh_[AutoDiffXd]
¶ SurfaceMesh represents a triangulated surface.
- Template parameter
T
: - The underlying scalar type for coordinates, e.g., double or AutoDiffXd. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SurfaceMesh_[AutoDiffXd], faces: List[drake::geometry::SurfaceFace], vertices: List[pydrake.geometry.SurfaceVertex_[AutoDiffXd]]) → None¶ Constructs a SurfaceMesh from faces and vertices.
- Parameter
faces
: - The triangular faces.
- Parameter
vertices
: - The vertices.
- Parameter
-
faces
(self: pydrake.geometry.SurfaceMesh_[AutoDiffXd]) → List[drake::geometry::SurfaceFace]¶ Returns the faces.
-
vertices
(self: pydrake.geometry.SurfaceMesh_[AutoDiffXd]) → List[pydrake.geometry.SurfaceVertex_[AutoDiffXd]]¶ Returns the vertices.
- Template parameter
-
class
pydrake.geometry.
SurfaceMesh_[float]
¶ SurfaceMesh represents a triangulated surface.
- Template parameter
T
: - The underlying scalar type for coordinates, e.g., double or AutoDiffXd. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SurfaceMesh_[float], faces: List[drake::geometry::SurfaceFace], vertices: List[pydrake.geometry.SurfaceVertex_[float]]) → None¶ Constructs a SurfaceMesh from faces and vertices.
- Parameter
faces
: - The triangular faces.
- Parameter
vertices
: - The vertices.
- Parameter
-
faces
(self: pydrake.geometry.SurfaceMesh_[float]) → List[drake::geometry::SurfaceFace]¶ Returns the faces.
-
vertices
(self: pydrake.geometry.SurfaceMesh_[float]) → List[pydrake.geometry.SurfaceVertex_[float]]¶ Returns the vertices.
- Template parameter
-
pydrake.geometry.
SurfaceVertex
¶
-
template
pydrake.geometry.
SurfaceVertex_
¶ Instantiations:
SurfaceVertex_[float]
,SurfaceVertex_[AutoDiffXd]
-
class
SurfaceVertex_[float]
¶ SurfaceVertex represents a vertex in SurfaceMesh.
- Template parameter
T
: - The underlying scalar type for coordinates, e.g., double or AutoDiffXd. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SurfaceVertex_[float], r_MV: numpy.ndarray[numpy.float64[3, 1]]) → None¶ Constructs SurfaceVertex.
- Parameter
r_MV
: - displacement vector from the origin of M’s frame to this vertex, expressed in M’s frame.
- Parameter
-
r_MV
(self: pydrake.geometry.SurfaceVertex_[float]) → numpy.ndarray[numpy.float64[3, 1]]¶ Returns the displacement vector from the origin of M’s frame to this vertex, expressed in M’s frame.
- Template parameter
-
class
-
class
pydrake.geometry.
SurfaceVertex_[AutoDiffXd]
¶ SurfaceVertex represents a vertex in SurfaceMesh.
- Template parameter
T
: - The underlying scalar type for coordinates, e.g., double or AutoDiffXd. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SurfaceVertex_[AutoDiffXd], r_MV: numpy.ndarray[object[3, 1]]) → None¶ Constructs SurfaceVertex.
- Parameter
r_MV
: - displacement vector from the origin of M’s frame to this vertex, expressed in M’s frame.
- Parameter
-
r_MV
(self: pydrake.geometry.SurfaceVertex_[AutoDiffXd]) → numpy.ndarray[object[3, 1]]¶ Returns the displacement vector from the origin of M’s frame to this vertex, expressed in M’s frame.
- Template parameter
-
class
pydrake.geometry.
SurfaceVertex_[float]
¶ SurfaceVertex represents a vertex in SurfaceMesh.
- Template parameter
T
: - The underlying scalar type for coordinates, e.g., double or AutoDiffXd. Must be a valid Eigen scalar.
-
__init__
(self: pydrake.geometry.SurfaceVertex_[float], r_MV: numpy.ndarray[numpy.float64[3, 1]]) → None¶ Constructs SurfaceVertex.
- Parameter
r_MV
: - displacement vector from the origin of M’s frame to this vertex, expressed in M’s frame.
- Parameter
-
r_MV
(self: pydrake.geometry.SurfaceVertex_[float]) → numpy.ndarray[numpy.float64[3, 1]]¶ Returns the displacement vector from the origin of M’s frame to this vertex, expressed in M’s frame.
- Template parameter


Khaled al Shishani
FrontEnd Developer
- Code Fellows LTUC | Amman, JO
Internship | Advanced Software Development in Full-Stack JavaScript | 28/02/2021 - still - University of Jordan | Amman, JO
B.A. Business Information Systems | 2020
Education
- John wick
- Shawshank
- Braveheart
- The god father 2
- Who Am I 2014
Favorite movies
- Ajloun
- Jerash
- Dead Sea
- Aqaba
- wadi musa
Places to visit


public interface StompSession
| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
StompSession.Receiptable
A handle to use to track receipts.
|
static interface |
StompSession.Subscription
A handle to use to unsubscribe or to track a receipt.
|
| 限定符和类型 | 方法和说明 |
|---|---|
StompSession.Receiptable |
acknowledge(StompHeaders headers,
boolean consumed)
An overloaded version of
acknowledge(String, boolean) with
full StompHeaders instead of just a messageId . |
StompSession.Receiptable |
acknowledge(java.lang.String messageId,
boolean consumed)
Send an acknowledgement whether a message was consumed or not resulting
in an ACK or NACK frame respectively.
|
void |
disconnect()
Disconnect the session by sending a DISCONNECT frame.
|
java.lang.String |
getSessionId()
Return the id for the session.
|
boolean |
isConnected()
Whether the session is connected.
|
StompSession.Receiptable |
send(StompHeaders headers,
java.lang.Object payload)
An overloaded version of
send(String, Object) with full
StompHeaders instead of just a destination. |
StompSession.Receiptable |
send(java.lang.String destination,
java.lang.Object payload)
Send a message to the specified destination, converting the payload to a
byte[] with the help of a
MessageConverter . |
void |
setAutoReceipt(boolean enabled)
When enabled, a receipt header is automatically added to future
send and subscribe operations on this session, which
causes the server to return a RECEIPT. |
StompSession.Subscription |
subscribe(StompHeaders headers,
StompFrameHandler handler)
An overloaded version of
subscribe(String, StompFrameHandler)
with full StompHeaders instead of just a destination. |
StompSession.Subscription |
subscribe(java.lang.String destination,
StompFrameHandler handler)
Subscribe to the given destination by sending a SUBSCRIBE frame and handle
received messages with the specified
StompFrameHandler . |
java.lang.String getSessionId()
boolean isConnected()
void setAutoReceipt(boolean enabled)
send
and subscribe
operations on this session, which
causes the server to return a RECEIPT. An application can then use
the Receiptable
returned from the
operation to track the receipt.
A receipt header can also be added manually through the overloaded
methods that accept StompHeaders
.
StompSession.Receiptable send(java.lang.String destination, java.lang.Object payload)
byte[]
with the help of a
MessageConverter
.destination
- the destination to send a message topayload
- the message payloadStompSession.Receiptable send(StompHeaders headers, java.lang.Object payload)
send(String, Object)
with full
StompHeaders
instead of just a destination. The headers must
contain a destination and may also have other headers such as
"content-type" or custom headers for the broker to propagate to
subscribers, or broker-specific, non-standard headers..headers
- the message headerspayload
- the message payloadStompSession.Subscription subscribe(java.lang.String destination, StompFrameHandler handler)
StompFrameHandler
.destination
- the destination to subscribe tohandler
- the handler for received messagesStompSession.Subscription subscribe(StompHeaders headers, StompFrameHandler handler)
subscribe(String, StompFrameHandler)
with full StompHeaders
instead of just a destination.headers
- the headers for the subscribe message framehandler
- the handler for received messagesStompSession.Receiptable acknowledge(java.lang.String messageId, boolean consumed)
Note: to use this when subscribing you must set the
ack
header to "client" or
"client-individual" in order ot use this.
messageId
- the id of the messageconsumed
- whether the message was consumed or notStompSession.Receiptable acknowledge(StompHeaders headers, boolean consumed)
acknowledge(String, boolean)
with
full StompHeaders
instead of just a messageId
.headers
- the headers for the ACK or NACK message frameconsumed
- whether the message was consumed or notvoid disconnect()


Yogyakarta and its food
Once we got off the train, we ordered an grab (Here’s more information about grab) which
was a chaotic experience since there was a lot of traffic and the driver refused to
check the GPS and got lost twice! To be exact, the driver was talking on the phone
all the way and was convinced we were going to another hotel. So each time we told
him we were no going in the right direction, he ignored us. Even when we were
telling him that that wasn’t our hotel he tried to convince us it was...
Fortunately, the security guard of the hotel explained to him that he was at the
wrong location… From there, he agreed to listen to our direction and 1h30 later we
arrived at our apartment. (Always have google map opened to make sure drivers are
going in the right direction) (the trip was supposed to take 30 minutes in total)
We booked an apartment because it was supposed to be equipped with a stove and a
half kitchen, but there wasn’t any propane or kitchenware... Apart from that, the
place was perfect and very well located. We loved the street we were on since there
was a lot of delicious street food over there. Let’s just say that during our stay
in Yogyakarta, we ate a lot! We even extended our stay in the hotel because of the
food (And to take some time to relax, when you travel for long period you need to
take some time to do nothing)
(Here’s
more information about extending your stay)
In the first days, we visited markets. I loved visiting market especially the spot
where they sell spices. Not because I want to buy spice, most of them I have no idea
what they are, but just because I love the smell and I find it impressive to see to
huge sacks and baskets of different spices. It’s so different from anything you can
find in Canada.
In the market in Yogyakarta we discovered a nice desert. I was dough with stuffing
inside. Honestly, again, I have no idea what was the name of that thing. But there
was different flavor so we choose with our canadien mind and took chocolate
raspberry, durian and the lady keep trying to give us the blackbean ones... For us
black beans are not desert, but we took two to taste. Oh boy! We were happy we
listened to her later on. The black beans ones were the best. It tasted sweet and
fluffy. Yes a fluffy taste, that’s the best way to describe it. We loved it so much
that we went back before leaving and only bought black beans ones.
We discovered a lot of food in Yogyakarta and a lot of food mixes that didn’t sound
good at first, but were actually delicious. It’s important to mention that
Yogyakarta is renowned for it’s street food. We did taste two dish that we didn’t
thought we would like, but quickly fell in love. First the corn, for them it’s not a
side dish like in Canada, but a desert. They served it cooked in butter (of course
everything is better with butter) but also drenched in condensed milk and topped
with cheese. Yes, Cheese, corn, butter and condensed milk is a delicious mix. The
other mix we loved was deep fried banana, again drench in condensed milk and topped
with cheese. It’s really the unexpected mixes of cheese and condensed milk that we
didn’t expected to love so much. It’s also a type of food that we didn’t find
anywhere else (or at least not as good) in Indonesia.
I don’t talk about it much, but I love Ice tea. Unfortunately for my most places,
they only have coca cola or pepsi the “classic” type of drink. But my luck changed
in Indonesia.. Everywhere they sold Ice tea! Everywhere I could, I drank some. Most
of they were made with real tea and where really delicious. I almost had an overdose
of ice tea, Alexis had to limit my daily intake…
Enough about the food! Yogyakarta is not only a place where you can gain 5 pound in
a week, but also a place with wonderful historical temple. But that’s a story for an
another time!