Skip to content

Commit

Permalink
Enhance performance by disconnecting unnecessary XLink outputs based …
Browse files Browse the repository at this point in the history
…on configuration.

Signed-off-by: Jose Miguel <josemiguel.guerrero@urjc.es>
  • Loading branch information
jmguerreroh committed Nov 5, 2024
1 parent 8db32e1 commit 26874c3
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 77 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The launch file provides several configurable arguments:
- `use_lr_raw`: Enable left and right raw image publishing. Default: `True`
- `use_pointcloud`: Enable point cloud publishing. Default: `True`
- `pc_color`: Use color in the point cloud. Options: `True`for color or `False` for intensity. Default: `True`
- `only_rgb`: Enable publishing of only RGB images. Default: `False`

## Visualizing in RViz

Expand Down
28 changes: 19 additions & 9 deletions launch/rgbd_stereo.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def generate_launch_description():
use_lr_raw = LaunchConfiguration('use_lr_raw', default = True)
use_pointcloud = LaunchConfiguration('use_pointcloud', default = True)
pc_color = LaunchConfiguration('pc_color', default = True)
only_rgb = LaunchConfiguration('only_rgb', default = False)


declare_camera_model_cmd = DeclareLaunchArgument(
Expand Down Expand Up @@ -125,7 +126,7 @@ def generate_launch_description():
'use_depth',
default_value=use_depth,
description='Use depth image.')

declare_use_disparity_cmd = DeclareLaunchArgument(
'use_disparity',
default_value=use_disparity,
Expand All @@ -146,6 +147,11 @@ def generate_launch_description():
default_value=pc_color,
description='Use color in the point cloud.')

declare_only_rgb_cmd = DeclareLaunchArgument(
'only_rgb',
default_value=only_rgb,
description='Use only RGB image.')


urdf_launch = IncludeLaunchDescription(
launch_description_sources.PythonLaunchDescriptionSource(
Expand Down Expand Up @@ -175,6 +181,9 @@ def generate_launch_description():
{'use_disparity': use_disparity},
{'use_lr_raw': use_lr_raw},
{'use_pointcloud': use_pointcloud},
{'pc_color': pc_color},
{'only_rgb': only_rgb},
{'use_pointcloud': use_pointcloud},
{'pc_color': pc_color}])

metric_converter_node = launch_ros.descriptions.ComposableNode(
Expand All @@ -186,7 +195,7 @@ def generate_launch_description():
('image', 'stereo/converted_depth')],
condition=IfCondition(
PythonExpression(
["'", use_depth, "' == 'True' and '", use_pointcloud, "' == 'True'"]
["'", use_depth, "' == 'True' and '", use_pointcloud, "' == 'True' and '", only_rgb, "' == 'False'"]
)
)
)
Expand All @@ -200,10 +209,10 @@ def generate_launch_description():
('rgb/camera_info', 'rgb/camera_info'),
('points', 'stereo/points')],
condition=IfCondition(
PythonExpression(
["'", use_depth, "' == 'True' and '", use_pointcloud, "' == 'True' and '", pc_color, "' == 'True'"]
)
PythonExpression(
["'", use_depth, "' == 'True' and '", use_pointcloud, "' == 'True' and '", pc_color, "' == 'True' and '", only_rgb, "' == 'False'"]
)
)
)

point_cloud_intensity = launch_ros.descriptions.ComposableNode(
Expand All @@ -215,10 +224,10 @@ def generate_launch_description():
('intensity/camera_info', 'right_rect/camera_info'),
('points', 'stereo/points')],
condition=IfCondition(
PythonExpression(
["'", use_depth, "' == 'True' and '", use_pointcloud, "' == 'True' and '", pc_color, "' == 'False'"]
)
)
PythonExpression(
["'", use_depth, "' == 'True' and '", use_pointcloud, "' == 'True' and '", pc_color, "' == 'False' and '", only_rgb, "' == 'False'"]
)
)
)

point_cloud_container = launch_ros.actions.ComposableNodeContainer(
Expand Down Expand Up @@ -265,6 +274,7 @@ def generate_launch_description():
ld.add_action(declare_use_lr_raw_cmd)
ld.add_action(declare_use_pointcloud_cmd)
ld.add_action(declare_point_cloud_color_cmd)
ld.add_action(declare_only_rgb_cmd)

ld.add_action(rgbd_stereo_node)
ld.add_action(urdf_launch)
Expand Down
Loading

0 comments on commit 26874c3

Please sign in to comment.