From f1e999a99dc6a6814bf3981a811a6e60e0e735ca Mon Sep 17 00:00:00 2001 From: Luke Schmitt Date: Mon, 26 Feb 2024 17:46:01 +0000 Subject: [PATCH 1/3] [xs_modules] Add ability to describe multiple arms --- .../xs_launch/xs_launch.py | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py b/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py index 65ed257..33d7e4d 100644 --- a/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py +++ b/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py @@ -47,33 +47,47 @@ class DeclareInterbotixXSArmRobotDescriptionLaunchArgument(DeclareLaunchArgument def __init__( self, *, - default_value: Optional[SomeSubstitutionsType] = Command([ - FindExecutable(name='xacro'), ' ', - PathJoinSubstitution([ - FindPackageShare('interbotix_xsarm_descriptions'), - 'urdf', - LaunchConfiguration('robot_model') - ]), '.urdf.xacro ', - 'robot_name:=', LaunchConfiguration('robot_name'), ' ', - 'base_link_frame:=', LaunchConfiguration('base_link_frame'), ' ', - 'use_gripper:=', LaunchConfiguration('use_gripper'), ' ', - 'show_ar_tag:=', LaunchConfiguration('show_ar_tag'), ' ', - 'show_gripper_bar:=', LaunchConfiguration('show_gripper_bar'), ' ', - 'show_gripper_fingers:=', LaunchConfiguration('show_gripper_fingers'), ' ', - 'use_world_frame:=', LaunchConfiguration('use_world_frame'), ' ', - 'external_urdf_loc:=', LaunchConfiguration('external_urdf_loc'), ' ', - 'hardware_type:=', LaunchConfiguration('hardware_type'), ' ', - ]), + robot_model_launch_config_name='robot_model', + robot_name_launch_config_name='robot_name', + robot_description_launch_config_name='robot_description', + default_value: Optional[SomeSubstitutionsType] = None, **kwargs ) -> None: """ Construct the modified DeclareLaunchArgument object. + :param robot_model_launch_config_name: Name of the robot model launch configuration. + This is typically only changed when multiple arms are to be launched. Defaults to + `robot_model` + :param robot_name_launch_config_name: Name of the robot name launch configuration. + This is typically only changed when multiple arms are to be launched. Defaults to + `robot_name` + :param robot_description_launch_config_name: Name of the robot description launch + configuration. This is typically only changed when multiple arms are to be launched. + Defaults to `robot_description` :param default_value: The default model given to the parent DeclareLaunchArgument; if you want to override this value, it must follow the convention in this object's source """ + if default_value is None: + default_value = Command([ + FindExecutable(name='xacro'), ' ', + PathJoinSubstitution([ + FindPackageShare('interbotix_xsarm_descriptions'), + 'urdf', + LaunchConfiguration(robot_model_launch_config_name) + ]), '.urdf.xacro ', + 'robot_name:=', LaunchConfiguration(robot_name_launch_config_name), ' ', + 'base_link_frame:=', LaunchConfiguration('base_link_frame'), ' ', + 'use_gripper:=', LaunchConfiguration('use_gripper'), ' ', + 'show_ar_tag:=', LaunchConfiguration('show_ar_tag'), ' ', + 'show_gripper_bar:=', LaunchConfiguration('show_gripper_bar'), ' ', + 'show_gripper_fingers:=', LaunchConfiguration('show_gripper_fingers'), ' ', + 'use_world_frame:=', LaunchConfiguration('use_world_frame'), ' ', + 'external_urdf_loc:=', LaunchConfiguration('external_urdf_loc'), ' ', + 'hardware_type:=', LaunchConfiguration('hardware_type'), ' ', + ]), super().__init__( - name='robot_description', + name=robot_description_launch_config_name, default_value=default_value, description=( 'URDF of the robot; this is typically generated by the xacro command.' @@ -242,6 +256,9 @@ def declare_interbotix_xsarm_robot_description_launch_arguments( use_world_frame: Text = 'true', external_urdf_loc: Text = '', hardware_type: Text = 'actual', + robot_model_launch_config_name='robot_model', + robot_name_launch_config_name='robot_name', + robot_description_launch_config_name='robot_description', ) -> List[DeclareLaunchArgument]: """ Return the `robot_description` DeclareLaunchArgument and its required children. @@ -338,7 +355,11 @@ def declare_interbotix_xsarm_robot_description_launch_arguments( 'hardware, or hardware simulated in Gazebo.' ), ), - DeclareInterbotixXSArmRobotDescriptionLaunchArgument(), + DeclareInterbotixXSArmRobotDescriptionLaunchArgument( + robot_description_launch_config_name=robot_description_launch_config_name, + robot_model_launch_config_name=robot_model_launch_config_name, + robot_name_launch_config_name=robot_name_launch_config_name, + ), ] From a78469f8e99200bd3ea69eb289525705b10cadc1 Mon Sep 17 00:00:00 2001 From: Luke Schmitt Date: Mon, 26 Feb 2024 18:04:11 +0000 Subject: [PATCH 2/3] Fix arg ordering --- .../interbotix_xs_modules/xs_launch/xs_launch.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py b/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py index 33d7e4d..474fbb0 100644 --- a/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py +++ b/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py @@ -47,24 +47,24 @@ class DeclareInterbotixXSArmRobotDescriptionLaunchArgument(DeclareLaunchArgument def __init__( self, *, + robot_description_launch_config_name='robot_description', robot_model_launch_config_name='robot_model', robot_name_launch_config_name='robot_name', - robot_description_launch_config_name='robot_description', default_value: Optional[SomeSubstitutionsType] = None, **kwargs ) -> None: """ Construct the modified DeclareLaunchArgument object. + :param robot_description_launch_config_name: Name of the robot description launch + configuration. This is typically only changed when multiple arms are to be launched. + Defaults to `robot_description` :param robot_model_launch_config_name: Name of the robot model launch configuration. This is typically only changed when multiple arms are to be launched. Defaults to `robot_model` :param robot_name_launch_config_name: Name of the robot name launch configuration. This is typically only changed when multiple arms are to be launched. Defaults to `robot_name` - :param robot_description_launch_config_name: Name of the robot description launch - configuration. This is typically only changed when multiple arms are to be launched. - Defaults to `robot_description` :param default_value: The default model given to the parent DeclareLaunchArgument; if you want to override this value, it must follow the convention in this object's source """ @@ -93,7 +93,7 @@ def __init__( 'URDF of the robot; this is typically generated by the xacro command.' ), choices=None, - **kwargs + **kwargs, ) @@ -256,9 +256,9 @@ def declare_interbotix_xsarm_robot_description_launch_arguments( use_world_frame: Text = 'true', external_urdf_loc: Text = '', hardware_type: Text = 'actual', + robot_description_launch_config_name='robot_description', robot_model_launch_config_name='robot_model', robot_name_launch_config_name='robot_name', - robot_description_launch_config_name='robot_description', ) -> List[DeclareLaunchArgument]: """ Return the `robot_description` DeclareLaunchArgument and its required children. From c571f871d3693bb029159ce129b3d4adcaa98e4b Mon Sep 17 00:00:00 2001 From: Luke Schmitt Date: Mon, 26 Feb 2024 18:16:43 +0000 Subject: [PATCH 3/3] Add missing typing to args --- .../interbotix_xs_modules/xs_launch/xs_launch.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py b/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py index 474fbb0..bf56870 100644 --- a/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py +++ b/interbotix_xs_toolbox/interbotix_xs_modules/interbotix_xs_modules/xs_launch/xs_launch.py @@ -47,9 +47,9 @@ class DeclareInterbotixXSArmRobotDescriptionLaunchArgument(DeclareLaunchArgument def __init__( self, *, - robot_description_launch_config_name='robot_description', - robot_model_launch_config_name='robot_model', - robot_name_launch_config_name='robot_name', + robot_description_launch_config_name: Text = 'robot_description', + robot_model_launch_config_name: Text = 'robot_model', + robot_name_launch_config_name: Text = 'robot_name', default_value: Optional[SomeSubstitutionsType] = None, **kwargs ) -> None: @@ -256,12 +256,12 @@ def declare_interbotix_xsarm_robot_description_launch_arguments( use_world_frame: Text = 'true', external_urdf_loc: Text = '', hardware_type: Text = 'actual', - robot_description_launch_config_name='robot_description', - robot_model_launch_config_name='robot_model', - robot_name_launch_config_name='robot_name', + robot_description_launch_config_name: Text = 'robot_description', + robot_model_launch_config_name: Text = 'robot_model', + robot_name_launch_config_name: Text = 'robot_name', ) -> List[DeclareLaunchArgument]: """ - Return the `robot_description` DeclareLaunchArgument and its required children. + Return a robot description DeclareLaunchArgument and its required children. DeclareLaunchArgument objects: - `base_link_frame`