Skip to content

Commit

Permalink
Add ability to describe multiple turrets using xs_launch (Interbotix#66)
Browse files Browse the repository at this point in the history
* [xs_modules] Add ability to describe multiple turrets

* Update docstring

* Fix import ordering
  • Loading branch information
lukeschmitt-tr authored Feb 28, 2024
1 parent 35803bb commit 8545083
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,29 +148,43 @@ class DeclareInterbotixXSTurretRobotDescriptionLaunchArgument(DeclareLaunchArgum
def __init__(
self,
*,
default_value: Optional[SomeSubstitutionsType] = Command([
FindExecutable(name='xacro'), ' ',
PathJoinSubstitution([
FindPackageShare('interbotix_xsturret_descriptions'),
'urdf',
LaunchConfiguration('robot_model')
]), '.urdf.xacro ',
'robot_name:=', LaunchConfiguration('robot_name'), ' ',
'base_link_frame:=', LaunchConfiguration('base_link_frame'), ' ',
'use_world_frame:=', LaunchConfiguration('use_world_frame'), ' ',
'external_urdf_loc:=', LaunchConfiguration('external_urdf_loc'), ' ',
'hardware_type:=', LaunchConfiguration('hardware_type'), ' ',
]),
**kwargs
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:
"""
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 turrets 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 turrets 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 turrets are to be launched. Defaults to
`robot_name`
: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_xsturret_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_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.'
Expand Down Expand Up @@ -463,9 +477,12 @@ def declare_interbotix_xsturret_robot_description_launch_arguments(
use_world_frame: Text = 'true',
external_urdf_loc: Text = '',
hardware_type: Text = 'actual',
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`
Expand Down Expand Up @@ -516,7 +533,11 @@ def declare_interbotix_xsturret_robot_description_launch_arguments(
'simulated in Gazebo.'
),
),
DeclareInterbotixXSTurretRobotDescriptionLaunchArgument(),
DeclareInterbotixXSTurretRobotDescriptionLaunchArgument(
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,
),
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"""

import math
from threading import Thread
import sys
from threading import Thread
import time
from typing import Any, List, Tuple, Union

Expand Down

0 comments on commit 8545083

Please sign in to comment.