pydrake.geometry¶

class
pydrake.geometry.
Box
¶ Bases:
pydrake.geometry.Shape
Definition of a box. The box is centered on the origin of its canonical frame with its dimensions aligned with the frame’s axes. The size of the box is given by three sizes.

__init__
(self: pydrake.geometry.Box, width: float, depth: float, height: float) → None¶ Constructs a box with the given
width
, depth, andheight
, which specify the box’s dimension along the canonical x, y, and zaxes, respectively.Raises:  RuntimeError if
width
, depth orheight
are not strictly positive.
 RuntimeError if

depth
(self: pydrake.geometry.Box) → float¶ Returns the box’s dimension along the y axis.

height
(self: pydrake.geometry.Box) → float¶ Returns the box’s dimension along the z axis.

size
(self: pydrake.geometry.Box) → numpy.ndarray[numpy.float64[3, 1]]¶ Returns the box’s dimensions.

width
(self: pydrake.geometry.Box) → float¶ Returns the box’s dimension along the x axis.


class
pydrake.geometry.
Capsule
¶ Bases:
pydrake.geometry.Shape
Definition of a capsule. It is centered in its canonical frame with the length of the capsule parallel with the frame’s zaxis.

__init__
(self: pydrake.geometry.Capsule, radius: float, length: float) → None¶ Constructs a capsule with the given
radius
andlength
.Raises:  RuntimeError if
radius
orlength
are not strictly positive.
 RuntimeError if

length
(self: pydrake.geometry.Capsule) → float¶

radius
(self: pydrake.geometry.Capsule) → float¶


pydrake.geometry.
ConnectDrakeVisualizer
(*args, **kwargs)¶ Overloaded function.
 ConnectDrakeVisualizer(builder: pydrake.systems.framework.DiagramBuilder_[float], scene_graph: drake::geometry::SceneGraph<double>, lcm: pydrake.lcm.DrakeLcmInterface = None, role: pydrake.geometry.Role = Role.kIllustration) > pydrake.systems.lcm.LcmPublisherSystem
Extends a Diagram with the required components to interface with drake_visualizer. This must be called during Diagram building and uses the given
builder
to add relevant subsystems and connections.This is a convenience method to simplify some common boilerplate for adding visualization capability to a Diagram. What it does is:
 adds an initialization event that sends the required load message to set up
the visualizer with the relevant geometry,  adds systems PoseBundleToDrawMessage and LcmPublisherSystem to the Diagram and connects the draw message output to the publisher input,  connects the
scene_graph
pose bundle output to the PoseBundleToDrawMessage system, and  sets the publishing rate to 1/60 of a second (simulated time).The visualization mechanism depends on the illustration role (see geometry_roles for details). Specifically, only geometries with the illustration role assigned will be included. The visualization function looks for the following properties in the IllustrationProperties instance.
Group name  Required  Property Name  Property Type  PropertyDescription   :——–:  :——:  :———–:  :————:  :——————   phong  no  diffuse  Eigen::Vector4d  The rgba value of the object surface 
See MakePhongIllustrationProperties() to facilitate making a compliant set of illustration properties.
You can then connect source output ports for visualization like this:
builder>Connect(pose_output_port, scene_graph.get_source_pose_port(source_id));
Note
The initialization event occurs when Simulator::Initialize() is called (explicitly or implicitly at the start of a simulation). If you aren’t going to be using a Simulator, use DispatchLoadMessage() to send the message yourself.
 Parameter
builder
:  The diagram builder being used to construct the Diagram.
 Parameter
scene_graph
:  The System in
builder
containing the geometry to be visualized.  Parameter
lcm
:  An optional lcm interface through which lcm messages will be dispatched. Will be allocated internally if none is supplied.
 Parameter
role
:  An optional flag to indicate the role of the geometries to be visualized; defaults to the illustration role.
 Precondition:
 This method has not been previously called while building the builder’s current Diagram.
 Precondition:
 The given
scene_graph
must be contained within the supplied DiagramBuilder.
Returns: the LcmPublisherSystem (in case callers, e.g., need to change the default publishing rate). See also
geometry::DispatchLoadMessage() / (Deprecated.)
 Deprecated:
 Please use DrakeVisualizerd::AddToBuilder(). This will be removed from Drake on or after 20210401.
 ConnectDrakeVisualizer(builder: pydrake.systems.framework.DiagramBuilder_[float], scene_graph: drake::geometry::SceneGraph<double>, pose_bundle_output_port: pydrake.systems.framework.OutputPort_[float], lcm: pydrake.lcm.DrakeLcmInterface = None, role: pydrake.geometry.Role = Role.kIllustration) > pydrake.systems.lcm.LcmPublisherSystem
Implements ConnectDrakeVisualizer, but using
pose_bundle_output_port
to explicitly specify the output port used to get pose bundles forscene_graph
. This is required, for instance, when the SceneGraph is inside a Diagram, and the Diagram exports the pose bundle port. Precondition:
 pose_bundle_output_port must be connected directly to the
pose_bundle_output_port of
scene_graph
.
See also
ConnectDrakeVisualizer(). / (Deprecated.)
 Deprecated:
 Please use DrakeVisualizerd::AddToBuilder(). This will be removed from Drake on or after 20210401.

pydrake.geometry.
ContactSurface
¶

template
pydrake.geometry.
ContactSurface_
¶ Instantiations:
ContactSurface_[float]
,ContactSurface_[AutoDiffXd]

class
ContactSurface_[float]
¶ The ContactSurface characterizes the intersection of two geometries M and N as a contact surface with a scalar field and a vector field, whose purpose is to support the hydroelastic pressure field contact model as described in:
R. Elandt, E. Drumwright, M. Sherman, and Andy Ruina. A pressure field model for fast, robust approximation of net contact force and moment between nominally rigid objects. IROS 2019: 82388245.
Mathematical Concepts ———————–
In this section, we give motivation for the concept of contact surface from the hydroelastic pressure field contact model. Here the mathematical discussion is coordinatefree (treatment of the topic without reference to any particular coordinate system); however, our implementation heavily relies on coordinate frames. We borrow terminology from differential geometry.
In this section, the mathematical term compact set (a subset of Euclidean space that is closed and bounded) corresponds to the term geometry (or the space occupied by the geometry) in SceneGraph.
We describe the contact surface 𝕊ₘₙ between two intersecting compact subsets 𝕄 and ℕ of ℝ³ with the scalar fields eₘ and eₙ defined on 𝕄 ⊂ ℝ³ and ℕ ⊂ ℝ³ respectively:
eₘ : 𝕄 → ℝ, eₙ : ℕ → ℝ.
The contact surface 𝕊ₘₙ is the surface of equilibrium eₘ = eₙ. It is the locus of points Q where eₘ(Q) equals eₙ(Q):
𝕊ₘₙ = { Q ∈ 𝕄 ∩ ℕ : eₘ(Q) = eₙ(Q) }.
We can define the scalar field eₘₙ on the surface 𝕊ₘₙ as a scalar function that assigns Q ∈ 𝕊ₘₙ the value of eₘ(Q), which is the same as eₙ(Q):
eₘₙ : 𝕊ₘₙ → ℝ, eₘₙ(Q) = eₘ(Q) = eₙ(Q).
We can also define the scalar field hₘₙ on 𝕄 ∩ ℕ as the difference between eₘ and eₙ:
hₘₙ : 𝕄 ∩ ℕ → ℝ, hₘₙ(Q) = eₘ(Q)  eₙ(Q).
It follows that the gradient vector field ∇hₘₙ on 𝕄 ∩ ℕ equals the difference between the the gradient vector fields ∇eₘ and ∇eₙ:
∇hₘₙ : 𝕄 ∩ ℕ → ℝ³, ∇hₘₙ(Q) = ∇eₘ(Q)  ∇eₙ(Q).
By construction, Q ∈ 𝕊ₘₙ if and only if hₘₙ(Q) = 0. In other words, 𝕊ₘₙ is the zero level set of hₘₙ. It follows that, for Q ∈ 𝕊ₘₙ, ∇hₘₙ(Q) is orthogonal to the surface 𝕊ₘₙ at Q in the direction of increasing eₘ  eₙ.
Notice that the domain of eₘₙ is the twodimensional surface 𝕊ₘₙ, while the domain of ∇hₘₙ is the threedimensional compact set 𝕄 ∩ ℕ. Even though eₘₙ and ∇hₘₙ are defined on different domains (𝕊ₘₙ and 𝕄 ∩ ℕ), our implementation only represents them on their common domain, i.e., 𝕊ₘₙ.
Discrete Representation ————————
In practice, the contact surface is approximated with a discrete triangle mesh. The triangle mesh’s normals are defined per face. The normal of each face is guaranteed to point “out of” N and “into” M. They can be accessed via
mesh_W().face_normal(face_index)
.The pressure values on the contact surface are represented as a continuous, piecewiselinear function, accessed via e_MN().
The normals of the mesh are discontinuous at triangle boundaries, but the pressure can be meaningfully evaluated over the entire domain of the mesh.
When available, the values of ∇eₘ and ∇eₙ are represented as a discontinuous, piecewiseconstant function over the triangles – one vector per triangle. These quantities are accessed via EvaluateGradE_M_W() and EvaluateGradE_N_W(), respectively.
Barycentric Coordinates ————————
For Point Q on the surface mesh of the contact surface between Geometry M and Geometry N, r_WQ = (x,y,z) is the displacement vector from the origin of the world frame to Q expressed in the coordinate frame of W. We also have the barycentric coordinates (b0, b1, b2) on a triangle of the surface mesh that contains Q. With vertices of the triangle labeled as v₀, v₁, v₂, we can map (b0, b1, b2) to r_WQ by:
r_WQ = b0 * r_Wv₀ + b1 * r_Wv₁ + b2 * r_Wv₂, b0 + b1 + b2 = 1, bᵢ ∈ [0,1],
where r_Wvᵢ is the displacement vector of the vertex labeled as vᵢ from the origin of the world frame, expressed in the world frame.
We use the barycentric coordinates to evaluate the field values.

__init__
¶ Initialize self. See help(type(self)) for accurate signature.

id_M
(self: pydrake.geometry.ContactSurface_[float]) → pydrake.geometry.GeometryId¶ Returns the geometry id of Geometry M.

id_N
(self: pydrake.geometry.ContactSurface_[float]) → pydrake.geometry.GeometryId¶ Returns the geometry id of Geometry N.

mesh_W
(self: pydrake.geometry.ContactSurface_[float]) → pydrake.geometry.SurfaceMesh_[float]¶ Returns a reference to the surface mesh whose vertex positions are measured and expressed in the world frame.


class

class
pydrake.geometry.
ContactSurface_[AutoDiffXd]
¶ The ContactSurface characterizes the intersection of two geometries M and N as a contact surface with a scalar field and a vector field, whose purpose is to support the hydroelastic pressure field contact model as described in:
R. Elandt, E. Drumwright, M. Sherman, and Andy Ruina. A pressure field model for fast, robust approximation of net contact force and moment between nominally rigid objects. IROS 2019: 82388245.
Mathematical Concepts ———————–
In this section, we give motivation for the concept of contact surface from the hydroelastic pressure field contact model. Here the mathematical discussion is coordinatefree (treatment of the topic without reference to any particular coordinate system); however, our implementation heavily relies on coordinate frames. We borrow terminology from differential geometry.
In this section, the mathematical term compact set (a subset of Euclidean space that is closed and bounded) corresponds to the term geometry (or the space occupied by the geometry) in SceneGraph.
We describe the contact surface 𝕊ₘₙ between two intersecting compact subsets 𝕄 and ℕ of ℝ³ with the scalar fields eₘ and eₙ defined on 𝕄 ⊂ ℝ³ and ℕ ⊂ ℝ³ respectively:
eₘ : 𝕄 → ℝ, eₙ : ℕ → ℝ.
The contact surface 𝕊ₘₙ is the surface of equilibrium eₘ = eₙ. It is the locus of points Q where eₘ(Q) equals eₙ(Q):
𝕊ₘₙ = { Q ∈ 𝕄 ∩ ℕ : eₘ(Q) = eₙ(Q) }.
We can define the scalar field eₘₙ on the surface 𝕊ₘₙ as a scalar function that assigns Q ∈ 𝕊ₘₙ the value of eₘ(Q), which is the same as eₙ(Q):
eₘₙ : 𝕊ₘₙ → ℝ, eₘₙ(Q) = eₘ(Q) = eₙ(Q).
We can also define the scalar field hₘₙ on 𝕄 ∩ ℕ as the difference between eₘ and eₙ:
hₘₙ : 𝕄 ∩ ℕ → ℝ, hₘₙ(Q) = eₘ(Q)  eₙ(Q).
It follows that the gradient vector field ∇hₘₙ on 𝕄 ∩ ℕ equals the difference between the the gradient vector fields ∇eₘ and ∇eₙ:
∇hₘₙ : 𝕄 ∩ ℕ → ℝ³, ∇hₘₙ(Q) = ∇eₘ(Q)  ∇eₙ(Q).
By construction, Q ∈ 𝕊ₘₙ if and only if hₘₙ(Q) = 0. In other words, 𝕊ₘₙ is the zero level set of hₘₙ. It follows that, for Q ∈ 𝕊ₘₙ, ∇hₘₙ(Q) is orthogonal to the surface 𝕊ₘₙ at Q in the direction of increasing eₘ  eₙ.
Notice that the domain of eₘₙ is the twodimensional surface 𝕊ₘₙ, while the domain of ∇hₘₙ is the threedimensional compact set 𝕄 ∩ ℕ. Even though eₘₙ and ∇hₘₙ are defined on different domains (𝕊ₘₙ and 𝕄 ∩ ℕ), our implementation only represents them on their common domain, i.e., 𝕊ₘₙ.
Discrete Representation ————————
In practice, the contact surface is approximated with a discrete triangle mesh. The triangle mesh’s normals are defined per face. The normal of each face is guaranteed to point “out of” N and “into” M. They can be accessed via
mesh_W().face_normal(face_index)
.The pressure values on the contact surface are represented as a continuous, piecewiselinear function, accessed via e_MN().
The normals of the mesh are discontinuous at triangle boundaries, but the pressure can be meaningfully evaluated over the entire domain of the mesh.
When available, the values of ∇eₘ and ∇eₙ are represented as a discontinuous, piecewiseconstant function over the triangles – one vector per triangle. These quantities are accessed via EvaluateGradE_M_W() and EvaluateGradE_N_W(), respectively.
Barycentric Coordinates ————————
For Point Q on the surface mesh of the contact surface between Geometry M and Geometry N, r_WQ = (x,y,z) is the displacement vector from the origin of the world frame to Q expressed in the coordinate frame of W. We also have the barycentric coordinates (b0, b1, b2) on a triangle of the surface mesh that contains Q. With vertices of the triangle labeled as v₀, v₁, v₂, we can map (b0, b1, b2) to r_WQ by:
r_WQ = b0 * r_Wv₀ + b1 * r_Wv₁ + b2 * r_Wv₂, b0 + b1 + b2 = 1, bᵢ ∈ [0,1],
where r_Wvᵢ is the displacement vector of the vertex labeled as vᵢ from the origin of the world frame, expressed in the world frame.
We use the barycentric coordinates to evaluate the field values.

__init__
¶ Initialize self. See help(type(self)) for accurate signature.

id_M
(self: pydrake.geometry.ContactSurface_[AutoDiffXd]) → pydrake.geometry.GeometryId¶ Returns the geometry id of Geometry M.

id_N
(self: pydrake.geometry.ContactSurface_[AutoDiffXd]) → pydrake.geometry.GeometryId¶ Returns the geometry id of Geometry N.

mesh_W
(self: pydrake.geometry.ContactSurface_[AutoDiffXd]) → pydrake.geometry.SurfaceMesh_[AutoDiffXd]¶ Returns a reference to the surface mesh whose vertex positions are measured and expressed in the world frame.


class
pydrake.geometry.
ContactSurface_[float]
¶ The ContactSurface characterizes the intersection of two geometries M and N as a contact surface with a scalar field and a vector field, whose purpose is to support the hydroelastic pressure field contact model as described in:
R. Elandt, E. Drumwright, M. Sherman, and Andy Ruina. A pressure field model for fast, robust approximation of net contact force and moment between nominally rigid objects. IROS 2019: 82388245.
Mathematical Concepts ———————–
In this section, we give motivation for the concept of contact surface from the hydroelastic pressure field contact model. Here the mathematical discussion is coordinatefree (treatment of the topic without reference to any particular coordinate system); however, our implementation heavily relies on coordinate frames. We borrow terminology from differential geometry.
In this section, the mathematical term compact set (a subset of Euclidean space that is closed and bounded) corresponds to the term geometry (or the space occupied by the geometry) in SceneGraph.
We describe the contact surface 𝕊ₘₙ between two intersecting compact subsets 𝕄 and ℕ of ℝ³ with the scalar fields eₘ and eₙ defined on 𝕄 ⊂ ℝ³ and ℕ ⊂ ℝ³ respectively:
eₘ : 𝕄 → ℝ, eₙ : ℕ → ℝ.
The contact surface 𝕊ₘₙ is the surface of equilibrium eₘ = eₙ. It is the locus of points Q where eₘ(Q) equals eₙ(Q):
𝕊ₘₙ = { Q ∈ 𝕄 ∩ ℕ : eₘ(Q) = eₙ(Q) }.
We can define the scalar field eₘₙ on the surface 𝕊ₘₙ as a scalar function that assigns Q ∈ 𝕊ₘₙ the value of eₘ(Q), which is the same as eₙ(Q):
eₘₙ : 𝕊ₘₙ → ℝ, eₘₙ(Q) = eₘ(Q) = eₙ(Q).
We can also define the scalar field hₘₙ on 𝕄 ∩ ℕ as the difference between eₘ and eₙ:
hₘₙ : 𝕄 ∩ ℕ → ℝ, hₘₙ(Q) = eₘ(Q)  eₙ(Q).
It follows that the gradient vector field ∇hₘₙ on 𝕄 ∩ ℕ equals the difference between the the gradient vector fields ∇eₘ and ∇eₙ:
∇hₘₙ : 𝕄 ∩ ℕ → ℝ³, ∇hₘₙ(Q) = ∇eₘ(Q)  ∇eₙ(Q).
By construction, Q ∈ 𝕊ₘₙ if and only if hₘₙ(Q) = 0. In other words, 𝕊ₘₙ is the zero level set of hₘₙ. It follows that, for Q ∈ 𝕊ₘₙ, ∇hₘₙ(Q) is orthogonal to the surface 𝕊ₘₙ at Q in the direction of increasing eₘ  eₙ.
Notice that the domain of eₘₙ is the twodimensional surface 𝕊ₘₙ, while the domain of ∇hₘₙ is the threedimensional compact set 𝕄 ∩ ℕ. Even though eₘₙ and ∇hₘₙ are defined on different domains (𝕊ₘₙ and 𝕄 ∩ ℕ), our implementation only represents them on their common domain, i.e., 𝕊ₘₙ.
Discrete Representation ————————
In practice, the contact surface is approximated with a discrete triangle mesh. The triangle mesh’s normals are defined per face. The normal of each face is guaranteed to point “out of” N and “into” M. They can be accessed via
mesh_W().face_normal(face_index)
.The pressure values on the contact surface are represented as a continuous, piecewiselinear function, accessed via e_MN().
The normals of the mesh are discontinuous at triangle boundaries, but the pressure can be meaningfully evaluated over the entire domain of the mesh.
When available, the values of ∇eₘ and ∇eₙ are represented as a discontinuous, piecewiseconstant function over the triangles – one vector per triangle. These quantities are accessed via EvaluateGradE_M_W() and EvaluateGradE_N_W(), respectively.
Barycentric Coordinates ————————
For Point Q on the surface mesh of the contact surface between Geometry M and Geometry N, r_WQ = (x,y,z) is the displacement vector from the origin of the world frame to Q expressed in the coordinate frame of W. We also have the barycentric coordinates (b0, b1, b2) on a triangle of the surface mesh that contains Q. With vertices of the triangle labeled as v₀, v₁, v₂, we can map (b0, b1, b2) to r_WQ by:
r_WQ = b0 * r_Wv₀ + b1 * r_Wv₁ + b2 * r_Wv₂, b0 + b1 + b2 = 1, bᵢ ∈ [0,1],
where r_Wvᵢ is the displacement vector of the vertex labeled as vᵢ from the origin of the world frame, expressed in the world frame.
We use the barycentric coordinates to evaluate the field values.

__init__
¶ Initialize self. See help(type(self)) for accurate signature.

id_M
(self: pydrake.geometry.ContactSurface_[float]) → pydrake.geometry.GeometryId¶ Returns the geometry id of Geometry M.

id_N
(self: pydrake.geometry.ContactSurface_[float]) → pydrake.geometry.GeometryId¶ Returns the geometry id of Geometry N.

mesh_W
(self: pydrake.geometry.ContactSurface_[float]) → pydrake.geometry.SurfaceMesh_[float]¶ Returns a reference to the surface mesh whose vertex positions are measured and expressed in the world frame.


class
pydrake.geometry.
Convex
¶ Bases:
pydrake.geometry.Shape
Support for convex shapes.

__init__
(self: pydrake.geometry.Convex, absolute_filename: str, scale: float = 1.0) → None¶ Constructs a convex shape specification from the file located at the given absolute file path. Optionally uniformly scaled by the given scale factor.
 Parameter
absolute_filename
:  The file name with absolute path. We only support an .obj file with only one polyhedron. We assume that the polyhedron is convex.
 Parameter
scale
:  An optional scale to coordinates.
Raises:  RuntimeError if the .obj file doesn’t define a single object. This
 can happen if it is empty, if there are multiple objectname
 statements (e.g., “o object_name”), or if there are faces defined
 outside a single objectname statement.
Raises:  RuntimeError if scale < 1e8. Note that a negative scale is
 considered valid. We want to preclude scales near zero but
 recognise that scale is a convenience tool for “tweaking” models.
 8 orders of magnitude should be plenty without considering
 revisiting the model itself.
 Parameter

filename
(self: pydrake.geometry.Convex) → str¶

scale
(self: pydrake.geometry.Convex) → float¶


class
pydrake.geometry.
Cylinder
¶ Bases:
pydrake.geometry.Shape
Definition of a cylinder. It is centered in its canonical frame with the length of the cylinder parallel with the frame’s zaxis.

__init__
(self: pydrake.geometry.Cylinder, radius: float, length: float) → None¶ Constructs a cylinder with the given
radius
andlength
.Raises:  RuntimeError if
radius
orlength
are not strictly positive.
 RuntimeError if

length
(self: pydrake.geometry.Cylinder) → float¶

radius
(self: pydrake.geometry.Cylinder) → float¶


pydrake.geometry.
DispatchLoadMessage
(scene_graph: drake::geometry::SceneGraph<double>, lcm: pydrake.lcm.DrakeLcmInterface, role: pydrake.geometry.Role = Role.kIllustration) → None¶ (Advanced) Explicitly dispatches an LCM load message based on the registered geometry. Normally this is done automatically at Simulator initialization. But if you have to do it yourself (likely because you are not using a Simulator), it should be invoked after registration is complete. Typically this is used after ConnectDrakeVisualizer() has been used to add visualization to the Diagram that contains the given
scene_graph
. The message goes to LCM channel “DRAKE_VIEWER_LOAD_ROBOT”.See also
geometry::ConnectDrakeVisualizer() */ (Deprecated.)
 Deprecated:
 Please use DrakeVisualizerd::SendLoadMessage(). This will be removed from Drake on or after 20210401.

pydrake.geometry.
DrakeVisualizer
¶

template
pydrake.geometry.
DrakeVisualizer_
¶ Instantiations:
DrakeVisualizer_[float]
,DrakeVisualizer_[AutoDiffXd]

class
DrakeVisualizer_[float]
¶ Bases:
pydrake.systems.framework.LeafSystem_[float]
A system that publishes LCM messages compatible with the
drake_visualizer
application representing the current state of a SceneGraph instance (whose QueryObjectvalued output port is connected to this system’s input port).query_object→ DrakeVisualizer The DrakeVisualizer system broadcasts two kinds of LCM messages:
 a message that defines the geometry in the world on the lcm channel named
“DRAKE_VIEWER_DRAW”,  a message that updates the poses of those geometries on the lcm channel named “DRAKE_VIEWER_LOAD_ROBOT”
The system uses the versioning mechanism provided by SceneGraph to detect changes to the geometry so that a change in SceneGraph’s data will propagate to
drake_visualizer
.Visualization by Role
By default, DrakeVisualizer visualizes geometries with the illustration role (see geometry_roles for more details). It can be configured to visualize geometries with other roles (see DrakeVisualizerParams). Only one role can be specified.
The appearance of the geometry in the visualizer is typically defined by the the geometry’s properties for the visualized role.
 For the visualized role, if a geometry has the (“phong”, “diffuse”)
property described in the table below, that value is used.  Otherwise, if the geometry also has the illustration properties, those properties are likewise tested for the (“phong”, “diffuse”) property. This rule only has significance is the visualized role is not the illustration role.  Otherwise, the configured default color will be applied (see DrakeVisualizerParams).
Group name  Required  Property Name  Property Type  PropertyDescription   :——–:  :——:  :———–:  :————:  :——————   phong  no  diffuse  Rgba  The rgba value of the object surface. 
Appearance of OBJ files
Meshes represented by OBJ are special. The OBJ file can reference a material file (.mtl). If found by
drake_visualizer
, the values in the .mtl will take precedence over the (“phong”, “diffuse”) geometry property.It’s worth emphasizing that these rules permits control over the appearance of collision geometry on a pergeometry basis by assigning an explicit Rgba value to the (“phong”, “diffuse”) property in the geometry’s ProximityProperties.
Note
If collision geometries are added to SceneGraph by parsing URDF/SDF files, they will not have diffuse values. Even if elements were added to the specification files, they would not be parsed. They must be added to the geometries after parsing.
Effective visualization
The best visualization is when draw messages have been preceded by a compatible load message (i.e., a “coherent” message sequence). While LCM doesn’t guarantee that messages will be received/processed in the same order as they are broadcast, your results will be best if DrakeVisualizer is allowed to broadcast coherent messages. Practices that interfere with that will likely produce undesirable results. E.g.,
 Evaluating a single instance of DrakeVisualizer across several threads,
such that the data in the perthread systems::Context varies.  Evaluating multiple instances of DrakeVisualizer in a single thread that share the same lcm::DrakeLcmInterface.
Scalar support and conversion
DrakeVisualizer is templated on
T
and can be used in adouble
 or AutoDiffXdvalued Diagram. However, the diagram can only be converted from one scalar type to another if the DrakeVisualizer owns its lcm::DrakeLcmInterface instance. Attempts to scalar convert the system otherwise will throw an exception.
__init__
(self: pydrake.geometry.DrakeVisualizer_[float], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0fdf0>) → None¶ Creates an instance of DrakeVisualizer.
 Parameter
lcm
:  An optional LCM interface. If none is provided, this system will allocate its own instance. If one is provided it must remain valid for the lifetime of this object.
 Parameter
params
:  The set of parameters to control this system’s behavior.
Raises: RuntimeError if params.publish_period <= 0
.Raises: RuntimeError if params.role == Role::kUnassigned
. Parameter

static
AddToBuilder
(*args, **kwargs)¶ Overloaded function.
 AddToBuilder(builder: pydrake.systems.framework.DiagramBuilder_[float], scene_graph: pydrake.geometry.SceneGraph_[float], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0fe70>) > pydrake.geometry.DrakeVisualizer_[float]
Connects the newly added DrakeVisualizer to the given SceneGraph’s QueryObjectvalued output port.
 AddToBuilder(builder: pydrake.systems.framework.DiagramBuilder_[float], query_object_port: pydrake.systems.framework.OutputPort_[float], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0faf0>) > pydrake.geometry.DrakeVisualizer_[float]
Connects the newly added DrakeVisualizer to the given QueryObjectvalued output port.

static
DispatchLoadMessage
(scene_graph: pydrake.geometry.SceneGraph_[float], lcm: pydrake.lcm.DrakeLcmInterface, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0f930>) → None¶ (Advanced) Dispatches a load message built on the model geometry for the given SceneGraph instance. This should be used sparingly. When we have a starightforward method for binding lcmtypes in python, this will be replaced with an API that will simply generate the lcm messages that the caller can then do whatever they like with.
 Precondition:
lcm != nullptr
.

query_object_input_port
(self: pydrake.geometry.DrakeVisualizer_[float]) → pydrake.systems.framework.InputPort_[float]¶ Returns the QueryObjectvalued input port. It should be connected to SceneGraph’s QueryObjectvalued output port. Failure to do so will cause a runtime error when attempting to broadcast messages.

class

class
pydrake.geometry.
DrakeVisualizer_[AutoDiffXd]
¶ Bases:
pydrake.systems.framework.LeafSystem_[AutoDiffXd]
A system that publishes LCM messages compatible with the
drake_visualizer
application representing the current state of a SceneGraph instance (whose QueryObjectvalued output port is connected to this system’s input port).query_object→ DrakeVisualizer The DrakeVisualizer system broadcasts two kinds of LCM messages:
 a message that defines the geometry in the world on the lcm channel named
“DRAKE_VIEWER_DRAW”,  a message that updates the poses of those geometries on the lcm channel named “DRAKE_VIEWER_LOAD_ROBOT”
The system uses the versioning mechanism provided by SceneGraph to detect changes to the geometry so that a change in SceneGraph’s data will propagate to
drake_visualizer
.Visualization by Role
By default, DrakeVisualizer visualizes geometries with the illustration role (see geometry_roles for more details). It can be configured to visualize geometries with other roles (see DrakeVisualizerParams). Only one role can be specified.
The appearance of the geometry in the visualizer is typically defined by the the geometry’s properties for the visualized role.
 For the visualized role, if a geometry has the (“phong”, “diffuse”)
property described in the table below, that value is used.  Otherwise, if the geometry also has the illustration properties, those properties are likewise tested for the (“phong”, “diffuse”) property. This rule only has significance is the visualized role is not the illustration role.  Otherwise, the configured default color will be applied (see DrakeVisualizerParams).
Group name  Required  Property Name  Property Type  PropertyDescription   :——–:  :——:  :———–:  :————:  :——————   phong  no  diffuse  Rgba  The rgba value of the object surface. 
Appearance of OBJ files
Meshes represented by OBJ are special. The OBJ file can reference a material file (.mtl). If found by
drake_visualizer
, the values in the .mtl will take precedence over the (“phong”, “diffuse”) geometry property.It’s worth emphasizing that these rules permits control over the appearance of collision geometry on a pergeometry basis by assigning an explicit Rgba value to the (“phong”, “diffuse”) property in the geometry’s ProximityProperties.
Note
If collision geometries are added to SceneGraph by parsing URDF/SDF files, they will not have diffuse values. Even if elements were added to the specification files, they would not be parsed. They must be added to the geometries after parsing.
Effective visualization
The best visualization is when draw messages have been preceded by a compatible load message (i.e., a “coherent” message sequence). While LCM doesn’t guarantee that messages will be received/processed in the same order as they are broadcast, your results will be best if DrakeVisualizer is allowed to broadcast coherent messages. Practices that interfere with that will likely produce undesirable results. E.g.,
 Evaluating a single instance of DrakeVisualizer across several threads,
such that the data in the perthread systems::Context varies.  Evaluating multiple instances of DrakeVisualizer in a single thread that share the same lcm::DrakeLcmInterface.
Scalar support and conversion
DrakeVisualizer is templated on
T
and can be used in adouble
 or AutoDiffXdvalued Diagram. However, the diagram can only be converted from one scalar type to another if the DrakeVisualizer owns its lcm::DrakeLcmInterface instance. Attempts to scalar convert the system otherwise will throw an exception.
__init__
(self: pydrake.geometry.DrakeVisualizer_[AutoDiffXd], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2137dc7a70>) → None¶ Creates an instance of DrakeVisualizer.
 Parameter
lcm
:  An optional LCM interface. If none is provided, this system will allocate its own instance. If one is provided it must remain valid for the lifetime of this object.
 Parameter
params
:  The set of parameters to control this system’s behavior.
Raises: RuntimeError if params.publish_period <= 0
.Raises: RuntimeError if params.role == Role::kUnassigned
. Parameter

static
AddToBuilder
(*args, **kwargs)¶ Overloaded function.
 AddToBuilder(builder: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], scene_graph: pydrake.geometry.SceneGraph_[AutoDiffXd], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0fd30>) > pydrake.geometry.DrakeVisualizer_[AutoDiffXd]
Connects the newly added DrakeVisualizer to the given SceneGraph’s QueryObjectvalued output port.
 AddToBuilder(builder: pydrake.systems.framework.DiagramBuilder_[AutoDiffXd], query_object_port: pydrake.systems.framework.OutputPort_[AutoDiffXd], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0fdb0>) > pydrake.geometry.DrakeVisualizer_[AutoDiffXd]
Connects the newly added DrakeVisualizer to the given QueryObjectvalued output port.

static
DispatchLoadMessage
(scene_graph: pydrake.geometry.SceneGraph_[AutoDiffXd], lcm: pydrake.lcm.DrakeLcmInterface, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0fd70>) → None¶ (Advanced) Dispatches a load message built on the model geometry for the given SceneGraph instance. This should be used sparingly. When we have a starightforward method for binding lcmtypes in python, this will be replaced with an API that will simply generate the lcm messages that the caller can then do whatever they like with.
 Precondition:
lcm != nullptr
.

query_object_input_port
(self: pydrake.geometry.DrakeVisualizer_[AutoDiffXd]) → pydrake.systems.framework.InputPort_[AutoDiffXd]¶ Returns the QueryObjectvalued input port. It should be connected to SceneGraph’s QueryObjectvalued output port. Failure to do so will cause a runtime error when attempting to broadcast messages.

class
pydrake.geometry.
DrakeVisualizer_[float]
¶ Bases:
pydrake.systems.framework.LeafSystem_[float]
A system that publishes LCM messages compatible with the
drake_visualizer
application representing the current state of a SceneGraph instance (whose QueryObjectvalued output port is connected to this system’s input port).query_object→ DrakeVisualizer The DrakeVisualizer system broadcasts two kinds of LCM messages:
 a message that defines the geometry in the world on the lcm channel named
“DRAKE_VIEWER_DRAW”,  a message that updates the poses of those geometries on the lcm channel named “DRAKE_VIEWER_LOAD_ROBOT”
The system uses the versioning mechanism provided by SceneGraph to detect changes to the geometry so that a change in SceneGraph’s data will propagate to
drake_visualizer
.Visualization by Role
By default, DrakeVisualizer visualizes geometries with the illustration role (see geometry_roles for more details). It can be configured to visualize geometries with other roles (see DrakeVisualizerParams). Only one role can be specified.
The appearance of the geometry in the visualizer is typically defined by the the geometry’s properties for the visualized role.
 For the visualized role, if a geometry has the (“phong”, “diffuse”)
property described in the table below, that value is used.  Otherwise, if the geometry also has the illustration properties, those properties are likewise tested for the (“phong”, “diffuse”) property. This rule only has significance is the visualized role is not the illustration role.  Otherwise, the configured default color will be applied (see DrakeVisualizerParams).
Group name  Required  Property Name  Property Type  PropertyDescription   :——–:  :——:  :———–:  :————:  :——————   phong  no  diffuse  Rgba  The rgba value of the object surface. 
Appearance of OBJ files
Meshes represented by OBJ are special. The OBJ file can reference a material file (.mtl). If found by
drake_visualizer
, the values in the .mtl will take precedence over the (“phong”, “diffuse”) geometry property.It’s worth emphasizing that these rules permits control over the appearance of collision geometry on a pergeometry basis by assigning an explicit Rgba value to the (“phong”, “diffuse”) property in the geometry’s ProximityProperties.
Note
If collision geometries are added to SceneGraph by parsing URDF/SDF files, they will not have diffuse values. Even if elements were added to the specification files, they would not be parsed. They must be added to the geometries after parsing.
Effective visualization
The best visualization is when draw messages have been preceded by a compatible load message (i.e., a “coherent” message sequence). While LCM doesn’t guarantee that messages will be received/processed in the same order as they are broadcast, your results will be best if DrakeVisualizer is allowed to broadcast coherent messages. Practices that interfere with that will likely produce undesirable results. E.g.,
 Evaluating a single instance of DrakeVisualizer across several threads,
such that the data in the perthread systems::Context varies.  Evaluating multiple instances of DrakeVisualizer in a single thread that share the same lcm::DrakeLcmInterface.
Scalar support and conversion
DrakeVisualizer is templated on
T
and can be used in adouble
 or AutoDiffXdvalued Diagram. However, the diagram can only be converted from one scalar type to another if the DrakeVisualizer owns its lcm::DrakeLcmInterface instance. Attempts to scalar convert the system otherwise will throw an exception.
__init__
(self: pydrake.geometry.DrakeVisualizer_[float], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0fdf0>) → None¶ Creates an instance of DrakeVisualizer.
 Parameter
lcm
:  An optional LCM interface. If none is provided, this system will allocate its own instance. If one is provided it must remain valid for the lifetime of this object.
 Parameter
params
:  The set of parameters to control this system’s behavior.
Raises: RuntimeError if params.publish_period <= 0
.Raises: RuntimeError if params.role == Role::kUnassigned
. Parameter

static
AddToBuilder
(*args, **kwargs)¶ Overloaded function.
 AddToBuilder(builder: pydrake.systems.framework.DiagramBuilder_[float], scene_graph: pydrake.geometry.SceneGraph_[float], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0fe70>) > pydrake.geometry.DrakeVisualizer_[float]
Connects the newly added DrakeVisualizer to the given SceneGraph’s QueryObjectvalued output port.
 AddToBuilder(builder: pydrake.systems.framework.DiagramBuilder_[float], query_object_port: pydrake.systems.framework.OutputPort_[float], lcm: pydrake.lcm.DrakeLcmInterface = None, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0faf0>) > pydrake.geometry.DrakeVisualizer_[float]
Connects the newly added DrakeVisualizer to the given QueryObjectvalued output port.

static
DispatchLoadMessage
(scene_graph: pydrake.geometry.SceneGraph_[float], lcm: pydrake.lcm.DrakeLcmInterface, params: pydrake.geometry.DrakeVisualizerParams = <pydrake.geometry.DrakeVisualizerParams object at 0x7f2147f0f930>) → None¶ (Advanced) Dispatches a load message built on the model geometry for the given SceneGraph instance. This should be used sparingly. When we have a starightforward method for binding lcmtypes in python, this will be replaced with an API that will simply generate the lcm messages that the caller can then do whatever they like with.
 Precondition:
lcm != nullptr
.

query_object_input_port
(self: pydrake.geometry.DrakeVisualizer_[float]) → pydrake.systems.framework.InputPort_[float]¶ Returns the QueryObjectvalued input port. It should be connected to SceneGraph’s QueryObjectvalued output port. Failure to do so will cause a runtime error when attempting to broadcast messages.

class
pydrake.geometry.
DrakeVisualizerParams
¶ The set of parameters for configuring DrakeVisualizer.

__init__
(self: pydrake.geometry.DrakeVisualizerParams, **kwargs) → None¶

default_color
¶ The color to apply to any geometry that hasn’t defined one.

publish_period
¶ The duration (in seconds) between published LCM messages that update the poses of the scene’s geometry.

role
¶


class
pydrake.geometry.
Ellipsoid
¶ Bases:
pydrake.geometry.Shape
Definition of an ellipsoid. It is centered on the origin of its canonical frame with its dimensions aligned with the frame’s axes. The standard equation for the ellipsoid is:
x²/a² + y²/b² + z²/c² = 1, where a,b,c are the lengths of the principal semiaxes of the ellipsoid. The bounding box of the ellipsoid is [a,a]x[b,b]x[c,c].

__init__
(self: pydrake.geometry.Ellipsoid, a: float, b: float, c: float) → None¶ Constructs an ellipsoid with the given lengths of its principal semiaxes.
Raises: RuntimeError if a
, b, orc
are not strictly positive.

a
(self: pydrake.geometry.Ellipsoid) → float¶

b
(self: pydrake.geometry.Ellipsoid) → float¶

c
(self: pydrake.geometry.Ellipsoid) → float¶


class
pydrake.geometry.
FrameId
¶ Type used to identify geometry frames in SceneGraph.

__init__
¶ Initialize self. See help(type(self)) for accurate signature.

static
get_new_id
() → pydrake.geometry.FrameId¶ 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.FrameId) → 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.FrameId) → bool¶ Reports if the id is valid.


pydrake.geometry.
FramePoseVector
¶

template
pydrake.geometry.
FramePoseVector_
¶ Instantiations:
FramePoseVector_[float]
,FramePoseVector_[AutoDiffXd]

class
FramePoseVector_[float]
¶ A FrameKinematicsVector is used to report kinematics data for registered frames (identified by unique FrameId values) to SceneGraph. It serves as the basis of FramePoseVector, FrameVelocityVector, and FrameAccelerationVector.
template <typename T> class MySystem : public LeafSystem<T> { public: MySystem() { ... this>DeclareAbstractOutputPort( &AllocInConstructorSystem::CalcFramePoseOutput); ... } private: void CalcFramePoseOutput(const Context<T>& context, geometry::FramePoseVector<T>* poses) const { poses>clear(); for (int i = 0; i < static_cast<int>(frame_ids_.size()); ++i) { poses>set_value(frame_ids_[i], poses_[i]); } } std::vector<FrameId> frame_ids_; std::vector<RigidTransform<T>> poses_; };
If a System only ever emits a single frame (or smallconstantnumber of frames), then there’s a shorter alternative way to write a Calc method, using an initializer_list:
void CalcFramePoseOutput(const Context<T>& context, geometry::FramePoseVector<T>* poses) const { const RigidTransform<T>& pose = ...; poses = {{frame_id_, pose}}; }
N.B. When the systems framework calls the
Calc
method, the value pointed to byposes
is in an unspecified state. The implementation ofCalc
must always ensure thatposes
contains the correct value upon return, no matter what value it started with. The easy ways to do this are to call eitherposes>clear()
or the assignment operator*poses = ...
. Template parameter
KinematicsValue
:  The underlying data type of for the order of kinematics data (e.g., pose, velocity, or acceleration).
One should never interact with the FrameKinematicsVector class directly. Instead, the FramePoseVector, FrameVelocityVector, and FrameAccelerationVector classes are aliases of the FrameKinematicsVector instantiated on specific data types (RigidTransform, SpatialVector, and SpatialAcceleration, respectively). Each of these data types are templated on Eigen scalars. All supported combinations of data type and scalar type are already available to link against in the containing library. No other values for KinematicsValue are supported.
Currently, the following data types with the following scalar types are supported:
Alias  Instantiation  Scalar types —————–———— FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  double FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  AutoDiffXd FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  Expression

__init__
(self: pydrake.geometry.FramePoseVector_[float]) → None¶ Initializes the vector using an invalid SourceId with no frames .

clear
(self: pydrake.geometry.FramePoseVector_[float]) → None¶ Clears all values, resetting the size to zero.

frame_ids
(self: pydrake.geometry.FramePoseVector_[float]) → List[pydrake.geometry.FrameId]¶ Provides a range object for all of the frame ids in the vector. This is intended to be used as:
for (FrameId id : this_vector.frame_ids()) { ... // Obtain the KinematicsValue of an id by ``this_vector.value(id)`` ... }

has_id
(self: pydrake.geometry.FramePoseVector_[float], id: pydrake.geometry.FrameId) → bool¶ Reports true if the given id is a member of this data.

set_value
(self: pydrake.geometry.FramePoseVector_[float], id: pydrake.geometry.FrameId, value: pydrake.math.RigidTransform_[float]) → None¶ Sets the kinematics
value
for the frame indicated by the givenid
.

size
(self: pydrake.geometry.FramePoseVector_[float]) → int¶ Returns number of frame_ids().

value
(self: pydrake.geometry.FramePoseVector_[float], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[float]¶ Returns the value associated with the given
id
.Raises: RuntimeError if id
is not in the specified set of ids.
 Template parameter

class

class
pydrake.geometry.
FramePoseVector_[AutoDiffXd]
¶ A FrameKinematicsVector is used to report kinematics data for registered frames (identified by unique FrameId values) to SceneGraph. It serves as the basis of FramePoseVector, FrameVelocityVector, and FrameAccelerationVector.
template <typename T> class MySystem : public LeafSystem<T> { public: MySystem() { ... this>DeclareAbstractOutputPort( &AllocInConstructorSystem::CalcFramePoseOutput); ... } private: void CalcFramePoseOutput(const Context<T>& context, geometry::FramePoseVector<T>* poses) const { poses>clear(); for (int i = 0; i < static_cast<int>(frame_ids_.size()); ++i) { poses>set_value(frame_ids_[i], poses_[i]); } } std::vector<FrameId> frame_ids_; std::vector<RigidTransform<T>> poses_; };
If a System only ever emits a single frame (or smallconstantnumber of frames), then there’s a shorter alternative way to write a Calc method, using an initializer_list:
void CalcFramePoseOutput(const Context<T>& context, geometry::FramePoseVector<T>* poses) const { const RigidTransform<T>& pose = ...; poses = {{frame_id_, pose}}; }
N.B. When the systems framework calls the
Calc
method, the value pointed to byposes
is in an unspecified state. The implementation ofCalc
must always ensure thatposes
contains the correct value upon return, no matter what value it started with. The easy ways to do this are to call eitherposes>clear()
or the assignment operator*poses = ...
. Template parameter
KinematicsValue
:  The underlying data type of for the order of kinematics data (e.g., pose, velocity, or acceleration).
One should never interact with the FrameKinematicsVector class directly. Instead, the FramePoseVector, FrameVelocityVector, and FrameAccelerationVector classes are aliases of the FrameKinematicsVector instantiated on specific data types (RigidTransform, SpatialVector, and SpatialAcceleration, respectively). Each of these data types are templated on Eigen scalars. All supported combinations of data type and scalar type are already available to link against in the containing library. No other values for KinematicsValue are supported.
Currently, the following data types with the following scalar types are supported:
Alias  Instantiation  Scalar types —————–———— FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  double FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  AutoDiffXd FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  Expression

__init__
(self: pydrake.geometry.FramePoseVector_[AutoDiffXd]) → None¶ Initializes the vector using an invalid SourceId with no frames .

clear
(self: pydrake.geometry.FramePoseVector_[AutoDiffXd]) → None¶ Clears all values, resetting the size to zero.

frame_ids
(self: pydrake.geometry.FramePoseVector_[AutoDiffXd]) → List[pydrake.geometry.FrameId]¶ Provides a range object for all of the frame ids in the vector. This is intended to be used as:
for (FrameId id : this_vector.frame_ids()) { ... // Obtain the KinematicsValue of an id by ``this_vector.value(id)`` ... }

has_id
(self: pydrake.geometry.FramePoseVector_[AutoDiffXd], id: pydrake.geometry.FrameId) → bool¶ Reports true if the given id is a member of this data.

set_value
(self: pydrake.geometry.FramePoseVector_[AutoDiffXd], id: pydrake.geometry.FrameId, value: pydrake.math.RigidTransform_[AutoDiffXd]) → None¶ Sets the kinematics
value
for the frame indicated by the givenid
.

size
(self: pydrake.geometry.FramePoseVector_[AutoDiffXd]) → int¶ Returns number of frame_ids().

value
(self: pydrake.geometry.FramePoseVector_[AutoDiffXd], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[AutoDiffXd]¶ Returns the value associated with the given
id
.Raises: RuntimeError if id
is not in the specified set of ids.
 Template parameter

class
pydrake.geometry.
FramePoseVector_[float]
¶ A FrameKinematicsVector is used to report kinematics data for registered frames (identified by unique FrameId values) to SceneGraph. It serves as the basis of FramePoseVector, FrameVelocityVector, and FrameAccelerationVector.
template <typename T> class MySystem : public LeafSystem<T> { public: MySystem() { ... this>DeclareAbstractOutputPort( &AllocInConstructorSystem::CalcFramePoseOutput); ... } private: void CalcFramePoseOutput(const Context<T>& context, geometry::FramePoseVector<T>* poses) const { poses>clear(); for (int i = 0; i < static_cast<int>(frame_ids_.size()); ++i) { poses>set_value(frame_ids_[i], poses_[i]); } } std::vector<FrameId> frame_ids_; std::vector<RigidTransform<T>> poses_; };
If a System only ever emits a single frame (or smallconstantnumber of frames), then there’s a shorter alternative way to write a Calc method, using an initializer_list:
void CalcFramePoseOutput(const Context<T>& context, geometry::FramePoseVector<T>* poses) const { const RigidTransform<T>& pose = ...; poses = {{frame_id_, pose}}; }
N.B. When the systems framework calls the
Calc
method, the value pointed to byposes
is in an unspecified state. The implementation ofCalc
must always ensure thatposes
contains the correct value upon return, no matter what value it started with. The easy ways to do this are to call eitherposes>clear()
or the assignment operator*poses = ...
. Template parameter
KinematicsValue
:  The underlying data type of for the order of kinematics data (e.g., pose, velocity, or acceleration).
One should never interact with the FrameKinematicsVector class directly. Instead, the FramePoseVector, FrameVelocityVector, and FrameAccelerationVector classes are aliases of the FrameKinematicsVector instantiated on specific data types (RigidTransform, SpatialVector, and SpatialAcceleration, respectively). Each of these data types are templated on Eigen scalars. All supported combinations of data type and scalar type are already available to link against in the containing library. No other values for KinematicsValue are supported.
Currently, the following data types with the following scalar types are supported:
Alias  Instantiation  Scalar types —————–———— FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  double FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  AutoDiffXd FramePoseVector  FrameKinematicsVector<RigidTransform<Scalar>>  Expression

__init__
(self: pydrake.geometry.FramePoseVector_[float]) → None¶ Initializes the vector using an invalid SourceId with no frames .

clear
(self: pydrake.geometry.FramePoseVector_[float]) → None¶ Clears all values, resetting the size to zero.

frame_ids
(self: pydrake.geometry.FramePoseVector_[float]) → List[pydrake.geometry.FrameId]¶ Provides a range object for all of the frame ids in the vector. This is intended to be used as:
for (FrameId id : this_vector.frame_ids()) { ... // Obtain the KinematicsValue of an id by ``this_vector.value(id)`` ... }

has_id
(self: pydrake.geometry.FramePoseVector_[float], id: pydrake.geometry.FrameId) → bool¶ Reports true if the given id is a member of this data.

set_value
(self: pydrake.geometry.FramePoseVector_[float], id: pydrake.geometry.FrameId, value: pydrake.math.RigidTransform_[float]) → None¶ Sets the kinematics
value
for the frame indicated by the givenid
.

size
(self: pydrake.geometry.FramePoseVector_[float]) → int¶ Returns number of frame_ids().

value
(self: pydrake.geometry.FramePoseVector_[float], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[float]¶ Returns the value associated with the given
id
.Raises: RuntimeError if id
is not in the specified set of ids.
 Template parameter

class
pydrake.geometry.
GeometryFrame
¶ This simple class carries the definition of a frame used in the SceneGraph. To register moving frames with SceneGraph (see SceneGraph::RegisterFrame()), a geometry source (see SceneGraph::RegisterSource()) instantiates a frame and passes ownership over to SceneGraph.
A frame is defined by two pieces of information:
 the name, which must be unique within a single geometry source and
 the “frame group”, an integer identifier that can be used to group frames
together within a geometry source.
The “frame group” is intended as a generic synonym for the model instance id defined by the RigidBodyTree.
See also
SceneGraph

__init__
(self: pydrake.geometry.GeometryFrame, frame_name: str, frame_group_id: int = 0) → None¶ Constructor.
 Parameter
frame_name
:  The name of the frame.
 Parameter
frame_group_id
:  The optional frame group identifier. If unspecified, defaults to the common, 0 group. Must be nonnegative.
 Parameter

frame_group
(self: pydrake.geometry.GeometryFrame) → int¶

id
(self: pydrake.geometry.GeometryFrame) → pydrake.geometry.FrameId¶ Returns the globally unique id for this geometry specification. Every instantiation of FrameInstance will contain a unique id value. The id value is preserved across copies. After successfully registering this FrameInstance, this id will serve as the identifier for the registered representation as well.

name
(self: pydrake.geometry.GeometryFrame) → str¶

class
pydrake.geometry.
GeometryId
¶ Type used to identify geometry instances in SceneGraph.

__init__
¶ Initialize self. See help(type(self)) for accurate signature.

static
get_new_id
() → pydrake.geometry.GeometryId¶ 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.GeometryId) → 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.GeometryId) → bool¶ Reports if the id is valid.


class
pydrake.geometry.
GeometryInstance
¶ A geometry instance combines a geometry definition (i.e., a shape of some sort), a pose (relative to a parent “frame” P), material information, and an opaque collection of metadata. The parent frame can be a registered frame or another registered geometry.
Every GeometryInstance must be named. The naming convention mirrors that of valid names in SDF files. Specifically, any userspecified name will have all leading and trailing space and tab characters trimmed off. The trimmed name will have to satisfy the following requirements:
 cannot be empty, and
 the name should be unique in the scope of its frame and role. For example,
two GeometryInstances can both be called “ball” as long as they are affixed to different frames or if one is a collision geometry and the other is an illustration geometry. This is enforced when a role is assigned to the geometry.
If valid, the trimmed name will be assigned to the instance.
Names can have internal whitespace (e.g., “my geometry name”).
Canonicalized names
The silent transformation of a userdefined name to canonical name mirrors that of specifying geometry names in an SDF file. Consider the following SDF snippet:
{xml} ... <visual name=" visual"> <geometry> <sphere> <radius>1.0</radius> </sphere> </geometry> </visual> ...
The name has two leading whitespace characters. The parsing process will consider this name as equivalent to “visual” and tests for uniqueness and nonemptiness will be applied to that trimmed result. The following code has an analogous effect:
scene_graph>RegisterGeometry( source_id, frame_id, make_unique<GeometryInstance>(pose, make_unique<Sphere>(1.0), " visual"));
The specified name includes leading whitespace. That name will be trimmed and the result will be stored in the GeometryInstance (to be later validated by SceneGraph as part of geometry registration). Querying the instance of its name will return this canonicalized name.

__init__
(self: pydrake.geometry.GeometryInstance, X_PG: pydrake.math.RigidTransform_[float], shape: pydrake.geometry.Shape, name: str) → None¶ Constructs a geometry instance specification.
 Parameter
X_PG
:  The pose of this geometry (
G
) in its parent’s frame (P
).  Parameter
shape
:  The underlying shape for this geometry instance.
 Parameter
name
:  The name of the geometry (must satisfy the name requirements).
Raises: RuntimeError if the canonicalized version of name
is empty. Parameter

id
(self: pydrake.geometry.GeometryInstance) → pydrake.geometry.GeometryId¶ Returns the globally unique id for this geometry specification. Every instantiation of GeometryInstance will contain a unique id value. The id value is preserved across copies. After successfully registering this GeometryInstance, this id will serve as the identifier for the registered representation as well.

illustration_properties
(self: pydrake.geometry.GeometryInstance) → drake::geometry::IllustrationProperties¶ Returns a pointer to the geometry’s const illustration properties (if they are defined). Nullptr otherwise.

mutable_illustration_properties
(self: pydrake.geometry.GeometryInstance) → drake::geometry::IllustrationProperties¶ Returns a pointer to the geometry’s mutable illustration properties (if they are defined). Nullptr otherwise.

mutable_perception_properties
(self: pydrake.geometry.GeometryInstance) → drake::geometry::PerceptionProperties¶ Returns a pointer to the geometry’s mutable perception properties (if they are defined). Nullptr otherwise.

mutable_proximity_properties
(self: pydrake.geometry.GeometryInstance) → drake::geometry::ProximityProperties¶ Returns a pointer to the geometry’s mutable proximity properties (if they are defined). Nullptr otherwise.

name
(self: pydrake.geometry.GeometryInstance) → str¶ Returns the canonicalized name for the instance.
See also
canonicalized_geometry_names “Canonicalized names”

perception_properties
(self: pydrake.geometry.GeometryInstance) → drake::geometry::PerceptionProperties¶ Returns a pointer to the geometry’s const perception properties (if they are defined). Nullptr otherwise.

pose
(self: pydrake.geometry.GeometryInstance) → pydrake.math.RigidTransform_[float]¶ Returns the instance geometry’s pose in its parent frame.

proximity_properties
(self: pydrake.geometry.GeometryInstance) → drake::geometry::ProximityProperties¶ Returns a pointer to the geometry’s const proximity properties (if they are defined). Nullptr otherwise.

release_shape
(self: pydrake.geometry.GeometryInstance) → pydrake.geometry.Shape¶ Releases the shape from the instance.

set_illustration_properties
(self: pydrake.geometry.GeometryInstance, properties: drake::geometry::IllustrationProperties) → None¶ Sets the illustration properties for the given instance.

set_name
(self: pydrake.geometry.GeometryInstance, arg0: str) → None¶ Sets the canonicalized name for the instance.
See also
canonicalized_geometry_names “Canonicalized names”

set_perception_properties
(self: pydrake.geometry.GeometryInstance, properties: drake::geometry::PerceptionProperties) → None¶ Sets the perception properties for the given instance.

set_pose
(self: pydrake.geometry.GeometryInstance, X_PG: pydrake.math.RigidTransform_[float]) → None¶ Sets the pose of this instance in its parent’s frame.

set_proximity_properties
(self: pydrake.geometry.GeometryInstance, properties: drake::geometry::ProximityProperties) → None¶ Sets the proximity properties for the given instance.

shape
(self: pydrake.geometry.GeometryInstance) → pydrake.geometry.Shape¶

class
pydrake.geometry.
GeometryProperties
¶ The base class for defining a set of geometry properties.
Each property consists of a
(group, property)
namepair and a typed value. The name pair allows for reuse of common property names (e.g., “diffuse”) to be differentiated in interpretation by associating them with different groups. The only restriction on the value type is that it must be either cloneable or copyconstructible.A set of geometry property values are defined when geometry is registered with SceneGraph by an instantiator and accessed by some downstream consumer entity. Each consumer specifies what properties it expects to find and what default values (if any) it provides. For example, the consumer could document that a particular property is always required and its absence would throw an exception. Alternatively, it could indicate that a property is optional and a default value will be used in its absence. It is the responsibility of the instantiator to make sure that the geometry property values are correctly defined according to the expected consumer’s specification. Correctness includes such issues as keyvalue pairs placed into a correctlyspelled group, property keys being likewise correctly spelled, and values of the expected type. Correct spelling includes correct case. The instantiator uses the AddProperty() method to add new properties to the set.
To read the property (
some_group
, some_property) from a property set:1. Optionally test to see if the property exists by confirming the group
some_group
is in the set via HasGroup() and that the propertysome_property
is insome_group
via HasProperty(). Attempting to access a property with a nonexistent (group, property) pair may lead to an exception (see API documentation below). 2. Acquire a property value via the GetProperty() or GetPropertyOrDefault() methods. NOTE: Reading a property requires a compiletime declaration of the type of value being read. If the stored value is of a different type, an exception will be thrown.The following examples outline a number of ways to create and consume geometry properties. By design, GeometryProperties cannot be constructed, copied, or moved directly. Only derived classes can do so. This facilitates strongly typed sets of properties associated with particular geometry roles. So, for these examples we’ll exercise the derived class associated with proximity queries: ProximityProperties.
The stringbased structure of GeometryProperties provides a great deal of flexibility at the cost of spelling sensitivity. It would be easy to introduce typos that would then “hide” property values in some group a consumer wouldn’t look. In these examples, we avoid using string literals as group or property names (at least in the cases where the same name is used multiple times) to help avoid the possibility of typoinduced errors. That is not required and certainly not the only way to avoid such bugs.
Creating properties
Creating properties in a new group
This is a simple example in which a single group is added with properties of various types.
const std::string group_name("my_group"); ProximityProperties properties; // This first invocation implicitly creates the group "my_group". properties.AddProperty(group_name, "count", 7); // int type properties.AddProperty(group_name, "length", 7.); // double type properties.AddProperty(group_name, "name", "7"); // std::string type
Creating properties in the default group
Similar to the previous examples, the properties are added to the default group. Just be aware that if multiple sites in your code add properties to the default group, the possibility that names get repeated increases. Property names must be unique within a single group, including the default group.
ProximityProperties properties; properties.AddProperty(ProximityProperties::default_group_name(), "count", 7); properties.AddProperty(ProximityProperties::default_group_name(), "width", 7.); properties.AddProperty(ProximityProperties::default_group_name(), "name", "7");
Aggregate properties in a struct
In some cases, there is a set of values that will always be accessed together (specified with coordinated semantics). In these cases, it makes sense to aggregate them into a struct and store that as a single value. This reduces the number of lookups required.
It’s worth noting, that if the data value is a struct, calls to GetPropertyOrDefault() still operate as an “allornothing” basis. If the property struct exists, it will be returned, if it’s missing the default struct will be returned. There is no concept of a “partial” struct in which some undefined values in the struct will be replaced with their corresponding values in the default struct.
struct MyData { int i{}; double d{}; std::string s; }; ProximityProperties properties; const std::string group_name("my_group"); MyData data{7, 7., "7"}; properties.AddProperty(group_name, "data1", data); // These alternate forms are also acceptable (but not in succession, as the // property name has already been used by the first invocation). properties.AddProperty(group_name, "data2", MyData{6, 6., "6"}); properties.AddProperty<MyData>(group_name, "data2", {6, 6., "6"});
Reading properties
This section describes how to read properties under several different scenarios: (a) when specific properties are required, (b) when the consumer provides a default value for missing properties, and (c) when the consumer needs to inspect what properties are available.
Look up specific, *required properties*
In this case, the consumer of the properties is looking for one or more specific properties. It will ignore any other properties. More particularly, if those properties are missing, it is considered a runtime error and an exception is thrown.
The error can be handled in one of two ways: simply let the generic exception generated by GeometryProperties propagate upward, or detect the missing property and throw an exception with a custom message. The example below shows both approaches.
const IllustrationProperties& properties = FunctionThatReturnsProperties(); // Looking for a Rgba of rgba colors named "rgba"  send generic error that // the property set is missing the required property. const Rgba rgba = properties.GetProperty<Rgba>("MyGroup", "rgba"); // Explicitly detect missing property and throw exception with custom message. if (!properties.HasProperty("MyGroup", "rgba")) { throw RuntimeError( "ThisClass: Missing the necessary 'rgba' property; the object cannot be " "rendered"); } // Otherwise acquire value, confident that no exception will be thrown. const Rgba rgba = properties.GetProperty<Rgba>("MyGroup", "rgba");
Note
calls to
GetProperty()
always require the return type template value (e.g.,Rgba
) to be specified in the call.Look up specific properties with default property values
As with the previous case, the consumer is looking for one or more specific properties. However, in this case, the consumer provides a default value to use in case the target property is not defined. In this invocation, the template parameter need not be explicitly declared – the inferred return type will be the same as the default value.
const IllustrationProperties& properties = FunctionThatReturnsProperties(); // Looking for a Rgba of rgba colors named "rgba". const Rgba default_color{0.9, 0.9, 0.9}; const Rgba rgba = properties.GetPropertyOrDefault("MyGroup", "rgba", default_color);
Alternatively, the default value can be provided in one of the following forms:
properties.GetPropertyOrDefault("MyGroup", "rgba", Rgba{0.9, 0.9, 0.9}); properties.GetPropertyOrDefault<Rgba>("MyGroup", "rgba", {0.9, 0.9, 0.9});
Iterating through provided properties
Another alternative is to iterate through the properties that have been provided. This might be done for several reasons, e.g.:
 the consumer wants to validate the set of properties, giving the user
feedback if an unsupported property has been provided, and/or  the consumer has a default value for every property and allows the registering code to define only those properties that deviate from the specified default.
Working with properties in this manner requires knowledge of how to work with AbstractValue.
const IllustrationProperties& properties = FunctionThatReturnsProperties(); for (const auto& pair : properties.GetGroupProperties("MyGroup") { const std::string& name = pair.first; if (name == "rgba") { // Throws an exception if the named parameter is of the wrong type. const Rgba& rgba = pair.second>GetValueOrThrow<Rgba>(); } }

__init__
¶ Initialize self. See help(type(self)) for accurate signature.

AddProperty
(self: pydrake.geometry.GeometryProperties, group_name: str, name: str, value: object) → None¶ Adds the named property (
group_name
, name) with the givenvalue
. Adds the group if it doesn’t already exist. Parameter
group_name
:  The group name.
 Parameter
name
:  The name of the property – must be unique in the group.
 Parameter
value
:  The value to assign to the property.
Raises: RuntimeError if the property already exists.  Template parameter
ValueType
:  The type of data to store with the attribute – must be copy constructible or cloneable (see Value).
 Parameter

static
default_group_name
() → str¶ Returns the default group name. There is no guarantee as to what string corresponds to the default group. Therefore it should always be accessed via this method.

GetGroupNames
(self: pydrake.geometry.GeometryProperties) → Set[str]¶ Returns all of the defined group names.

GetPropertiesInGroup
(self: pydrake.geometry.GeometryProperties, group_name: str) → dict¶ Retrieves the indicated property group. The returned group is valid for as long as this instance.
Raises: RuntimeError if there is no group with the given name.

GetProperty
(self: pydrake.geometry.GeometryProperties, group_name: str, name: str) → object¶ Retrieves the typed value for the property (
group_name
, name) from this set of properties. Parameter
group_name
:  The name of the group to which the property belongs.
 Parameter
name
:  The name of the desired property.
Raises:  RuntimeError if a) the group name is invalid, b) the property name
 is invalid, or c) the property type is not that specified.
 Template parameter
ValueType
:  The expected type of the desired property.
Returns: const ValueType& of stored value. If ValueType is Eigen::Vector4d, the return type will be a copy translated from Rgba.  Parameter

GetPropertyOrDefault
(self: pydrake.geometry.GeometryProperties, group_name: str, name: str, default_value: object) → object¶ Retrieves the typed value for the property (
group_name
, name) from the set of properties (if it exists), otherwise returns the given default value. The givendefault_value
is returned only if the property is missing. If the property exists and is of a different type, an exception will be thrown. If it is of the expected type, the stored value will be returned.Generally, it is unnecessary to explicitly declare the
ValueType
of the property value; it will be inferred from the provided default value. Sometimes it is convenient to provide the default value in a form that can be implicitly converted to the final type. In that case, it is necessary to explicitly declare the desiredValueType
so the compiler does not infer the wrong type, e.g.:// Note the *integer* value as default value. const double my_value = properties.GetPropertyOrDefault<double>("g", "p", 2);
 Parameter
group_name
:  The name of the group to which the property belongs.
 Parameter
name
:  The name of the desired property.
 Parameter
default_value
:  The alternate value to return if the property cannot be acquired.
Raises:  RuntimeError if a property of the given name exists but is not of
ValueType
.
 Parameter

HasGroup
(self: pydrake.geometry.GeometryProperties, group_name: str) → bool¶ Reports if the given named group is part of this property set.

HasProperty
(self: pydrake.geometry.GeometryProperties, group_name: str, name: str) → bool¶ Reports if the property (
group_name
, name) exists in the group. Parameter
group_name
:  The name of the group to which the tested property should belong.
 Parameter
name
:  The name of the property under question.
Returns: true iff the group exists and a property with the given name
exists in that group. Parameter

num_groups
(self: pydrake.geometry.GeometryProperties) → int¶ Reports the number of property groups in this set.

RemoveProperty
(self: pydrake.geometry.GeometryProperties, group_name: str, name: str) → bool¶ Removes the (
group_name
, name) property (if it exists). Upon completion the property will not be in the set.Returns: True
if the property existed prior to the call.

UpdateProperty
(self: pydrake.geometry.GeometryProperties, group_name: str, name: str, value: object) → None¶ Updates the named property (
group_name
, name) with the givenvalue
. If the property doesn’t already exist, it is equivalent to callingAddProperty
. If the property does exist, its value (which must have the same type asvalue
) will be replaced. Parameter
group_name
:  The group name.
 Parameter
name
:  The name of the property – must be unique in the group.
 Parameter
value
:  The value to assign to the property.
Raises: RuntimeError if the property exists with a different type.  Template parameter
ValueType
:  The type of data to store with the attribute – must be copy constructible or cloneable (see Value).
 Parameter

class
pydrake.geometry.
GeometrySet
¶ The GeometrySet, as its name implies, is a convenience class for defining a set of geometries. What makes it unique from a simple
std::set<GeometryId>
instance is that membership doesn’t require explicit GeometryId enumeration; GeometryId values can be added to the set by adding theFrameId
for the frame to which the geometries are rigidly affixed.This class does no validation; it is a simple collection. Ultimately, it serves as the operand of SceneGraph operations (e.g., SceneGraph::ExcludeCollisionsWithin()). If the operation has a particular prerequisite on the members of a GeometrySet, it is the operation’s responsibility to enforce that requirement.
More formally, the SceneGraph consists of a set of geometries, each associated with a unique identifier. As such, we can consider the set of all identifiers
SG = {g₀, g₁, ..., gₙ}
that belong to a SceneGraph. A GeometrySet should represent a subset of those identifiers,Gₛ ⊆ SG
. The convenience of the GeometrySet class is how the subset is defined. Given a set of frame idsF = {f₀, f₁, ..., fₙ}
and geometry idsG = {g₀, g₁, ..., gₘ}
, Gₛ = G ⋃ geometry(f₀) ⋃ … ⋃ geometry(fₙ) (wheregeometry(f)
is the set of geometries rigidly affixed to frame f).
__init__
(self: pydrake.geometry.GeometrySet) → None¶


class
pydrake.geometry.
GeometryVersion
¶ A version numbering class that reports revisions of SceneGraph’s geometric data.
Other Systems can use this version number to perform updates when they detect changes to the geometric data they consume. The version of the geometry data is made available through SceneGraphInspector.
The geometry data is partitioned by geometric role and have independent role version values. Some of SceneGraph’s API (as variously documented) will cause one or more role versions to change. This class provides the API
IsSameAs
that takes another GeometryVersion as well as a Role to help detect whether the provided role of the geometries may have changed. For example:// Downstream system holds an instance of GeometryVersion ``old_version`` as a // reference to compare against. // Get the version under test from SceneGraphInspector. const GeometryVersion& test_version = scene_graph_inspector.geometry_version(); // Determine if two versions have the same proximity data. bool same_proximity = old_version.IsSameAs(test_version, Role::kProximity);

__init__
(*args, **kwargs)¶ Overloaded function.
 __init__(self: pydrake.geometry.GeometryVersion) > None
Constructs a defaultinitialized instance; guaranteed to be different from every other instance.
 __init__(self: pydrake.geometry.GeometryVersion, other: pydrake.geometry.GeometryVersion) > None
Creates a copy of the GeometryVersion.

IsSameAs
(self: pydrake.geometry.GeometryVersion, other: pydrake.geometry.GeometryVersion, role: pydrake.geometry.Role) → bool¶ Returns true if
this
GeometryVersion has the samerole
version as theother
GeometryVersion.


class
pydrake.geometry.
HalfSpace
¶ Bases:
pydrake.geometry.Shape
Definition of a half space. In its canonical frame, the plane defining the boundary of the half space is that frame’s z = 0 plane. By implication, the plane’s normal points in the +z direction and the origin lies on the plane. Other shapes are considered to be penetrating the half space if there exists a point on the test shape that lies on the side of the plane opposite the normal.

__init__
(self: pydrake.geometry.HalfSpace) → None¶

static
MakePose
(Hz_dir_F: numpy.ndarray[numpy.float64[3, 1]], p_FB: numpy.ndarray[numpy.float64[3, 1]]) → pydrake.math.RigidTransform_[float]¶ Creates the pose of a canonical half space in frame F. The half space’s normal is aligned to the positive zaxis of its canonical frame H. Given a vector that points in the same direction, measured in the F frame (Hz_dir_F) and a position vector to a point on the half space’s boundary* expressed in the same frame,
p_FB
, creates the pose of the half space in frame F:X_FH
. Parameter
Hz_dir_F
:  A vector in the direction of the positive zaxis of the canonical frame expressed in frame F. It must be a nonzero vector but need not be unit length.
 Parameter
p_FB
:  A point B lying on the half space’s boundary measured and expressed in frame F.
 Returns
X_FH
:  The pose of the canonical halfspace in frame F.
Raises:  RuntimeError if the normal is close to a zerovector (e.g.,
 ‖normal_F‖₂ < ε).
 Parameter


class
pydrake.geometry.
IllustrationProperties
¶ Bases:
pydrake.geometry.GeometryProperties
The set of properties for geometry used in an “illustration” role.
Examples of functionality that depends on the illustration role:  drake_visualizer_role_consumer “drake::geometry::DrakeVisualizer”  geometry_visualization_role_dependency “drake::geometry::ConnectDrakeVisualizer()”

__init__
(*args, **kwargs)¶ Overloaded function.
 __init__(self: pydrake.geometry.IllustrationProperties) > None
 __init__(self: pydrake.geometry.IllustrationProperties, other: pydrake.geometry.IllustrationProperties) > None
Creates a copy of the properties


pydrake.geometry.
MakePhongIllustrationProperties
(diffuse: numpy.ndarray[numpy.float64[4, 1]]) → pydrake.geometry.IllustrationProperties¶ Constructs an IllustrationProperties instance compatible with a simple “phong” material using only the given
diffuse
color.

class
pydrake.geometry.
Mesh
¶ Bases:
pydrake.geometry.Shape
Limited support for meshes. Meshes are supported in Rendering and Illustration roles. For Proximity role, Meshes are supported in ComputeContactSurfaces() query only. No other proximity queries are supported.

__init__
(self: pydrake.geometry.Mesh, absolute_filename: str, scale: float = 1.0) → None¶ Constructs a mesh specification from the mesh file located at the given absolute file path. Optionally uniformly scaled by the given scale factor.
Raises:  RuntimeError if scale < 1e8. Note that a negative scale is
 considered valid. We want to preclude scales near zero but
 recognise that scale is a convenience tool for “tweaking” models.
 8 orders of magnitude should be plenty without considering
 revisiting the model itself.

filename
(self: pydrake.geometry.Mesh) → str¶

scale
(self: pydrake.geometry.Mesh) → float¶


pydrake.geometry.
PenetrationAsPointPair
¶

template
pydrake.geometry.
PenetrationAsPointPair_
¶ Instantiations:
PenetrationAsPointPair_[float]
,PenetrationAsPointPair_[AutoDiffXd]

class
PenetrationAsPointPair_[float]
¶ A characterization of the intersection of two penetrating geometries. The characterization consists of a pair of points and a normal. The points represent a point on each geometry that most deeply penetrates the other geometry (in the normal direction). For convenience, the penetration depth is provided and is equal to:
depth =
(p_WCb  p_WCa) ⋅ nhat_BA_W
(depth is strictly positive when there is penetration and otherwise not defined.)
 Template parameter
T
:  The underlying scalar type. Must be a valid Eigen scalar.

__init__
(self: pydrake.geometry.PenetrationAsPointPair_[float], **kwargs) → None¶

depth
¶ The penetration depth.

id_A
¶ The id of the first geometry in the contact.

id_B
¶ The id of the second geometry in the contact.

nhat_BA_W
¶ The unitlength normal which defines the penetration direction, pointing from geometry B into geometry A, measured and expressed in the world frame. It approximates the normal to the plane on which the contact patch lies.

p_WCa
¶ The point on A that most deeply penetrates B, measured and expressed in the world frame.

p_WCb
¶ The point on B that most deeply penetrates A, measured and expressed in the world frame.
 Template parameter

class

class
pydrake.geometry.
PenetrationAsPointPair_[AutoDiffXd]
¶ A characterization of the intersection of two penetrating geometries. The characterization consists of a pair of points and a normal. The points represent a point on each geometry that most deeply penetrates the other geometry (in the normal direction). For convenience, the penetration depth is provided and is equal to:
depth =
(p_WCb  p_WCa) ⋅ nhat_BA_W
(depth is strictly positive when there is penetration and otherwise not defined.)
 Template parameter
T
:  The underlying scalar type. Must be a valid Eigen scalar.

__init__
(self: pydrake.geometry.PenetrationAsPointPair_[AutoDiffXd], **kwargs) → None¶

depth
¶ The penetration depth.

id_A
¶ The id of the first geometry in the contact.

id_B
¶ The id of the second geometry in the contact.

nhat_BA_W
¶ The unitlength normal which defines the penetration direction, pointing from geometry B into geometry A, measured and expressed in the world frame. It approximates the normal to the plane on which the contact patch lies.

p_WCa
¶ The point on A that most deeply penetrates B, measured and expressed in the world frame.

p_WCb
¶ The point on B that most deeply penetrates A, measured and expressed in the world frame.
 Template parameter

class
pydrake.geometry.
PenetrationAsPointPair_[float]
¶ A characterization of the intersection of two penetrating geometries. The characterization consists of a pair of points and a normal. The points represent a point on each geometry that most deeply penetrates the other geometry (in the normal direction). For convenience, the penetration depth is provided and is equal to:
depth =
(p_WCb  p_WCa) ⋅ nhat_BA_W
(depth is strictly positive when there is penetration and otherwise not defined.)
 Template parameter
T
:  The underlying scalar type. Must be a valid Eigen scalar.

__init__
(self: pydrake.geometry.PenetrationAsPointPair_[float], **kwargs) → None¶

depth
¶ The penetration depth.

id_A
¶ The id of the first geometry in the contact.

id_B
¶ The id of the second geometry in the contact.

nhat_BA_W
¶ The unitlength normal which defines the penetration direction, pointing from geometry B into geometry A, measured and expressed in the world frame. It approximates the normal to the plane on which the contact patch lies.

p_WCa
¶ The point on A that most deeply penetrates B, measured and expressed in the world frame.

p_WCb
¶ The point on B that most deeply penetrates A, measured and expressed in the world frame.
 Template parameter

class
pydrake.geometry.
PerceptionProperties
¶ Bases:
pydrake.geometry.GeometryProperties
The set of properties for geometry used in a “perception” role.
Examples of functionality that depends on the perception role:  render::RenderEngineVtk

__init__
(*args, **kwargs)¶ Overloaded function.
 __init__(self: pydrake.geometry.PerceptionProperties) > None
 __init__(self: pydrake.geometry.PerceptionProperties, other: pydrake.geometry.PerceptionProperties) > None
Creates a copy of the properties


class
pydrake.geometry.
ProximityProperties
¶ Bases:
pydrake.geometry.GeometryProperties
The set of properties for geometry used in a proximity role.
Examples of functionality that depends on the proximity role:

__init__
(*args, **kwargs)¶ Overloaded function.
 __init__(self: pydrake.geometry.ProximityProperties) > None
 __init__(self: pydrake.geometry.ProximityProperties, other: pydrake.geometry.ProximityProperties) > None
Creates a copy of the properties


pydrake.geometry.
QueryObject
¶ alias of
pydrake.geometry.QueryObject_[float]

template
pydrake.geometry.
QueryObject_
¶ Instantiations:
QueryObject_[float]
,QueryObject_[AutoDiffXd]

class
QueryObject_[float]
¶ The QueryObject serves as a mechanism to perform geometry queries on the world’s geometry. The SceneGraph has an abstractvalued port that contains a QueryObject (i.e., a QueryObjectvalued output port).
To perform geometry queries on SceneGraph:  a LeafSystem must have a QueryObjectvalued input port and connect it to the corresponding query output port on SceneGraph,  the querying LeafSystem can evaluate the input port, retrieving a
const QueryObject&
in return, and, finally,  invoke the appropriate method on the QueryObject.The const reference returned by the input port is considered “live”  it is linked to the context, system, and cache (making full use of all of those mechanisms). This const reference should never be persisted; doing so can lead to erroneous query results. It is simpler and more advisable to acquire it for evaluation in a limited scope (e.g., CalcTimeDerivatives()) and then discard it. If a QueryObject is needed for many separate functions in a LeafSystem, each should reevaluate the input port. The underlying caching mechanism should make the cost of this negligible.
The QueryObject can be copied. The copied instance is no longer “live”; it is now “baked”. Essentially, it freezes the state of the live scene graph in its current configuration and disconnects it from the system and context. This means, even if the original context changes values, the copied/baked instance will always reproduce the same query results. This baking process is not cheap and should not be done without consideration.
A QueryObject cannot be converted to a different scalar type. A QueryObject of scalar type T can only be acquired from the output port of a SceneGraph of type T evaluated on a corresponding Context, also of type T.
QueryObject’s support for arbitrary scalar type is incomplete. Not all queries support all scalar types to the same degree. In some cases the level of support is obvious (such as when the query is declared explicitly in terms of a doublevalued scalar – see ComputePointPairPenetration()). In other cases, where the query is expressed in terms of scalar
T
, the query may have restrictions. If a query has restricted scalar support, it is included in the query’s documentation.
__init__
(self: pydrake.geometry.QueryObject_[float]) → None¶ Constructs a default QueryObject (all pointers are null).

ComputePointPairPenetration
(self: pydrake.geometry.QueryObject_[float]) → List[drake::geometry::PenetrationAsPointPair<double>]¶ Computes the penetrations across all pairs of geometries in the world with the penetrations characterized by pairs of points (see PenetrationAsPointPair), providing some measure of the penetration “depth” of the two objects, but not the overlapping volume.
Only reports results for penetrating geometries; if two geometries are separated, there will be no result for that pair. Geometries whose surfaces are just touching (osculating) are not considered in penetration. Surfaces whose penetration is within an epsilon of osculation, are likewise not considered penetrating. Pairs of anchored geometry are also not reported. This method is affected by collision filtering.
For two penetrating geometries g_A and g_B, it is guaranteed that they will map to
id_A
andid_B
in a fixed, repeatable manner.Scalar and Shape Support
 For scalar type
double
, we support all ShapeShape pairs except for
HalfSpaceHalfSpace. In that case, half spaces are either noncolliding or have an infinite amount of penetration.  For scalar type AutoDiffXd, we only support query pairs SphereBox, SphereCapsule, SphereCylinder, SphereHalfSpace, and SphereSphere.
For a ShapeShape pair in collision that is not supported for a given scalar type, an exception is thrown.
Returns: A vector populated with all detected penetrations characterized as point pairs. The ordering of the results is guaranteed to be consistent – for fixed geometry poses, the results will remain the same. Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
Raises:  RuntimeError if unsupported pairs are in contact (see “Scalar and
 Shape Support” for description of “unsupported pairs”).
 For scalar type

ComputeSignedDistancePairClosestPoints
(*args, **kwargs)¶ Overloaded function.
 ComputeSignedDistancePairClosestPoints(self: pydrake.geometry.QueryObject_[float], geometry_id_A: pydrake.geometry.GeometryId, geometry_id_B: pydrake.geometry.GeometryId) > drake::geometry::SignedDistancePair<double>
A variant of ComputeSignedDistancePairwiseClosestPoints() which computes the signed distance (and witnesses) between a specific pair of geometries indicated by id. This function has the same restrictions on scalar report as ComputeSignedDistancePairwiseClosestPoints().
Raises:  RuntimeError if either geometry id is invalid, or if the pair (A,
 has been marked as filtered.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
 ComputeSignedDistancePairClosestPoints(self: pydrake.geometry.QueryObject_[float], id_A: pydrake.geometry.GeometryId, id_B: pydrake.geometry.GeometryId) > drake::geometry::SignedDistancePair<double>
A variant of ComputeSignedDistancePairwiseClosestPoints() which computes the signed distance (and witnesses) between a specific pair of geometries indicated by id. This function has the same restrictions on scalar report as ComputeSignedDistancePairwiseClosestPoints().
Raises:  RuntimeError if either geometry id is invalid, or if the pair (A,
 has been marked as filtered.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.

ComputeSignedDistancePairwiseClosestPoints
(self: pydrake.geometry.QueryObject_[float], max_distance: float = inf) → List[drake::geometry::SignedDistancePair<double>]¶ Computes the signed distance together with the nearest points across all pairs of geometries in the world. Reports both the separating geometries and penetrating geometries.
This query provides φ(A, B), the signed distance between two objects A and B.
If the objects do not overlap (i.e., A ⋂ B = ∅), φ > 0 and represents the minimal distance between the two objects. More formally: φ = min(Aₚ  Bₚ) ∀ Aₚ ∈ A and Bₚ ∈ B.
Note
The pair (Aₚ, Bₚ) is a “witness” of the distance. The pair need not be unique (think of two parallel planes).
If the objects touch or overlap (i.e., A ⋂ B ≠ ∅), φ ≤ 0 and can be interpreted as the negative penetration depth. It is the smallest length of the vector v, such that by shifting one object along that vector relative to the other, the two objects will no longer be overlapping. More formally, φ(A, B) = min v. s.t (Tᵥ · A) ⋂ B = ∅ where Tᵥ is a rigid transformation that displaces A by the vector v, namely Tᵥ · A = {u + v  ∀ u ∈ A}. By implication, there exist points Aₚ and Bₚ on the surfaces of objects A and B, respectively, such that Aₚ + v = Bₚ, Aₚ ∈ A ∩ B, Bₚ ∈ A ∩ B. These points are the witnesses to the penetration.
This method is affected by collision filtering; geometry pairs that have been filtered will not produce signed distance query results.
For a geometry pair (A, B), the returned results will always be reported in a fixed order (e.g., always (A, B) and never (B, A)). The basis for the ordering is arbitrary (and therefore undocumented), but guaranteed to be fixed and repeatable.
Notice that this is an O(N²) operation, where N is the number of geometries remaining in the world after applying collision filter. We report the distance between dynamic objects, and between dynamic and anchored objects. We DO NOT report the distance between two anchored objects.
Scalar support
This function does not support halfspaces. If an unfiltered pair contains a halfspace, an exception will be thrown for all scalar types. Otherwise, this query supports all other pairs of Drake geometry types for
double
. ForAutoDiffXd
, it only supports distance between spherebox and spheresphere. If there are any unfiltered geometry pairs that include other geometries, the AutoDiff throws an exception. Parameter
max_distance
:  The maximum distance at which distance data is reported.
Returns: The signed distance (and supporting data) for all unfiltered geometry pairs whose distance is less than or equal to max_distance
.Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
 Parameter

ComputeSignedDistanceToPoint
(self: pydrake.geometry.QueryObject_[float], p_WQ: numpy.ndarray[numpy.float64[3, 1]], threshold: float = inf) → List[drake::geometry::SignedDistanceToPoint<double>]¶ Computes the signed distances and gradients to a query point from each geometry in the scene.
Warning
Currently supports spheres, boxes, and cylinders only. Silently ignores other kinds of geometries, which will be added later.
This query provides φᵢ(p), φᵢ:ℝ³→ℝ, the signed distance to the position p of a query point from geometry Gᵢ in the scene. It returns an array of the signed distances from all geometries.
Optionally you can specify a threshold distance that will filter out any object beyond the threshold. By default, we report distances from the query point to every object.
This query also provides the gradient vector ∇φᵢ(p) of the signed distance function from geometry Gᵢ. Note that, in general, if p is outside Gᵢ, then ∇φᵢ(p) equals the unit vector in the direction from the nearest point Nᵢ on Gᵢ’s surface to p. If p is inside Gᵢ, then ∇φᵢ(p) is in the direction from p to Nᵢ. This observation is written formally as:
∇φᵢ(p) = (p  Nᵢ)/p  Nᵢ if p is outside Gᵢ
∇φᵢ(p) = (p  Nᵢ)/p  Nᵢ if p is inside Gᵢ
Note that ∇φᵢ(p) is also defined on Gᵢ’s surface, but we cannot use the above formula.
Scalar support
This query only supports computing distances from the point to spheres, boxes, and cylinders for both
double
andAutoDiffXd
scalar types. If the SceneGraph contains any other geometry shapes, they will be silently ignored.Note
For a sphere G, the signed distance function φᵢ(p) has an undefined gradient vector at the center of the sphere–every point on the sphere’s surface has the same distance to the center. In this case, we will assign ∇φᵢ(p) the unit vector Gx (xdirectional vector of G’s frame) expressed in World frame.
Note
For a box, at a point p on an edge or a corner of the box, the signed distance function φᵢ(p) has an undefined gradient vector. In this case, we will assign a unit vector in the direction of the average of the outward face unit normals of the incident faces of the edge or the corner. A point p is considered being on a face, or an edge, or a corner of the box if it lies within a certain tolerance from them.
Note
For a box B, if a point p is inside the box, and it is equidistant to to multiple nearest faces, the signed distance function φᵢ(p) at p will have an undefined gradient vector. There is a nearest point candidate associated with each nearest face. In this case, we arbitrarily pick the point Nᵢ associated with one of the nearest faces. Please note that, due to the possible round off error arising from applying a pose X_WG to B, there is no guarantee which of the nearest faces will be used.
Note
The signed distance function is a continuous function with respect to the position of the query point, but its gradient vector field may not be continuous. Specifically at a position equidistant to multiple nearest points, its gradient vector field is not continuous.
Note
For a convex object, outside the object at positive distance from the boundary, the signed distance function is smooth (having continuous firstorder partial derivatives).
 Parameter
p_WQ
:  Position of a query point Q in world frame W.
 Parameter
threshold
:  We ignore any object beyond this distance. By default, it is infinity, so we report distances from the query point to every object.
 Returns
signed_distances
:  A vector populated with perobject signed distance values (and supporting data). See SignedDistanceToPoint.
 Parameter

FindCollisionCandidates
(self: pydrake.geometry.QueryObject_[float]) → List[drake::SortedPair<drake::geometry::GeometryId>]¶ Applies a conservative culling mechanism to create a subset of all possible geometry pairs based on nonzero intersections. A geometry pair that is absent from the results is either a) culled by collision filters or b) known to be separated. The caller is responsible for confirming that the remaining, unculled geometry pairs are actually in collision.
Returns: A vector populated with collision pair candidates (the order will remain constant for a fixed population but can change as geometry ids are added/removed).

GetPoseInParent
(self: pydrake.geometry.QueryObject_[float], frame_id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[float]¶ Reports the position of the frame indicated by
frame_id
relative to its parent frame. If the frame was registered with the world frame as its parent frame, this value will be identical to that returned by GetPoseInWorld().Note
This is analogous to but distinct from SceneGraphInspector::GetPoseInParent(). In this case, the pose will always be relative to another frame.
Raises: RuntimeError if the frame frame_id
is not valid.

GetPoseInWorld
(*args, **kwargs)¶ Overloaded function.
 GetPoseInWorld(self: pydrake.geometry.QueryObject_[float], frame_id: pydrake.geometry.FrameId) > pydrake.math.RigidTransform_[float]
Reports the position of the frame indicated by
frame_id
relative to the world frame.Raises: RuntimeError if the frame frame_id
is not valid. GetPoseInWorld(self: pydrake.geometry.QueryObject_[float], geometry_id: pydrake.geometry.GeometryId) > pydrake.math.RigidTransform_[float]
Reports the position of the geometry indicated by
geometry_id
relative to the world frame.Raises: RuntimeError if the geometry geometry_id
is not valid.

HasCollisions
(self: pydrake.geometry.QueryObject_[float]) → bool¶ Reports true if there are any collisions between unfiltered pairs in the world.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.

inspector
(self: pydrake.geometry.QueryObject_[float]) → pydrake.geometry.SceneGraphInspector_[float]¶ Provides an inspector for the topological structure of the underlying scene graph data (see SceneGraphInspector for details).

RenderColorImage
(*args, **kwargs)¶ Overloaded function.
 RenderColorImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::ColorRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)2>
Renders an RGB image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
color_image_out
:  The rendered color image.
 RenderColorImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::CameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float], show_window: bool = False) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)2>
Renders an RGB image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
show_window
:  If true, the render window will be displayed.
 Parameter
color_image_out
:  The rendered color image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the ColorRenderCamera variant. This will be removed from Drake on or after 20210401.

RenderDepthImage
(*args, **kwargs)¶ Overloaded function.
 RenderDepthImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::DepthRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)6>
Renders a depth image for the given
camera
posed with respect to the indicated parent frame P.In contrast to the other rendering methods, rendering depth images doesn’t provide the option to display the window; generally, basic depth images are not readily communicative to humans.
 Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
depth_image_out
:  The rendered depth image.
 RenderDepthImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::DepthCameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)6>
Renders a depth image for the given
camera
posed with respect to the indicated parent frame P.In contrast to the other rendering methods, rendering depth images doesn’t provide the option to display the window; generally, basic depth images are not readily communicative to humans.
 Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
depth_image_out
:  The rendered depth image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the DepthRenderCamera variant. This will be removed from Drake on or after 20210401.

RenderLabelImage
(*args, **kwargs)¶ Overloaded function.
 RenderLabelImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::ColorRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)7>
Renders a label image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
label_image_out
:  The rendered label image.
 RenderLabelImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::CameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float], show_window: bool = False) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)7>
Renders a label image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
show_window
:  If true, the render window will be displayed.
 Parameter
label_image_out
:  The rendered label image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the ColorRenderCamera variant. This will be removed from Drake on or after 20210401.

X_PF
(self: pydrake.geometry.QueryObject_[float], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[float]¶ Deprecated variant of GetPoseInParent(). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInParent(FrameId) instead. This will be removed from Drake on or after 20210401.

X_WF
(self: pydrake.geometry.QueryObject_[float], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[float]¶ Deprecated variant of GetPoseInWorld(FrameId). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInWorld(FrameId) instead. This will be removed from Drake on or after 20210401.

X_WG
(self: pydrake.geometry.QueryObject_[float], id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[float]¶ Deprecated variant of GetPoseInWorld(GeometryId). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInWorld(GeometryId) instead. This will be removed from Drake on or after 20210401.


class

class
pydrake.geometry.
QueryObject_[AutoDiffXd]
¶ The QueryObject serves as a mechanism to perform geometry queries on the world’s geometry. The SceneGraph has an abstractvalued port that contains a QueryObject (i.e., a QueryObjectvalued output port).
To perform geometry queries on SceneGraph:  a LeafSystem must have a QueryObjectvalued input port and connect it to the corresponding query output port on SceneGraph,  the querying LeafSystem can evaluate the input port, retrieving a
const QueryObject&
in return, and, finally,  invoke the appropriate method on the QueryObject.The const reference returned by the input port is considered “live”  it is linked to the context, system, and cache (making full use of all of those mechanisms). This const reference should never be persisted; doing so can lead to erroneous query results. It is simpler and more advisable to acquire it for evaluation in a limited scope (e.g., CalcTimeDerivatives()) and then discard it. If a QueryObject is needed for many separate functions in a LeafSystem, each should reevaluate the input port. The underlying caching mechanism should make the cost of this negligible.
The QueryObject can be copied. The copied instance is no longer “live”; it is now “baked”. Essentially, it freezes the state of the live scene graph in its current configuration and disconnects it from the system and context. This means, even if the original context changes values, the copied/baked instance will always reproduce the same query results. This baking process is not cheap and should not be done without consideration.
A QueryObject cannot be converted to a different scalar type. A QueryObject of scalar type T can only be acquired from the output port of a SceneGraph of type T evaluated on a corresponding Context, also of type T.
QueryObject’s support for arbitrary scalar type is incomplete. Not all queries support all scalar types to the same degree. In some cases the level of support is obvious (such as when the query is declared explicitly in terms of a doublevalued scalar – see ComputePointPairPenetration()). In other cases, where the query is expressed in terms of scalar
T
, the query may have restrictions. If a query has restricted scalar support, it is included in the query’s documentation.
__init__
(self: pydrake.geometry.QueryObject_[AutoDiffXd]) → None¶ Constructs a default QueryObject (all pointers are null).

ComputePointPairPenetration
(self: pydrake.geometry.QueryObject_[AutoDiffXd]) → List[drake::geometry::PenetrationAsPointPair<Eigen::AutoDiffScalar<Eigen::Matrix<double, 1, 1, 0, 1, 1> > >]¶ Computes the penetrations across all pairs of geometries in the world with the penetrations characterized by pairs of points (see PenetrationAsPointPair), providing some measure of the penetration “depth” of the two objects, but not the overlapping volume.
Only reports results for penetrating geometries; if two geometries are separated, there will be no result for that pair. Geometries whose surfaces are just touching (osculating) are not considered in penetration. Surfaces whose penetration is within an epsilon of osculation, are likewise not considered penetrating. Pairs of anchored geometry are also not reported. This method is affected by collision filtering.
For two penetrating geometries g_A and g_B, it is guaranteed that they will map to
id_A
andid_B
in a fixed, repeatable manner.Scalar and Shape Support
 For scalar type
double
, we support all ShapeShape pairs except for
HalfSpaceHalfSpace. In that case, half spaces are either noncolliding or have an infinite amount of penetration.  For scalar type AutoDiffXd, we only support query pairs SphereBox, SphereCapsule, SphereCylinder, SphereHalfSpace, and SphereSphere.
For a ShapeShape pair in collision that is not supported for a given scalar type, an exception is thrown.
Returns: A vector populated with all detected penetrations characterized as point pairs. The ordering of the results is guaranteed to be consistent – for fixed geometry poses, the results will remain the same. Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
Raises:  RuntimeError if unsupported pairs are in contact (see “Scalar and
 Shape Support” for description of “unsupported pairs”).
 For scalar type

ComputeSignedDistancePairClosestPoints
(*args, **kwargs)¶ Overloaded function.
 ComputeSignedDistancePairClosestPoints(self: pydrake.geometry.QueryObject_[AutoDiffXd], geometry_id_A: pydrake.geometry.GeometryId, geometry_id_B: pydrake.geometry.GeometryId) > drake::geometry::SignedDistancePair<Eigen::AutoDiffScalar<Eigen::Matrix<double, 1, 1, 0, 1, 1> > >
A variant of ComputeSignedDistancePairwiseClosestPoints() which computes the signed distance (and witnesses) between a specific pair of geometries indicated by id. This function has the same restrictions on scalar report as ComputeSignedDistancePairwiseClosestPoints().
Raises:  RuntimeError if either geometry id is invalid, or if the pair (A,
 has been marked as filtered.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
 ComputeSignedDistancePairClosestPoints(self: pydrake.geometry.QueryObject_[AutoDiffXd], id_A: pydrake.geometry.GeometryId, id_B: pydrake.geometry.GeometryId) > drake::geometry::SignedDistancePair<Eigen::AutoDiffScalar<Eigen::Matrix<double, 1, 1, 0, 1, 1> > >
A variant of ComputeSignedDistancePairwiseClosestPoints() which computes the signed distance (and witnesses) between a specific pair of geometries indicated by id. This function has the same restrictions on scalar report as ComputeSignedDistancePairwiseClosestPoints().
Raises:  RuntimeError if either geometry id is invalid, or if the pair (A,
 has been marked as filtered.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.

ComputeSignedDistancePairwiseClosestPoints
(self: pydrake.geometry.QueryObject_[AutoDiffXd], max_distance: float = inf) → List[drake::geometry::SignedDistancePair<Eigen::AutoDiffScalar<Eigen::Matrix<double, 1, 1, 0, 1, 1> > >]¶ Computes the signed distance together with the nearest points across all pairs of geometries in the world. Reports both the separating geometries and penetrating geometries.
This query provides φ(A, B), the signed distance between two objects A and B.
If the objects do not overlap (i.e., A ⋂ B = ∅), φ > 0 and represents the minimal distance between the two objects. More formally: φ = min(Aₚ  Bₚ) ∀ Aₚ ∈ A and Bₚ ∈ B.
Note
The pair (Aₚ, Bₚ) is a “witness” of the distance. The pair need not be unique (think of two parallel planes).
If the objects touch or overlap (i.e., A ⋂ B ≠ ∅), φ ≤ 0 and can be interpreted as the negative penetration depth. It is the smallest length of the vector v, such that by shifting one object along that vector relative to the other, the two objects will no longer be overlapping. More formally, φ(A, B) = min v. s.t (Tᵥ · A) ⋂ B = ∅ where Tᵥ is a rigid transformation that displaces A by the vector v, namely Tᵥ · A = {u + v  ∀ u ∈ A}. By implication, there exist points Aₚ and Bₚ on the surfaces of objects A and B, respectively, such that Aₚ + v = Bₚ, Aₚ ∈ A ∩ B, Bₚ ∈ A ∩ B. These points are the witnesses to the penetration.
This method is affected by collision filtering; geometry pairs that have been filtered will not produce signed distance query results.
For a geometry pair (A, B), the returned results will always be reported in a fixed order (e.g., always (A, B) and never (B, A)). The basis for the ordering is arbitrary (and therefore undocumented), but guaranteed to be fixed and repeatable.
Notice that this is an O(N²) operation, where N is the number of geometries remaining in the world after applying collision filter. We report the distance between dynamic objects, and between dynamic and anchored objects. We DO NOT report the distance between two anchored objects.
Scalar support
This function does not support halfspaces. If an unfiltered pair contains a halfspace, an exception will be thrown for all scalar types. Otherwise, this query supports all other pairs of Drake geometry types for
double
. ForAutoDiffXd
, it only supports distance between spherebox and spheresphere. If there are any unfiltered geometry pairs that include other geometries, the AutoDiff throws an exception. Parameter
max_distance
:  The maximum distance at which distance data is reported.
Returns: The signed distance (and supporting data) for all unfiltered geometry pairs whose distance is less than or equal to max_distance
.Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
 Parameter

ComputeSignedDistanceToPoint
(self: pydrake.geometry.QueryObject_[AutoDiffXd], p_WQ: numpy.ndarray[object[3, 1]], threshold: float = inf) → List[drake::geometry::SignedDistanceToPoint<Eigen::AutoDiffScalar<Eigen::Matrix<double, 1, 1, 0, 1, 1> > >]¶ Computes the signed distances and gradients to a query point from each geometry in the scene.
Warning
Currently supports spheres, boxes, and cylinders only. Silently ignores other kinds of geometries, which will be added later.
This query provides φᵢ(p), φᵢ:ℝ³→ℝ, the signed distance to the position p of a query point from geometry Gᵢ in the scene. It returns an array of the signed distances from all geometries.
Optionally you can specify a threshold distance that will filter out any object beyond the threshold. By default, we report distances from the query point to every object.
This query also provides the gradient vector ∇φᵢ(p) of the signed distance function from geometry Gᵢ. Note that, in general, if p is outside Gᵢ, then ∇φᵢ(p) equals the unit vector in the direction from the nearest point Nᵢ on Gᵢ’s surface to p. If p is inside Gᵢ, then ∇φᵢ(p) is in the direction from p to Nᵢ. This observation is written formally as:
∇φᵢ(p) = (p  Nᵢ)/p  Nᵢ if p is outside Gᵢ
∇φᵢ(p) = (p  Nᵢ)/p  Nᵢ if p is inside Gᵢ
Note that ∇φᵢ(p) is also defined on Gᵢ’s surface, but we cannot use the above formula.
Scalar support
This query only supports computing distances from the point to spheres, boxes, and cylinders for both
double
andAutoDiffXd
scalar types. If the SceneGraph contains any other geometry shapes, they will be silently ignored.Note
For a sphere G, the signed distance function φᵢ(p) has an undefined gradient vector at the center of the sphere–every point on the sphere’s surface has the same distance to the center. In this case, we will assign ∇φᵢ(p) the unit vector Gx (xdirectional vector of G’s frame) expressed in World frame.
Note
For a box, at a point p on an edge or a corner of the box, the signed distance function φᵢ(p) has an undefined gradient vector. In this case, we will assign a unit vector in the direction of the average of the outward face unit normals of the incident faces of the edge or the corner. A point p is considered being on a face, or an edge, or a corner of the box if it lies within a certain tolerance from them.
Note
For a box B, if a point p is inside the box, and it is equidistant to to multiple nearest faces, the signed distance function φᵢ(p) at p will have an undefined gradient vector. There is a nearest point candidate associated with each nearest face. In this case, we arbitrarily pick the point Nᵢ associated with one of the nearest faces. Please note that, due to the possible round off error arising from applying a pose X_WG to B, there is no guarantee which of the nearest faces will be used.
Note
The signed distance function is a continuous function with respect to the position of the query point, but its gradient vector field may not be continuous. Specifically at a position equidistant to multiple nearest points, its gradient vector field is not continuous.
Note
For a convex object, outside the object at positive distance from the boundary, the signed distance function is smooth (having continuous firstorder partial derivatives).
 Parameter
p_WQ
:  Position of a query point Q in world frame W.
 Parameter
threshold
:  We ignore any object beyond this distance. By default, it is infinity, so we report distances from the query point to every object.
 Returns
signed_distances
:  A vector populated with perobject signed distance values (and supporting data). See SignedDistanceToPoint.
 Parameter

FindCollisionCandidates
(self: pydrake.geometry.QueryObject_[AutoDiffXd]) → List[drake::SortedPair<drake::geometry::GeometryId>]¶ Applies a conservative culling mechanism to create a subset of all possible geometry pairs based on nonzero intersections. A geometry pair that is absent from the results is either a) culled by collision filters or b) known to be separated. The caller is responsible for confirming that the remaining, unculled geometry pairs are actually in collision.
Returns: A vector populated with collision pair candidates (the order will remain constant for a fixed population but can change as geometry ids are added/removed).

GetPoseInParent
(self: pydrake.geometry.QueryObject_[AutoDiffXd], frame_id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[AutoDiffXd]¶ Reports the position of the frame indicated by
frame_id
relative to its parent frame. If the frame was registered with the world frame as its parent frame, this value will be identical to that returned by GetPoseInWorld().Note
This is analogous to but distinct from SceneGraphInspector::GetPoseInParent(). In this case, the pose will always be relative to another frame.
Raises: RuntimeError if the frame frame_id
is not valid.

GetPoseInWorld
(*args, **kwargs)¶ Overloaded function.
 GetPoseInWorld(self: pydrake.geometry.QueryObject_[AutoDiffXd], frame_id: pydrake.geometry.FrameId) > pydrake.math.RigidTransform_[AutoDiffXd]
Reports the position of the frame indicated by
frame_id
relative to the world frame.Raises: RuntimeError if the frame frame_id
is not valid. GetPoseInWorld(self: pydrake.geometry.QueryObject_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) > pydrake.math.RigidTransform_[AutoDiffXd]
Reports the position of the geometry indicated by
geometry_id
relative to the world frame.Raises: RuntimeError if the geometry geometry_id
is not valid.

HasCollisions
(self: pydrake.geometry.QueryObject_[AutoDiffXd]) → bool¶ Reports true if there are any collisions between unfiltered pairs in the world.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.

inspector
(self: pydrake.geometry.QueryObject_[AutoDiffXd]) → pydrake.geometry.SceneGraphInspector_[AutoDiffXd]¶ Provides an inspector for the topological structure of the underlying scene graph data (see SceneGraphInspector for details).

RenderColorImage
(*args, **kwargs)¶ Overloaded function.
 RenderColorImage(self: pydrake.geometry.QueryObject_[AutoDiffXd], camera: drake::geometry::render::ColorRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)2>
Renders an RGB image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
color_image_out
:  The rendered color image.
 RenderColorImage(self: pydrake.geometry.QueryObject_[AutoDiffXd], camera: drake::geometry::render::CameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float], show_window: bool = False) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)2>
Renders an RGB image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
show_window
:  If true, the render window will be displayed.
 Parameter
color_image_out
:  The rendered color image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the ColorRenderCamera variant. This will be removed from Drake on or after 20210401.

RenderDepthImage
(*args, **kwargs)¶ Overloaded function.
 RenderDepthImage(self: pydrake.geometry.QueryObject_[AutoDiffXd], camera: drake::geometry::render::DepthRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)6>
Renders a depth image for the given
camera
posed with respect to the indicated parent frame P.In contrast to the other rendering methods, rendering depth images doesn’t provide the option to display the window; generally, basic depth images are not readily communicative to humans.
 Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
depth_image_out
:  The rendered depth image.
 RenderDepthImage(self: pydrake.geometry.QueryObject_[AutoDiffXd], camera: drake::geometry::render::DepthCameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)6>
Renders a depth image for the given
camera
posed with respect to the indicated parent frame P.In contrast to the other rendering methods, rendering depth images doesn’t provide the option to display the window; generally, basic depth images are not readily communicative to humans.
 Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
depth_image_out
:  The rendered depth image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the DepthRenderCamera variant. This will be removed from Drake on or after 20210401.

RenderLabelImage
(*args, **kwargs)¶ Overloaded function.
 RenderLabelImage(self: pydrake.geometry.QueryObject_[AutoDiffXd], camera: drake::geometry::render::ColorRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)7>
Renders a label image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
label_image_out
:  The rendered label image.
 RenderLabelImage(self: pydrake.geometry.QueryObject_[AutoDiffXd], camera: drake::geometry::render::CameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float], show_window: bool = False) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)7>
Renders a label image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
show_window
:  If true, the render window will be displayed.
 Parameter
label_image_out
:  The rendered label image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the ColorRenderCamera variant. This will be removed from Drake on or after 20210401.

X_PF
(self: pydrake.geometry.QueryObject_[AutoDiffXd], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[AutoDiffXd]¶ Deprecated variant of GetPoseInParent(). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInParent(FrameId) instead. This will be removed from Drake on or after 20210401.

X_WF
(self: pydrake.geometry.QueryObject_[AutoDiffXd], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[AutoDiffXd]¶ Deprecated variant of GetPoseInWorld(FrameId). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInWorld(FrameId) instead. This will be removed from Drake on or after 20210401.

X_WG
(self: pydrake.geometry.QueryObject_[AutoDiffXd], id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[AutoDiffXd]¶ Deprecated variant of GetPoseInWorld(GeometryId). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInWorld(GeometryId) instead. This will be removed from Drake on or after 20210401.


class
pydrake.geometry.
QueryObject_[float]
¶ The QueryObject serves as a mechanism to perform geometry queries on the world’s geometry. The SceneGraph has an abstractvalued port that contains a QueryObject (i.e., a QueryObjectvalued output port).
To perform geometry queries on SceneGraph:  a LeafSystem must have a QueryObjectvalued input port and connect it to the corresponding query output port on SceneGraph,  the querying LeafSystem can evaluate the input port, retrieving a
const QueryObject&
in return, and, finally,  invoke the appropriate method on the QueryObject.The const reference returned by the input port is considered “live”  it is linked to the context, system, and cache (making full use of all of those mechanisms). This const reference should never be persisted; doing so can lead to erroneous query results. It is simpler and more advisable to acquire it for evaluation in a limited scope (e.g., CalcTimeDerivatives()) and then discard it. If a QueryObject is needed for many separate functions in a LeafSystem, each should reevaluate the input port. The underlying caching mechanism should make the cost of this negligible.
The QueryObject can be copied. The copied instance is no longer “live”; it is now “baked”. Essentially, it freezes the state of the live scene graph in its current configuration and disconnects it from the system and context. This means, even if the original context changes values, the copied/baked instance will always reproduce the same query results. This baking process is not cheap and should not be done without consideration.
A QueryObject cannot be converted to a different scalar type. A QueryObject of scalar type T can only be acquired from the output port of a SceneGraph of type T evaluated on a corresponding Context, also of type T.
QueryObject’s support for arbitrary scalar type is incomplete. Not all queries support all scalar types to the same degree. In some cases the level of support is obvious (such as when the query is declared explicitly in terms of a doublevalued scalar – see ComputePointPairPenetration()). In other cases, where the query is expressed in terms of scalar
T
, the query may have restrictions. If a query has restricted scalar support, it is included in the query’s documentation.
__init__
(self: pydrake.geometry.QueryObject_[float]) → None¶ Constructs a default QueryObject (all pointers are null).

ComputePointPairPenetration
(self: pydrake.geometry.QueryObject_[float]) → List[drake::geometry::PenetrationAsPointPair<double>]¶ Computes the penetrations across all pairs of geometries in the world with the penetrations characterized by pairs of points (see PenetrationAsPointPair), providing some measure of the penetration “depth” of the two objects, but not the overlapping volume.
Only reports results for penetrating geometries; if two geometries are separated, there will be no result for that pair. Geometries whose surfaces are just touching (osculating) are not considered in penetration. Surfaces whose penetration is within an epsilon of osculation, are likewise not considered penetrating. Pairs of anchored geometry are also not reported. This method is affected by collision filtering.
For two penetrating geometries g_A and g_B, it is guaranteed that they will map to
id_A
andid_B
in a fixed, repeatable manner.Scalar and Shape Support
 For scalar type
double
, we support all ShapeShape pairs except for
HalfSpaceHalfSpace. In that case, half spaces are either noncolliding or have an infinite amount of penetration.  For scalar type AutoDiffXd, we only support query pairs SphereBox, SphereCapsule, SphereCylinder, SphereHalfSpace, and SphereSphere.
For a ShapeShape pair in collision that is not supported for a given scalar type, an exception is thrown.
Returns: A vector populated with all detected penetrations characterized as point pairs. The ordering of the results is guaranteed to be consistent – for fixed geometry poses, the results will remain the same. Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
Raises:  RuntimeError if unsupported pairs are in contact (see “Scalar and
 Shape Support” for description of “unsupported pairs”).
 For scalar type

ComputeSignedDistancePairClosestPoints
(*args, **kwargs)¶ Overloaded function.
 ComputeSignedDistancePairClosestPoints(self: pydrake.geometry.QueryObject_[float], geometry_id_A: pydrake.geometry.GeometryId, geometry_id_B: pydrake.geometry.GeometryId) > drake::geometry::SignedDistancePair<double>
A variant of ComputeSignedDistancePairwiseClosestPoints() which computes the signed distance (and witnesses) between a specific pair of geometries indicated by id. This function has the same restrictions on scalar report as ComputeSignedDistancePairwiseClosestPoints().
Raises:  RuntimeError if either geometry id is invalid, or if the pair (A,
 has been marked as filtered.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
 ComputeSignedDistancePairClosestPoints(self: pydrake.geometry.QueryObject_[float], id_A: pydrake.geometry.GeometryId, id_B: pydrake.geometry.GeometryId) > drake::geometry::SignedDistancePair<double>
A variant of ComputeSignedDistancePairwiseClosestPoints() which computes the signed distance (and witnesses) between a specific pair of geometries indicated by id. This function has the same restrictions on scalar report as ComputeSignedDistancePairwiseClosestPoints().
Raises:  RuntimeError if either geometry id is invalid, or if the pair (A,
 has been marked as filtered.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.

ComputeSignedDistancePairwiseClosestPoints
(self: pydrake.geometry.QueryObject_[float], max_distance: float = inf) → List[drake::geometry::SignedDistancePair<double>]¶ Computes the signed distance together with the nearest points across all pairs of geometries in the world. Reports both the separating geometries and penetrating geometries.
This query provides φ(A, B), the signed distance between two objects A and B.
If the objects do not overlap (i.e., A ⋂ B = ∅), φ > 0 and represents the minimal distance between the two objects. More formally: φ = min(Aₚ  Bₚ) ∀ Aₚ ∈ A and Bₚ ∈ B.
Note
The pair (Aₚ, Bₚ) is a “witness” of the distance. The pair need not be unique (think of two parallel planes).
If the objects touch or overlap (i.e., A ⋂ B ≠ ∅), φ ≤ 0 and can be interpreted as the negative penetration depth. It is the smallest length of the vector v, such that by shifting one object along that vector relative to the other, the two objects will no longer be overlapping. More formally, φ(A, B) = min v. s.t (Tᵥ · A) ⋂ B = ∅ where Tᵥ is a rigid transformation that displaces A by the vector v, namely Tᵥ · A = {u + v  ∀ u ∈ A}. By implication, there exist points Aₚ and Bₚ on the surfaces of objects A and B, respectively, such that Aₚ + v = Bₚ, Aₚ ∈ A ∩ B, Bₚ ∈ A ∩ B. These points are the witnesses to the penetration.
This method is affected by collision filtering; geometry pairs that have been filtered will not produce signed distance query results.
For a geometry pair (A, B), the returned results will always be reported in a fixed order (e.g., always (A, B) and never (B, A)). The basis for the ordering is arbitrary (and therefore undocumented), but guaranteed to be fixed and repeatable.
Notice that this is an O(N²) operation, where N is the number of geometries remaining in the world after applying collision filter. We report the distance between dynamic objects, and between dynamic and anchored objects. We DO NOT report the distance between two anchored objects.
Scalar support
This function does not support halfspaces. If an unfiltered pair contains a halfspace, an exception will be thrown for all scalar types. Otherwise, this query supports all other pairs of Drake geometry types for
double
. ForAutoDiffXd
, it only supports distance between spherebox and spheresphere. If there are any unfiltered geometry pairs that include other geometries, the AutoDiff throws an exception. Parameter
max_distance
:  The maximum distance at which distance data is reported.
Returns: The signed distance (and supporting data) for all unfiltered geometry pairs whose distance is less than or equal to max_distance
.Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.
 Parameter

ComputeSignedDistanceToPoint
(self: pydrake.geometry.QueryObject_[float], p_WQ: numpy.ndarray[numpy.float64[3, 1]], threshold: float = inf) → List[drake::geometry::SignedDistanceToPoint<double>]¶ Computes the signed distances and gradients to a query point from each geometry in the scene.
Warning
Currently supports spheres, boxes, and cylinders only. Silently ignores other kinds of geometries, which will be added later.
This query provides φᵢ(p), φᵢ:ℝ³→ℝ, the signed distance to the position p of a query point from geometry Gᵢ in the scene. It returns an array of the signed distances from all geometries.
Optionally you can specify a threshold distance that will filter out any object beyond the threshold. By default, we report distances from the query point to every object.
This query also provides the gradient vector ∇φᵢ(p) of the signed distance function from geometry Gᵢ. Note that, in general, if p is outside Gᵢ, then ∇φᵢ(p) equals the unit vector in the direction from the nearest point Nᵢ on Gᵢ’s surface to p. If p is inside Gᵢ, then ∇φᵢ(p) is in the direction from p to Nᵢ. This observation is written formally as:
∇φᵢ(p) = (p  Nᵢ)/p  Nᵢ if p is outside Gᵢ
∇φᵢ(p) = (p  Nᵢ)/p  Nᵢ if p is inside Gᵢ
Note that ∇φᵢ(p) is also defined on Gᵢ’s surface, but we cannot use the above formula.
Scalar support
This query only supports computing distances from the point to spheres, boxes, and cylinders for both
double
andAutoDiffXd
scalar types. If the SceneGraph contains any other geometry shapes, they will be silently ignored.Note
For a sphere G, the signed distance function φᵢ(p) has an undefined gradient vector at the center of the sphere–every point on the sphere’s surface has the same distance to the center. In this case, we will assign ∇φᵢ(p) the unit vector Gx (xdirectional vector of G’s frame) expressed in World frame.
Note
For a box, at a point p on an edge or a corner of the box, the signed distance function φᵢ(p) has an undefined gradient vector. In this case, we will assign a unit vector in the direction of the average of the outward face unit normals of the incident faces of the edge or the corner. A point p is considered being on a face, or an edge, or a corner of the box if it lies within a certain tolerance from them.
Note
For a box B, if a point p is inside the box, and it is equidistant to to multiple nearest faces, the signed distance function φᵢ(p) at p will have an undefined gradient vector. There is a nearest point candidate associated with each nearest face. In this case, we arbitrarily pick the point Nᵢ associated with one of the nearest faces. Please note that, due to the possible round off error arising from applying a pose X_WG to B, there is no guarantee which of the nearest faces will be used.
Note
The signed distance function is a continuous function with respect to the position of the query point, but its gradient vector field may not be continuous. Specifically at a position equidistant to multiple nearest points, its gradient vector field is not continuous.
Note
For a convex object, outside the object at positive distance from the boundary, the signed distance function is smooth (having continuous firstorder partial derivatives).
 Parameter
p_WQ
:  Position of a query point Q in world frame W.
 Parameter
threshold
:  We ignore any object beyond this distance. By default, it is infinity, so we report distances from the query point to every object.
 Returns
signed_distances
:  A vector populated with perobject signed distance values (and supporting data). See SignedDistanceToPoint.
 Parameter

FindCollisionCandidates
(self: pydrake.geometry.QueryObject_[float]) → List[drake::SortedPair<drake::geometry::GeometryId>]¶ Applies a conservative culling mechanism to create a subset of all possible geometry pairs based on nonzero intersections. A geometry pair that is absent from the results is either a) culled by collision filters or b) known to be separated. The caller is responsible for confirming that the remaining, unculled geometry pairs are actually in collision.
Returns: A vector populated with collision pair candidates (the order will remain constant for a fixed population but can change as geometry ids are added/removed).

GetPoseInParent
(self: pydrake.geometry.QueryObject_[float], frame_id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[float]¶ Reports the position of the frame indicated by
frame_id
relative to its parent frame. If the frame was registered with the world frame as its parent frame, this value will be identical to that returned by GetPoseInWorld().Note
This is analogous to but distinct from SceneGraphInspector::GetPoseInParent(). In this case, the pose will always be relative to another frame.
Raises: RuntimeError if the frame frame_id
is not valid.

GetPoseInWorld
(*args, **kwargs)¶ Overloaded function.
 GetPoseInWorld(self: pydrake.geometry.QueryObject_[float], frame_id: pydrake.geometry.FrameId) > pydrake.math.RigidTransform_[float]
Reports the position of the frame indicated by
frame_id
relative to the world frame.Raises: RuntimeError if the frame frame_id
is not valid. GetPoseInWorld(self: pydrake.geometry.QueryObject_[float], geometry_id: pydrake.geometry.GeometryId) > pydrake.math.RigidTransform_[float]
Reports the position of the geometry indicated by
geometry_id
relative to the world frame.Raises: RuntimeError if the geometry geometry_id
is not valid.

HasCollisions
(self: pydrake.geometry.QueryObject_[float]) → bool¶ Reports true if there are any collisions between unfiltered pairs in the world.
Warning
For Mesh shapes, their convex hulls are used in this query. It is not* computationally efficient or particularly accurate.

inspector
(self: pydrake.geometry.QueryObject_[float]) → pydrake.geometry.SceneGraphInspector_[float]¶ Provides an inspector for the topological structure of the underlying scene graph data (see SceneGraphInspector for details).

RenderColorImage
(*args, **kwargs)¶ Overloaded function.
 RenderColorImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::ColorRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)2>
Renders an RGB image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
color_image_out
:  The rendered color image.
 RenderColorImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::CameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float], show_window: bool = False) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)2>
Renders an RGB image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
show_window
:  If true, the render window will be displayed.
 Parameter
color_image_out
:  The rendered color image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the ColorRenderCamera variant. This will be removed from Drake on or after 20210401.

RenderDepthImage
(*args, **kwargs)¶ Overloaded function.
 RenderDepthImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::DepthRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)6>
Renders a depth image for the given
camera
posed with respect to the indicated parent frame P.In contrast to the other rendering methods, rendering depth images doesn’t provide the option to display the window; generally, basic depth images are not readily communicative to humans.
 Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
depth_image_out
:  The rendered depth image.
 RenderDepthImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::DepthCameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)6>
Renders a depth image for the given
camera
posed with respect to the indicated parent frame P.In contrast to the other rendering methods, rendering depth images doesn’t provide the option to display the window; generally, basic depth images are not readily communicative to humans.
 Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
depth_image_out
:  The rendered depth image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the DepthRenderCamera variant. This will be removed from Drake on or after 20210401.

RenderLabelImage
(*args, **kwargs)¶ Overloaded function.
 RenderLabelImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::ColorRenderCamera, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float]) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)7>
Renders a label image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The camera to render from.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
label_image_out
:  The rendered label image.
 RenderLabelImage(self: pydrake.geometry.QueryObject_[float], camera: drake::geometry::render::CameraProperties, parent_frame: pydrake.geometry.FrameId, X_PC: pydrake.math.RigidTransform_[float], show_window: bool = False) > drake::systems::sensors::Image<(drake::systems::sensors::PixelType)7>
Renders a label image for the given
camera
posed with respect to the indicated parent frame P. Parameter
camera
:  The intrinsic properties of the camera.
 Parameter
parent_frame
:  The id for the camera’s parent frame.
 Parameter
X_PC
:  The pose of the camera body in the parent frame.
 Parameter
show_window
:  If true, the render window will be displayed.
 Parameter
label_image_out
:  The rendered label image. */ (Deprecated.)
 Deprecated:
 CameraProperties are being deprecated. Please use the ColorRenderCamera variant. This will be removed from Drake on or after 20210401.

X_PF
(self: pydrake.geometry.QueryObject_[float], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[float]¶ Deprecated variant of GetPoseInParent(). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInParent(FrameId) instead. This will be removed from Drake on or after 20210401.

X_WF
(self: pydrake.geometry.QueryObject_[float], id: pydrake.geometry.FrameId) → pydrake.math.RigidTransform_[float]¶ Deprecated variant of GetPoseInWorld(FrameId). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInWorld(FrameId) instead. This will be removed from Drake on or after 20210401.

X_WG
(self: pydrake.geometry.QueryObject_[float], id: pydrake.geometry.GeometryId) → pydrake.math.RigidTransform_[float]¶ Deprecated variant of GetPoseInWorld(GeometryId). */ (Deprecated.)
 Deprecated:
 Please use GetPoseInWorld(GeometryId) instead. This will be removed from Drake on or after 20210401.


pydrake.geometry.
ReadObjToSurfaceMesh
(filename: str, scale: float = 1.0) → drake::geometry::SurfaceMesh<double>¶ Constructs a surface mesh from a Wavefront .obj file and optionally scales coordinates by the given scale factor. Polygons will be triangulated if they are not triangles already. All objects in the .obj file will be merged into the surface mesh. See https://en.wikipedia.org/wiki/Wavefront_.obj_file for the file format.
 Parameter
filename
:  A valid file name with absolute path or relative path.
 Parameter
scale
:  An optional scale to coordinates.
Raises:  RuntimeError if
filename
doesn’t have a valid file path, or  the file has no faces.
Returns: surface mesh
 Parameter

class
pydrake.geometry.
Rgba
¶ Defines RGBA (red, green, blue, alpha) values on the range [0, 1].

__init__
(self: pydrake.geometry.Rgba, r: float, g: float, b: float, a: float = 1.0) → None¶ Constructs with given (r, g, b, a) values.
 Precondition:
 All values are within the range of [0, 1].

a
(self: pydrake.geometry.Rgba) → float¶ Alpha.

b
(self: pydrake.geometry.Rgba) → float¶ Blue.

g
(self: pydrake.geometry.Rgba) → float¶ Green.

r
(self: pydrake.geometry.Rgba) → float¶ Red.

set
(self: pydrake.geometry.Rgba, r: float, g: float, b: float, a: float = 1.0) → None¶ Sets (r, g, b, a) values.
 Precondition:
 All values are within the range of [0, 1]. The values are not updated if this precondition is not met.


class
pydrake.geometry.
Role
¶ General enumeration for indicating geometry role.
Members:
kUnassigned :
kProximity :
kIllustration :
kPerception :

__init__
(self: pydrake.geometry.Role, arg0: int) → None¶

kIllustration
= Role.kIllustration¶

kPerception
= Role.kPerception¶

kProximity
= Role.kProximity¶

kUnassigned
= Role.kUnassigned¶

name
¶


class
pydrake.geometry.
RoleAssign
¶ The operations that can be performed on the given properties when assigning roles to geometry.
Members:
kNew : Assign the properties to a geometry that doesn’t already have therole.
kReplace : Replace the existing role properties completely.
__init__
(self: pydrake.geometry.RoleAssign, arg0: int) → None¶

kNew
= RoleAssign.kNew¶

kReplace
= RoleAssign.kReplace¶

name
¶


pydrake.geometry.
SceneGraph
¶ alias of
pydrake.geometry.SceneGraph_[float]

template
pydrake.geometry.
SceneGraph_
¶ Instantiations:
SceneGraph_[float]
,SceneGraph_[AutoDiffXd]

class
SceneGraph_[float]
¶ Bases:
pydrake.systems.framework.LeafSystem_[float]
SceneGraph serves as the nexus for all geometry (and geometrybased 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{N1}→ 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 abstractvalued 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 abstractvalued 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 abstractvalued 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 contextdependent 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 QueryObjectvalued 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 uptodate 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 runtime 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 Contextmodifying 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.
The geometry data associated with SceneGraph is coarsely versioned. Consumers of the geometry can query for the version of the data and recognize if the data has been modified since last examined.
The versioning is associated with geometry roles: proximity, illustration, and perception; each role has its own, independent version. Any operation that affects geometry with one of those roles will modify the corresponding version. For example:
// Does *not* modify any version; no roles have been assigned. const GeometryId geometry_id = scene_graph.RegisterGeometry( source_id, frame_id, make_unique<GeometryInstance>(...)); // Modifies the proximity version. scene_graph.AssignRole(source_id, geometry_id, ProximityProperties()); // Modifies the illustration version. scene_graph.AssignRole(source_id, geometry_id, IllustrationProperties()); // Modifies the perception version if there exists a renderer that accepts the // geometry. scene_graph.AssignRole(source_id, geometry_id, PerceptionProperties()); // Modifies the illustration version. scene_graph.RemoveRole(source_id, geometry_id, Role::kIllustration); // Modifies proximity version and perception version if the geometry is // registered with any renderer. scene_graph.RemoveGeometry(source_id, geometry_id);
Each copy of geometry data maintains its own set of versions. SceneGraph’s model has its own version, and that version is the same as the version in the Context provided by SceneGraph::CreateDefaultContext(). Modifications to the geometry data contained in a Context modifies that data’s version, but the original model data’s version is unmodified, reflecting the unchanged model data.
The geometry data’s version is accessed via a SceneGraphInspector instance. model_inspector() will give access to SceneGraph’s model version. And QueryObject::inspector() will give access to the geometry data stored in a Context.
Current versions can be compared against previously examined versions. If the versions match, then the geometry data is guaranteed to be the same. If they don’t match, that indicates that the two sets of data underwent different revision processes. That, however, doesn’t necessarily imply that the two sets of data are distinct. In other words, the versioning will report a difference unless it can guarantee equivalence.
It is possible that two different contexts have different versions and a downstream system can be evaluated with each context alternatingly. If the system behavior depends on the geometry version, this will cause it to thrash whatever components depends on geometry version. The system should clearly document this fact.

__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::ColorRenderCamera “ColorRenderCamera” or render::DepthRenderCamera “DepthRenderCamera” 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());
Modifies the perception version if
renderer
accepts any previously existing geometries (see scene_graph_versioning). 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
. Modifies the proximity version (see scene_graph_versioning). 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::Contextmodifying 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. Modifies the perception version if the geometry is added to any renderer (see scene_graph_versioning).
 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::Contextmodifying 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
. Modifies the illustration version (see scene_graph_versioning).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::Contextmodifying 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. Modifies the proximity version (see scene_graph_versioning).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::Contextmodifying 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. Modifies the proximity version (see scene_graph_versioning).
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::Contextmodifying 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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 contextdependent 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
. Potentially modifies the proximity, perception, or illustration version based on the role being removed from the geometry (see scene_graph_versioning).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.

class

class
pydrake.geometry.
SceneGraph_[AutoDiffXd]
¶ Bases:
pydrake.systems.framework.LeafSystem_[AutoDiffXd]
SceneGraph serves as the nexus for all geometry (and geometrybased 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{N1}→ 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 abstractvalued 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 abstractvalued 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 abstractvalued 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 contextdependent 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 QueryObjectvalued 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 uptodate 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 runtime 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 Contextmodifying 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.
The geometry data associated with SceneGraph is coarsely versioned. Consumers of the geometry can query for the version of the data and recognize if the data has been modified since last examined.
The versioning is associated with geometry roles: proximity, illustration, and perception; each role has its own, independent version. Any operation that affects geometry with one of those roles will modify the corresponding version. For example:
// Does *not* modify any version; no roles have been assigned. const GeometryId geometry_id = scene_graph.RegisterGeometry( source_id, frame_id, make_unique<GeometryInstance>(...)); // Modifies the proximity version. scene_graph.AssignRole(source_id, geometry_id, ProximityProperties()); // Modifies the illustration version. scene_graph.AssignRole(source_id, geometry_id, IllustrationProperties()); // Modifies the perception version if there exists a renderer that accepts the // geometry. scene_graph.AssignRole(source_id, geometry_id, PerceptionProperties()); // Modifies the illustration version. scene_graph.RemoveRole(source_id, geometry_id, Role::kIllustration); // Modifies proximity version and perception version if the geometry is // registered with any renderer. scene_graph.RemoveGeometry(source_id, geometry_id);
Each copy of geometry data maintains its own set of versions. SceneGraph’s model has its own version, and that version is the same as the version in the Context provided by SceneGraph::CreateDefaultContext(). Modifications to the geometry data contained in a Context modifies that data’s version, but the original model data’s version is unmodified, reflecting the unchanged model data.
The geometry data’s version is accessed via a SceneGraphInspector instance. model_inspector() will give access to SceneGraph’s model version. And QueryObject::inspector() will give access to the geometry data stored in a Context.
Current versions can be compared against previously examined versions. If the versions match, then the geometry data is guaranteed to be the same. If they don’t match, that indicates that the two sets of data underwent different revision processes. That, however, doesn’t necessarily imply that the two sets of data are distinct. In other words, the versioning will report a difference unless it can guarantee equivalence.
It is possible that two different contexts have different versions and a downstream system can be evaluated with each context alternatingly. If the system behavior depends on the geometry version, this will cause it to thrash whatever components depends on geometry version. The system should clearly document this fact.

__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::ColorRenderCamera “ColorRenderCamera” or render::DepthRenderCamera “DepthRenderCamera” 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());
Modifies the perception version if
renderer
accepts any previously existing geometries (see scene_graph_versioning). 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
. Modifies the proximity version (see scene_graph_versioning). 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::Contextmodifying 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. Modifies the perception version if the geometry is added to any renderer (see scene_graph_versioning).
 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::Contextmodifying 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
. Modifies the illustration version (see scene_graph_versioning).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::Contextmodifying 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. Modifies the proximity version (see scene_graph_versioning).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::Contextmodifying 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. Modifies the proximity version (see scene_graph_versioning).
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::Contextmodifying 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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 contextdependent 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
. Potentially modifies the proximity, perception, or illustration version based on the role being removed from the geometry (see scene_graph_versioning).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 geometrybased 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{N1}→ 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 abstractvalued 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 abstractvalued 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 abstractvalued 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 contextdependent 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 QueryObjectvalued 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 uptodate 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 runtime 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 Contextmodifying 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.
The geometry data associated with SceneGraph is coarsely versioned. Consumers of the geometry can query for the version of the data and recognize if the data has been modified since last examined.
The versioning is associated with geometry roles: proximity, illustration, and perception; each role has its own, independent version. Any operation that affects geometry with one of those roles will modify the corresponding version. For example:
// Does *not* modify any version; no roles have been assigned. const GeometryId geometry_id = scene_graph.RegisterGeometry( source_id, frame_id, make_unique<GeometryInstance>(...)); // Modifies the proximity version. scene_graph.AssignRole(source_id, geometry_id, ProximityProperties()); // Modifies the illustration version. scene_graph.AssignRole(source_id, geometry_id, IllustrationProperties()); // Modifies the perception version if there exists a renderer that accepts the // geometry. scene_graph.AssignRole(source_id, geometry_id, PerceptionProperties()); // Modifies the illustration version. scene_graph.RemoveRole(source_id, geometry_id, Role::kIllustration); // Modifies proximity version and perception version if the geometry is // registered with any renderer. scene_graph.RemoveGeometry(source_id, geometry_id);
Each copy of geometry data maintains its own set of versions. SceneGraph’s model has its own version, and that version is the same as the version in the Context provided by SceneGraph::CreateDefaultContext(). Modifications to the geometry data contained in a Context modifies that data’s version, but the original model data’s version is unmodified, reflecting the unchanged model data.
The geometry data’s version is accessed via a SceneGraphInspector instance. model_inspector() will give access to SceneGraph’s model version. And QueryObject::inspector() will give access to the geometry data stored in a Context.
Current versions can be compared against previously examined versions. If the versions match, then the geometry data is guaranteed to be the same. If they don’t match, that indicates that the two sets of data underwent different revision processes. That, however, doesn’t necessarily imply that the two sets of data are distinct. In other words, the versioning will report a difference unless it can guarantee equivalence.
It is possible that two different contexts have different versions and a downstream system can be evaluated with each context alternatingly. If the system behavior depends on the geometry version, this will cause it to thrash whatever components depends on geometry version. The system should clearly document this fact.

__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::ColorRenderCamera “ColorRenderCamera” or render::DepthRenderCamera “DepthRenderCamera” 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());
Modifies the perception version if
renderer
accepts any previously existing geometries (see scene_graph_versioning). 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
. Modifies the proximity version (see scene_graph_versioning). 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::Contextmodifying 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. Modifies the perception version if the geometry is added to any renderer (see scene_graph_versioning).
 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::Contextmodifying 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
. Modifies the illustration version (see scene_graph_versioning).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::Contextmodifying 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. Modifies the proximity version (see scene_graph_versioning).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::Contextmodifying 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. Modifies the proximity version (see scene_graph_versioning).
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::Contextmodifying 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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. Potentially modifies proximity, perception, and illustration versions based on the roles assigned to the geometry (see scene_graph_versioning).
 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 contextdependent 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
. Potentially modifies the proximity, perception, or illustration version based on the role being removed from the geometry (see scene_graph_versioning).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.

all_frame_ids
(self: pydrake.geometry.SceneGraphInspector_[float]) → List[pydrake.geometry.FrameId]¶ Provides a range object for all of the frame ids in the scene graph. The order is not generally guaranteed; but it will be consistent as long as there are no changes to the topology. This is intended to be used as:
for (FrameId id : inspector.all_frame_ids()) { ... }
This includes the id for the world frame.

BelongsToSource
(*args, **kwargs)¶ Overloaded function.
 BelongsToSource(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId, source_id: pydrake.geometry.SourceId) > bool
Reports if the frame with given
frame_id
was registered to the source with the givensource_id
. Parameter
frame_id
:  The query frame id.
 Parameter
source_id
:  The query source id.
Returns: True if
frame_id
was registered onsource_id
.Raises:  RuntimeError If
frame_id
does not map to a registered frame or source_id
does not map to a registered source.
 BelongsToSource(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId, source_id: pydrake.geometry.SourceId) > bool
Reports if the given geometry id was registered to the source with the given source id.
 Parameter
geometry_id
:  The query geometry id.
 Parameter
source_id
:  The query source id.
Returns: True if
geometry_id
was registered onsource_id
.Raises:  RuntimeError If
geometry_id
does not map to a registered  geometry or
source_id
does not map to a registered source.

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
geometry_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
geometry_id
does not refer to a valid geometry.
 RuntimeError if the

CollisionFiltered
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id1: pydrake.geometry.GeometryId, geometry_id2: pydrake.geometry.GeometryId) → bool¶ Reports true if the two geometries with given ids
geometry_id1
andgeometry_id2
, define a collision pair that has been filtered out.Raises:  RuntimeError if either id does not map to a registered geometry or
 if any of the geometries do not have a proximity role.

FramesForSource
(self: pydrake.geometry.SceneGraphInspector_[float], source_id: pydrake.geometry.SourceId) → Set[pydrake.geometry.FrameId]¶ Reports the ids of all of the frames registered to the source with the given source
source_id
.Raises: RuntimeError if source_id
does not map to a registered source.

geometry_version
(self: pydrake.geometry.SceneGraphInspector_[float]) → pydrake.geometry.GeometryVersion¶ Returns the geometry version that can be used to detect changes to the geometry data associated with geometry roles. The reference returned should not be persisted. If it needs to be persisted, it should be copied.

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).

GetCollisionCandidates
(self: pydrake.geometry.SceneGraphInspector_[float]) → Set[Tuple[pydrake.geometry.GeometryId, pydrake.geometry.GeometryId]]¶ Returns all pairs of geometries that are candidates for collision (in no particular order). See SceneGraph::ExcludeCollisionsBetween() or SceneGraph::ExcludeCollisionsWithin() for information on why a particular pair may not be a candidate. For candidate pair (A, B), the candidate is always guaranteed to be reported in a fixed order (i.e., always (A, B) and never (B, A)). This is the same ordering as would be returned by, e.g., QueryObject::ComputePointPairPenetration().

GetFrameGroup
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) → int¶ Reports the frame group for the frame with the given
frame_id
.Raises:  RuntimeError if
frame_id
does not map to a registered frame.  This value is equivalent to the old “model instance id”.
 RuntimeError if

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
geometry_id
is registered.Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 RuntimeError if

GetGeometries
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId, role: Optional[pydrake.geometry.Role] = None) → List[pydrake.geometry.GeometryId]¶ Returns geometry ids that have been registered directly to the frame indicated by
frame_id
. If arole
is provided, only geometries with that role assigned will be returned, otherwise all geometries will be returned. Parameter
frame_id
:  The id of the frame in question.
 Parameter
role
:  The requested role; if omitted, all geometries registered to the frame are returned.
Returns: The requested unique geometry ids in a consistent order. Raises: RuntimeError if id
does not map to a registered frame. Parameter

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 frameframe_id
. Parameter
frame_id
:  The frame_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
frame_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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 Parameter

GetName
(*args, **kwargs)¶ Overloaded function.
 GetName(self: pydrake.geometry.SceneGraphInspector_[float], source_id: pydrake.geometry.SourceId) > str
Reports the name for the source with the given
source_id
.Raises: RuntimeError if source_id
does not map to a registered source. GetName(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) > str
Reports the name of the frame with the given
frame_id
.Raises: RuntimeError if frame_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
geometry_id
(see canonicalized_geometry_names “GeometryInstance” for details).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.

GetOwningSourceName
(*args, **kwargs)¶ Overloaded function.
 GetOwningSourceName(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) > str
Reports the name of the geometry source that registered the frame with the given
frame_id
.Raises: RuntimeError If frame_id
does not map to a registered frame. GetOwningSourceName(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) > str
Reports the name of the geometry source that registered the geometry with the given
geometry_id
.Raises:  RuntimeError If
geometry_id
does not map to a registered geometry.

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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_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
geometry_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
geometry_id
does not map to a registered geometry.
 RuntimeError if

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
geometry_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
geometry_id
does not map to a registered geometry.
 RuntimeError if

GetProperties
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId, role: pydrake.geometry.Role) → pydrake.geometry.GeometryProperties¶ Return a pointer to the const properties indicated by
role
of the geometry with the givengeometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
 Parameter
role
:  The role whose properties are acquired.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 Parameter

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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_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
geometry_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], source_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. */ (Deprecated.)
 Deprecated:
 Please use GetName(SourceId) instead. This will be removed from Drake on or after 20210401.
 RuntimeError if

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.

NumFramesForSource
(self: pydrake.geometry.SceneGraphInspector_[float], source_id: pydrake.geometry.SourceId) → int¶ Reports the number of frames registered to the source with the given
source_id
.Raises: RuntimeError if source_id
does not map to a registered source.

NumGeometriesForFrame
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) → int¶ Reports the number of geometries affixed to the frame with the given
frame_id
. This count does not include geometries attached to frames that are descendants of this frame.Raises: RuntimeError if frame_id
does not map to a registered frame.

NumGeometriesForFrameWithRole
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId, role: pydrake.geometry.Role) → int¶ Reports the total number of geometries with the given
role
directly registered to the frame with the givenframe_id
. This count does not include geometries attached to frames that are descendants of this frame.Raises: RuntimeError if frame_id
does not map to a registered frame.

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
(*args, **kwargs)¶ Overloaded function.
 SourceIsRegistered(self: pydrake.geometry.SceneGraphInspector_[float], source_id: pydrake.geometry.SourceId) > bool
Reports
True
if the givensource_id
maps to a registered source. SourceIsRegistered(self: pydrake.geometry.SceneGraphInspector_[float], id: pydrake.geometry.SourceId) > bool
Reports
True
if the givensource_id
maps to a registered source.

world_frame_id
(self: pydrake.geometry.SceneGraphInspector_[float]) → pydrake.geometry.FrameId¶ Reports the id for the world frame.

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.

all_frame_ids
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → List[pydrake.geometry.FrameId]¶ Provides a range object for all of the frame ids in the scene graph. The order is not generally guaranteed; but it will be consistent as long as there are no changes to the topology. This is intended to be used as:
for (FrameId id : inspector.all_frame_ids()) { ... }
This includes the id for the world frame.

BelongsToSource
(*args, **kwargs)¶ Overloaded function.
 BelongsToSource(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId, source_id: pydrake.geometry.SourceId) > bool
Reports if the frame with given
frame_id
was registered to the source with the givensource_id
. Parameter
frame_id
:  The query frame id.
 Parameter
source_id
:  The query source id.
Returns: True if
frame_id
was registered onsource_id
.Raises:  RuntimeError If
frame_id
does not map to a registered frame or source_id
does not map to a registered source.
 BelongsToSource(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId, source_id: pydrake.geometry.SourceId) > bool
Reports if the given geometry id was registered to the source with the given source id.
 Parameter
geometry_id
:  The query geometry id.
 Parameter
source_id
:  The query source id.
Returns: True if
geometry_id
was registered onsource_id
.Raises:  RuntimeError If
geometry_id
does not map to a registered  geometry or
source_id
does not map to a registered source.

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
geometry_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
geometry_id
does not refer to a valid geometry.
 RuntimeError if the

CollisionFiltered
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id1: pydrake.geometry.GeometryId, geometry_id2: pydrake.geometry.GeometryId) → bool¶ Reports true if the two geometries with given ids
geometry_id1
andgeometry_id2
, define a collision pair that has been filtered out.Raises:  RuntimeError if either id does not map to a registered geometry or
 if any of the geometries do not have a proximity role.

FramesForSource
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], source_id: pydrake.geometry.SourceId) → Set[pydrake.geometry.FrameId]¶ Reports the ids of all of the frames registered to the source with the given source
source_id
.Raises: RuntimeError if source_id
does not map to a registered source.

geometry_version
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → pydrake.geometry.GeometryVersion¶ Returns the geometry version that can be used to detect changes to the geometry data associated with geometry roles. The reference returned should not be persisted. If it needs to be persisted, it should be copied.

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).

GetCollisionCandidates
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → Set[Tuple[pydrake.geometry.GeometryId, pydrake.geometry.GeometryId]]¶ Returns all pairs of geometries that are candidates for collision (in no particular order). See SceneGraph::ExcludeCollisionsBetween() or SceneGraph::ExcludeCollisionsWithin() for information on why a particular pair may not be a candidate. For candidate pair (A, B), the candidate is always guaranteed to be reported in a fixed order (i.e., always (A, B) and never (B, A)). This is the same ordering as would be returned by, e.g., QueryObject::ComputePointPairPenetration().

GetFrameGroup
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId) → int¶ Reports the frame group for the frame with the given
frame_id
.Raises:  RuntimeError if
frame_id
does not map to a registered frame.  This value is equivalent to the old “model instance id”.
 RuntimeError if

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
geometry_id
is registered.Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 RuntimeError if

GetGeometries
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId, role: Optional[pydrake.geometry.Role] = None) → List[pydrake.geometry.GeometryId]¶ Returns geometry ids that have been registered directly to the frame indicated by
frame_id
. If arole
is provided, only geometries with that role assigned will be returned, otherwise all geometries will be returned. Parameter
frame_id
:  The id of the frame in question.
 Parameter
role
:  The requested role; if omitted, all geometries registered to the frame are returned.
Returns: The requested unique geometry ids in a consistent order. Raises: RuntimeError if id
does not map to a registered frame. Parameter

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 frameframe_id
. Parameter
frame_id
:  The frame_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
frame_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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 Parameter

GetName
(*args, **kwargs)¶ Overloaded function.
 GetName(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], source_id: pydrake.geometry.SourceId) > str
Reports the name for the source with the given
source_id
.Raises: RuntimeError if source_id
does not map to a registered source. GetName(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId) > str
Reports the name of the frame with the given
frame_id
.Raises: RuntimeError if frame_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
geometry_id
(see canonicalized_geometry_names “GeometryInstance” for details).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.

GetOwningSourceName
(*args, **kwargs)¶ Overloaded function.
 GetOwningSourceName(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId) > str
Reports the name of the geometry source that registered the frame with the given
frame_id
.Raises: RuntimeError If frame_id
does not map to a registered frame. GetOwningSourceName(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId) > str
Reports the name of the geometry source that registered the geometry with the given
geometry_id
.Raises:  RuntimeError If
geometry_id
does not map to a registered geometry.

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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_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
geometry_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
geometry_id
does not map to a registered geometry.
 RuntimeError if

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
geometry_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
geometry_id
does not map to a registered geometry.
 RuntimeError if

GetProperties
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], geometry_id: pydrake.geometry.GeometryId, role: pydrake.geometry.Role) → pydrake.geometry.GeometryProperties¶ Return a pointer to the const properties indicated by
role
of the geometry with the givengeometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
 Parameter
role
:  The role whose properties are acquired.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 Parameter

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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_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
geometry_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], source_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. */ (Deprecated.)
 Deprecated:
 Please use GetName(SourceId) instead. This will be removed from Drake on or after 20210401.
 RuntimeError if

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.

NumFramesForSource
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], source_id: pydrake.geometry.SourceId) → int¶ Reports the number of frames registered to the source with the given
source_id
.Raises: RuntimeError if source_id
does not map to a registered source.

NumGeometriesForFrame
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId) → int¶ Reports the number of geometries affixed to the frame with the given
frame_id
. This count does not include geometries attached to frames that are descendants of this frame.Raises: RuntimeError if frame_id
does not map to a registered frame.

NumGeometriesForFrameWithRole
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], frame_id: pydrake.geometry.FrameId, role: pydrake.geometry.Role) → int¶ Reports the total number of geometries with the given
role
directly registered to the frame with the givenframe_id
. This count does not include geometries attached to frames that are descendants of this frame.Raises: RuntimeError if frame_id
does not map to a registered frame.

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
(*args, **kwargs)¶ Overloaded function.
 SourceIsRegistered(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], source_id: pydrake.geometry.SourceId) > bool
Reports
True
if the givensource_id
maps to a registered source. SourceIsRegistered(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd], id: pydrake.geometry.SourceId) > bool
Reports
True
if the givensource_id
maps to a registered source.

world_frame_id
(self: pydrake.geometry.SceneGraphInspector_[AutoDiffXd]) → pydrake.geometry.FrameId¶ Reports the id for the world frame.

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.

all_frame_ids
(self: pydrake.geometry.SceneGraphInspector_[float]) → List[pydrake.geometry.FrameId]¶ Provides a range object for all of the frame ids in the scene graph. The order is not generally guaranteed; but it will be consistent as long as there are no changes to the topology. This is intended to be used as:
for (FrameId id : inspector.all_frame_ids()) { ... }
This includes the id for the world frame.

BelongsToSource
(*args, **kwargs)¶ Overloaded function.
 BelongsToSource(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId, source_id: pydrake.geometry.SourceId) > bool
Reports if the frame with given
frame_id
was registered to the source with the givensource_id
. Parameter
frame_id
:  The query frame id.
 Parameter
source_id
:  The query source id.
Returns: True if
frame_id
was registered onsource_id
.Raises:  RuntimeError If
frame_id
does not map to a registered frame or source_id
does not map to a registered source.
 BelongsToSource(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId, source_id: pydrake.geometry.SourceId) > bool
Reports if the given geometry id was registered to the source with the given source id.
 Parameter
geometry_id
:  The query geometry id.
 Parameter
source_id
:  The query source id.
Returns: True if
geometry_id
was registered onsource_id
.Raises:  RuntimeError If
geometry_id
does not map to a registered  geometry or
source_id
does not map to a registered source.

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
geometry_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
geometry_id
does not refer to a valid geometry.
 RuntimeError if the

CollisionFiltered
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id1: pydrake.geometry.GeometryId, geometry_id2: pydrake.geometry.GeometryId) → bool¶ Reports true if the two geometries with given ids
geometry_id1
andgeometry_id2
, define a collision pair that has been filtered out.Raises:  RuntimeError if either id does not map to a registered geometry or
 if any of the geometries do not have a proximity role.

FramesForSource
(self: pydrake.geometry.SceneGraphInspector_[float], source_id: pydrake.geometry.SourceId) → Set[pydrake.geometry.FrameId]¶ Reports the ids of all of the frames registered to the source with the given source
source_id
.Raises: RuntimeError if source_id
does not map to a registered source.

geometry_version
(self: pydrake.geometry.SceneGraphInspector_[float]) → pydrake.geometry.GeometryVersion¶ Returns the geometry version that can be used to detect changes to the geometry data associated with geometry roles. The reference returned should not be persisted. If it needs to be persisted, it should be copied.

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).

GetCollisionCandidates
(self: pydrake.geometry.SceneGraphInspector_[float]) → Set[Tuple[pydrake.geometry.GeometryId, pydrake.geometry.GeometryId]]¶ Returns all pairs of geometries that are candidates for collision (in no particular order). See SceneGraph::ExcludeCollisionsBetween() or SceneGraph::ExcludeCollisionsWithin() for information on why a particular pair may not be a candidate. For candidate pair (A, B), the candidate is always guaranteed to be reported in a fixed order (i.e., always (A, B) and never (B, A)). This is the same ordering as would be returned by, e.g., QueryObject::ComputePointPairPenetration().

GetFrameGroup
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) → int¶ Reports the frame group for the frame with the given
frame_id
.Raises:  RuntimeError if
frame_id
does not map to a registered frame.  This value is equivalent to the old “model instance id”.
 RuntimeError if

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
geometry_id
is registered.Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 RuntimeError if

GetGeometries
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId, role: Optional[pydrake.geometry.Role] = None) → List[pydrake.geometry.GeometryId]¶ Returns geometry ids that have been registered directly to the frame indicated by
frame_id
. If arole
is provided, only geometries with that role assigned will be returned, otherwise all geometries will be returned. Parameter
frame_id
:  The id of the frame in question.
 Parameter
role
:  The requested role; if omitted, all geometries registered to the frame are returned.
Returns: The requested unique geometry ids in a consistent order. Raises: RuntimeError if id
does not map to a registered frame. Parameter

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 frameframe_id
. Parameter
frame_id
:  The frame_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
frame_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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 Parameter

GetName
(*args, **kwargs)¶ Overloaded function.
 GetName(self: pydrake.geometry.SceneGraphInspector_[float], source_id: pydrake.geometry.SourceId) > str
Reports the name for the source with the given
source_id
.Raises: RuntimeError if source_id
does not map to a registered source. GetName(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) > str
Reports the name of the frame with the given
frame_id
.Raises: RuntimeError if frame_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
geometry_id
(see canonicalized_geometry_names “GeometryInstance” for details).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.

GetOwningSourceName
(*args, **kwargs)¶ Overloaded function.
 GetOwningSourceName(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) > str
Reports the name of the geometry source that registered the frame with the given
frame_id
.Raises: RuntimeError If frame_id
does not map to a registered frame. GetOwningSourceName(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId) > str
Reports the name of the geometry source that registered the geometry with the given
geometry_id
.Raises:  RuntimeError If
geometry_id
does not map to a registered geometry.

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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_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
geometry_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
geometry_id
does not map to a registered geometry.
 RuntimeError if

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
geometry_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
geometry_id
does not map to a registered geometry.
 RuntimeError if

GetProperties
(self: pydrake.geometry.SceneGraphInspector_[float], geometry_id: pydrake.geometry.GeometryId, role: pydrake.geometry.Role) → pydrake.geometry.GeometryProperties¶ Return a pointer to the const properties indicated by
role
of the geometry with the givengeometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
 Parameter
role
:  The role whose properties are acquired.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_id
does not map to a registered geometry.
 Parameter

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
geometry_id
. Parameter
geometry_id
:  The identifier for the queried geometry.
Returns: A pointer to the properties (or
nullptr
if there are no such properties).Raises:  RuntimeError if
geometry_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
geometry_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], source_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. */ (Deprecated.)
 Deprecated:
 Please use GetName(SourceId) instead. This will be removed from Drake on or after 20210401.
 RuntimeError if

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.

NumFramesForSource
(self: pydrake.geometry.SceneGraphInspector_[float], source_id: pydrake.geometry.SourceId) → int¶ Reports the number of frames registered to the source with the given
source_id
.Raises: RuntimeError if source_id
does not map to a registered source.

NumGeometriesForFrame
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId) → int¶ Reports the number of geometries affixed to the frame with the given
frame_id
. This count does not include geometries attached to frames that are descendants of this frame.Raises: RuntimeError if frame_id
does not map to a registered frame.

NumGeometriesForFrameWithRole
(self: pydrake.geometry.SceneGraphInspector_[float], frame_id: pydrake.geometry.FrameId, role: pydrake.geometry.Role) → int¶ Reports the total number of geometries with the given
role
directly registered to the frame with the givenframe_id
. This count does not include geometries attached to frames that are descendants of this frame.Raises: RuntimeError if frame_id
does not map to a registered frame.

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
(*args, **kwargs)¶ Overloaded function.
 SourceIsRegistered(self: pydrake.geometry.SceneGraphInspector_[float], source_id: pydrake.geometry.SourceId) > bool
Reports
True
if the givensource_id
maps to a registered source. SourceIsRegistered(self: pydrake.geometry.SceneGraphInspector_[float], id: pydrake.geometry.SourceId) > bool
Reports
True
if the givensource_id
maps to a registered source.

world_frame_id
(self: pydrake.geometry.SceneGraphInspector_[float]) → pydrake.geometry.FrameId¶ Reports the id for the world frame.

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 unitlength.
 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 unitlength.
 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 unitlength.
 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

centroid
(self: pydrake.geometry.SurfaceMesh_[float]) → numpy.ndarray[numpy.float64[3, 1]]¶ Returns the areaweighted geometric centroid of this surface mesh. The returned value is the position vector p_MSc from M’s origin to the centroid Sc, expressed in frame M. (M is the frame in which this mesh’s vertices are measured and expressed.) Note that the centroid is not necessarily a point on the surface. If the total mesh area is exactly zero, we define the centroid to be (0,0,0).
The centroid location is calculated per face not per vertex so is insensitive to whether vertices are shared by faces.

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

centroid
(self: pydrake.geometry.SurfaceMesh_[AutoDiffXd]) → numpy.ndarray[object[3, 1]]¶ Returns the areaweighted geometric centroid of this surface mesh. The returned value is the position vector p_MSc from M’s origin to the centroid Sc, expressed in frame M. (M is the frame in which this mesh’s vertices are measured and expressed.) Note that the centroid is not necessarily a point on the surface. If the total mesh area is exactly zero, we define the centroid to be (0,0,0).
The centroid location is calculated per face not per vertex so is insensitive to whether vertices are shared by faces.

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

centroid
(self: pydrake.geometry.SurfaceMesh_[float]) → numpy.ndarray[numpy.float64[3, 1]]¶ Returns the areaweighted geometric centroid of this surface mesh. The returned value is the position vector p_MSc from M’s origin to the centroid Sc, expressed in frame M. (M is the frame in which this mesh’s vertices are measured and expressed.) Note that the centroid is not necessarily a point on the surface. If the total mesh area is exactly zero, we define the centroid to be (0,0,0).
The centroid location is calculated per face not per vertex so is insensitive to whether vertices are shared by faces.

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