Skip to content

Commit

Permalink
py geometry: Bind overload of SceneGraph.RemoveRole (RobotLocomotion#…
Browse files Browse the repository at this point in the history
…13731)

* py geometry: Bind overload of SceneGraph.RemoveRole
  • Loading branch information
EricCousineau-TRI authored Jul 22, 2020
1 parent 0060f1b commit 93b387c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions bindings/pydrake/geometry_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@ void DoScalarDependentDefinitions(py::module m, T) {
py::arg("properties"), py::arg("assign") = RoleAssign::kNew,
cls_doc.AssignRole.doc_illustration_context)
// - End: AssignRole Overloads.
// - Begin: RemoveRole Overloads
.def(
"RemoveRole",
[](Class& self, SourceId source_id, GeometryId geometry_id,
Role role) {
return self.RemoveRole(source_id, geometry_id, role);
},
py::arg("source_id"), py::arg("geometry_id"), py::arg("role"),
cls_doc.RemoveRole.doc_geometry_direct)
// - End: RemoveRole Overloads.
.def_static("world_frame_id", &Class::world_frame_id,
cls_doc.world_frame_id.doc);
}
Expand Down
12 changes: 12 additions & 0 deletions bindings/pydrake/test/geometry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ def test_scene_graph_api(self, T):
inspector.CloneGeometryInstance(geometry_id=global_geometry),
mut.GeometryInstance)

roles = [
mut.Role.kProximity,
mut.Role.kPerception,
mut.Role.kIllustration,
]
for role in roles:
self.assertEqual(
scene_graph.RemoveRole(
source_id=global_source, geometry_id=global_geometry,
role=role),
1)

def test_connect_drake_visualizer(self):
# Test visualization API.
T = float
Expand Down
3 changes: 2 additions & 1 deletion geometry/scene_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ class SceneGraph final : public systems::LeafSystem<T> {
b) `geometry_id` does not map to a registered
geometry,
c) `geometry_id` does not belong to `source_id`, or
d) the context has already been allocated. */
d) the context has already been allocated.
@pydrake_mkdoc_identifier{geometry_direct} */
int RemoveRole(SourceId source_id, GeometryId geometry_id, Role role);

/** systems::Context-modifying variant of
Expand Down

0 comments on commit 93b387c

Please sign in to comment.