[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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

Implement None check for ComposableNodeContainer (backport #341) #371

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions launch_ros/launch_ros/actions/composable_node_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]:
"""
load_actions = None # type: Optional[List[Action]]
valid_composable_nodes = []
for node_object in self.__composable_node_descriptions:
if node_object.condition() is None or node_object.condition().evaluate(context):
valid_composable_nodes.append(node_object)
if self.__composable_node_descriptions:
for node_object in self.__composable_node_descriptions:
if node_object.condition() is None or node_object.condition().evaluate(context):
valid_composable_nodes.append(node_object)

if (
valid_composable_nodes is not None and
len(valid_composable_nodes) > 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ def test_composable_node_container_empty_list_of_nodes():
assert get_node_name_count(context, f'/{TEST_NODE_NAMESPACE}/{TEST_NODE_NAME}') == 0


def test_composable_node_container_no_list_of_nodes():
"""Test launching a ComposableNodeContainer with no passed in list of nodes."""
actions = [
ComposableNodeContainer(
package='rclcpp_components',
executable='component_container',
name=TEST_CONTAINER_NAME,
namespace=TEST_CONTAINER_NAMESPACE
),
]

context = _assert_launch_no_errors(actions)
assert get_node_name_count(context, f'/{TEST_CONTAINER_NAMESPACE}/{TEST_CONTAINER_NAME}') == 1
assert get_node_name_count(context, f'/{TEST_NODE_NAMESPACE}/{TEST_NODE_NAME}') == 0


def test_composable_node_container_in_group_with_launch_configuration_in_description():
"""
Test launch configuration is passed to ComposableNode description inside GroupAction.
Expand Down