Skip to content

Commit

Permalink
[N/A] Add a mock launch argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ggoretkin-bdai committed Nov 22, 2023
1 parent 728bd7d commit 68d28d9
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions spot_driver/launch/spot_driver.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,21 @@ def launch_setup(context: LaunchContext, ld: LaunchDescription) -> None:
tf_prefix = LaunchConfiguration("tf_prefix").perform(context)
depth_registered_mode_config = LaunchConfiguration("depth_registered_mode")
publish_point_clouds_config = LaunchConfiguration("publish_point_clouds")
mock_enable = LaunchConfiguration("mock_enable", default=False).perform(context)

# Get parameters from Spot.

username = os.getenv("BOSDYN_CLIENT_USERNAME", "username")
password = os.getenv("BOSDYN_CLIENT_PASSWORD", "password")
hostname = os.getenv("SPOT_IP", "hostname")
if not mock_enable:
# Get parameters from Spot.

spot_wrapper = SpotWrapper(username, password, hostname, spot_name, logger)
has_arm = spot_wrapper.has_arm()
username = os.getenv("BOSDYN_CLIENT_USERNAME", "username")
password = os.getenv("BOSDYN_CLIENT_PASSWORD", "password")
hostname = os.getenv("SPOT_IP", "hostname")

spot_wrapper = SpotWrapper(username, password, hostname, spot_name, logger)
has_arm = spot_wrapper.has_arm()
else:
# TODO if it's not a boolean, correctly errors, but does not provide launch argument name
has_arm = IfCondition(LaunchConfiguration("mock_has_arm")).evaluate(context)

pkg_share = FindPackageShare("spot_description").find("spot_description")

Expand Down Expand Up @@ -196,7 +202,7 @@ def launch_setup(context: LaunchContext, ld: LaunchDescription) -> None:
PathJoinSubstitution([pkg_share, "urdf", "spot.urdf.xacro"]),
" ",
"arm:=",
TextSubstitution(text=str(spot_wrapper.has_arm()).lower()),
TextSubstitution(text=str(has_arm).lower()),
" ",
"tf_prefix:=",
tf_prefix,
Expand Down

0 comments on commit 68d28d9

Please sign in to comment.