From e339eded5a4be770e157fc483172b848f63889a2 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Tue, 17 Jun 2025 22:24:08 -0400 Subject: [PATCH 1/3] Add args to yourdfpy loader to optionally load visuals and collisions --- robot_descriptions/loaders/yourdfpy.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/robot_descriptions/loaders/yourdfpy.py b/robot_descriptions/loaders/yourdfpy.py index 205619a..3a177ed 100644 --- a/robot_descriptions/loaders/yourdfpy.py +++ b/robot_descriptions/loaders/yourdfpy.py @@ -23,6 +23,8 @@ def load_robot_description( description_name: str, commit: Optional[str] = None, + load_visuals: bool = True, + load_collisions: bool = True, ) -> yourdfpy.URDF: """Load a robot description in yourdfpy. @@ -30,6 +32,8 @@ def load_robot_description( description_name: Name of the robot description. commit: If specified, check out that commit from the cloned robot description repository. + load_visuals: If true, loads the visual meshes and scene. + load_collisions: If true, loads the collision meshes and scene. Returns: Robot model for yourdfpy. @@ -42,4 +46,11 @@ def load_robot_description( if not hasattr(module, "URDF_PATH"): raise ValueError(f"{description_name} is not a URDF description") - return yourdfpy.URDF.load(module.URDF_PATH, mesh_dir=module.PACKAGE_PATH) + return yourdfpy.URDF.load( + module.URDF_PATH, + mesh_dir=module.PACKAGE_PATH, + build_scene_graph=load_visuals, + build_collision_scene_graph=load_collisions, + load_meshes=load_visuals, + load_collision_meshes=load_collisions, + ) From ad0df85666fe3a8400b6cf6d1311e3e6a6a36b80 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Wed, 18 Jun 2025 22:15:56 -0400 Subject: [PATCH 2/3] Switch to using kwargs --- robot_descriptions/loaders/yourdfpy.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/robot_descriptions/loaders/yourdfpy.py b/robot_descriptions/loaders/yourdfpy.py index 3a177ed..fed79bc 100644 --- a/robot_descriptions/loaders/yourdfpy.py +++ b/robot_descriptions/loaders/yourdfpy.py @@ -23,8 +23,7 @@ def load_robot_description( description_name: str, commit: Optional[str] = None, - load_visuals: bool = True, - load_collisions: bool = True, + **kwargs, ) -> yourdfpy.URDF: """Load a robot description in yourdfpy. @@ -32,8 +31,11 @@ def load_robot_description( description_name: Name of the robot description. commit: If specified, check out that commit from the cloned robot description repository. - load_visuals: If true, loads the visual meshes and scene. - load_collisions: If true, loads the collision meshes and scene. + kwargs: arguments passed to yourdfpy.URDF.load function, including: + build_scene_graph: Whether to build a scene graph from visual elements. + build_collision_scene_graph: Whether to build a scene graph from collision elements. + load_meshes: Whether to load the meshes for the visual elements. + load_collision_meshes: Whether to load the meshes for the collision elements. Returns: Robot model for yourdfpy. @@ -49,8 +51,5 @@ def load_robot_description( return yourdfpy.URDF.load( module.URDF_PATH, mesh_dir=module.PACKAGE_PATH, - build_scene_graph=load_visuals, - build_collision_scene_graph=load_collisions, - load_meshes=load_visuals, - load_collision_meshes=load_collisions, + **kwargs, ) From 17de398d67bed17496d4803ff265382ecbc788d4 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Wed, 18 Jun 2025 22:16:52 -0400 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fef6ba3..718ed6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. ### Changed - Update `piper_mj_description` to load `piper.xml` instead of `scene.xml` (thanks to @jonzamora) +- Allow passing `kwargs` to `yourdfpy.load_robot_description` (thanks to @sea-bass) ## [1.17.0] - 2025-05-08