Skip to content

Commit e339ede

Browse files
committed
Add args to yourdfpy loader to optionally load visuals and collisions
1 parent 3221fb8 commit e339ede

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

robot_descriptions/loaders/yourdfpy.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@
2323
def load_robot_description(
2424
description_name: str,
2525
commit: Optional[str] = None,
26+
load_visuals: bool = True,
27+
load_collisions: bool = True,
2628
) -> yourdfpy.URDF:
2729
"""Load a robot description in yourdfpy.
2830
2931
Args:
3032
description_name: Name of the robot description.
3133
commit: If specified, check out that commit from the cloned robot
3234
description repository.
35+
load_visuals: If true, loads the visual meshes and scene.
36+
load_collisions: If true, loads the collision meshes and scene.
3337
3438
Returns:
3539
Robot model for yourdfpy.
@@ -42,4 +46,11 @@ def load_robot_description(
4246
if not hasattr(module, "URDF_PATH"):
4347
raise ValueError(f"{description_name} is not a URDF description")
4448

45-
return yourdfpy.URDF.load(module.URDF_PATH, mesh_dir=module.PACKAGE_PATH)
49+
return yourdfpy.URDF.load(
50+
module.URDF_PATH,
51+
mesh_dir=module.PACKAGE_PATH,
52+
build_scene_graph=load_visuals,
53+
build_collision_scene_graph=load_collisions,
54+
load_meshes=load_visuals,
55+
load_collision_meshes=load_collisions,
56+
)

0 commit comments

Comments
 (0)