-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SW-1394] add option for odom/fiducial/camera publishing from ros2 control launchfile #485
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
de73c51
simplify handling of image publisher launch args to avoid specifying …
5c4afdb
Seems to work
2b784ea
Joint states on /robot/low_level/joint_states
a1be79f
Fix example nodes to match the new name for joint states topic
824beef
Try adding specially formatted thing to readme
c1a2948
Update readme
591d0a4
more readme nits
f0dd99e
misc cleanup
46cb0a3
docstring
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,99 @@ | |
|
||
import logging | ||
import os | ||
from enum import Enum | ||
from typing import Any, Dict, List, Optional, Tuple | ||
|
||
import yaml | ||
from launch.actions import DeclareLaunchArgument | ||
|
||
from spot_wrapper.wrapper import SpotWrapper | ||
|
||
COLOR_END = "\33[0m" | ||
COLOR_YELLOW = "\33[33m" | ||
|
||
IMAGE_PUBLISHER_ARGS = [ | ||
"depth_registered_mode", | ||
"publish_point_clouds", | ||
"uncompress_images", | ||
"publish_compressed_images", | ||
"stitch_front_images", | ||
] | ||
|
||
|
||
class DepthRegisteredMode(Enum): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. docstring please |
||
"""Options for obtaining depth registered images images from Spot. We can request them from Spot's SDK, generate | ||
them using `depth_image_proc`'s nodelets, or just not publish them at all.""" | ||
|
||
DISABLE = "disable" | ||
FROM_SPOT = "from_spot" | ||
FROM_NODELETS = "from_nodelets" | ||
|
||
def __repr__(self) -> str: | ||
return self.value | ||
|
||
|
||
def declare_image_publisher_args() -> List[DeclareLaunchArgument]: | ||
"""Generates launch arguments for each element in IMAGE_PUBLISHER_ARGS. This is useful to avoid copying and pasting | ||
the same launch arguments multiple times launchfiles that call the spot_image_publishers launchfile. | ||
|
||
Returns: | ||
List[DeclareLaunchArgument]: List of DeclareLaunchArguments useful for image publishing. | ||
""" | ||
launch_args = [] | ||
launch_args.append( | ||
DeclareLaunchArgument( | ||
"depth_registered_mode", | ||
default_value=DepthRegisteredMode.FROM_NODELETS.value, | ||
choices=[e.value for e in DepthRegisteredMode], | ||
description=( | ||
f"If `{DepthRegisteredMode.DISABLE.value}` is set, do not publish registered depth images." | ||
f" If `{DepthRegisteredMode.FROM_SPOT.value}` is set, request registered depth images from Spot through" | ||
f" its SDK. If `{DepthRegisteredMode.FROM_NODELETS.value}` is set, use depth_image_proc::RegisterNode" | ||
" component nodes running on the host computer to create registered depth images (this reduces the" | ||
" computational load on Spot's internal systems)." | ||
), | ||
) | ||
) | ||
launch_args.append( | ||
DeclareLaunchArgument( | ||
"publish_point_clouds", | ||
default_value="False", | ||
choices=["True", "true", "False", "false"], | ||
description=( | ||
"If true, create and publish point clouds for each depth registered and RGB camera pair. Requires that" | ||
" the depth_register_mode launch argument is set to a value that is not `disable`." | ||
), | ||
) | ||
) | ||
launch_args.append( | ||
DeclareLaunchArgument( | ||
"uncompress_images", | ||
default_value="True", | ||
choices=["True", "true", "False", "false"], | ||
description="Choose whether to publish uncompressed images from Spot.", | ||
) | ||
) | ||
launch_args.append( | ||
DeclareLaunchArgument( | ||
"publish_compressed_images", | ||
default_value="False", | ||
choices=["True", "true", "False", "false"], | ||
description="Choose whether to publish compressed images from Spot.", | ||
) | ||
) | ||
launch_args.append( | ||
DeclareLaunchArgument( | ||
"stitch_front_images", | ||
default_value="False", | ||
choices=["True", "true", "False", "false"], | ||
description=( | ||
"Choose whether to publish a stitched image constructed from Spot's front left and right cameras." | ||
), | ||
) | ||
) | ||
return launch_args | ||
|
||
|
||
def get_ros_param_dict(config_file_path: str) -> Dict[str, Any]: | ||
"""Get a dictionary of parameter_name: parameter_value from a ROS config yaml file. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this is not the most ROS-y way to do this but I wasn't sure of a better way to reduce all of this repeated boilerplate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me. I wouldn't worry about the most "ROS-y" way and just focus on what is effective and maintainable.