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

fix (howto-launch): namespace on IncludeLaunchDescription #2620

Merged
merged 1 commit into from
Jun 9, 2022

Conversation

krsche
Copy link
Contributor

@krsche krsche commented May 23, 2022

Following the documentation for including another launch file under a specific namespace I encountered an error.
Code:

pChannel = "vcan0"

ld.add_entity(
        GroupAction(
            actions=[
                PushRosNamespace(LaunchConfiguration(pChannel)), # < -- HERE IS THE ERROR! It has to be: PushRosNamespace(pChannel)
                IncludeLaunchDescription(
                    PythonLaunchDescriptionSource(
                        os.path.join(get_package_share_directory('ros2_socketcan'), 'launch/socket_can_receiver.launch.py')),
                    launch_arguments={
                        'interface': pChannel,
                        'interval_sec': '0.001'
                    }.items(),
                ),
            ]
        ),
    )

Error when launching:

[ERROR] [launch]: Caught exception in launch (see debug for traceback): launch configuration 'vcan0' does not exist

Resolution:
Looking at other code I noticed that people are using it differently instaed and the implementation of PushRosNamespace suggests to me that this is they way to go.

kscottz
kscottz previously approved these changes May 24, 2022
Copy link
Collaborator

@kscottz kscottz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, but I want a second opinion. @audrow can you confirm?

@kscottz kscottz dismissed their stale review May 24, 2022 14:08

Sorry, jet lag, more review coming soon.

@audrow audrow changed the base branch from humble to rolling May 24, 2022 17:45
@audrow audrow changed the base branch from rolling to humble May 25, 2022 16:59
Copy link
Member

@audrow audrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @krsche. I think this should be retargeted to rolling and then backported to humble, since the error is also in rolling. Would you mind rebasing this commit on rolling?

@@ -75,7 +75,7 @@ Each launch file performs the following actions:
launch_include_with_namespace = GroupAction(
actions=[
# push_ros_namespace to set namespace of included nodes
PushRosNamespace(LaunchConfiguration('chatter_ns')),
PushRosNamespace(namespace='chatter_ns'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing LaunchConfiguration() and its interaction with PushRosNamespace

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible Solution:
setting the default_value of the DeclareLaunchArgument to the LaunchConfiguration value according to following modification:
namespace = LaunchConfiguration('namespace')

... Other code goes here....

DeclareLaunchArgument(
'namespace', default_value=namespace,
description='Top-level namespace'),
2. Adding PushRosNamespace(namespace=namespace) to the LaunchDescription in example.launch.py

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean. For me passing a string directly to PushRosNamespace works, can you elaborate what you're suggesting?

@krsche krsche changed the base branch from humble to rolling May 25, 2022 18:05
@krsche
Copy link
Contributor Author

krsche commented May 25, 2022

@audrow changed the target to rolling :) How would the backporting work? Manually by opening other PRs targeting those branches after this PR has been merged?

@krsche krsche requested a review from audrow May 25, 2022 18:23
@clalancette clalancette added the backport-humble backport at reviewers discretion; from rolling to humble label May 25, 2022
@clalancette
Copy link
Contributor

@audrow changed the target to rolling :) How would the backporting work? Manually by opening other PRs targeting those branches after this PR has been merged?

We have a bot for it, so not to worry.

@audrow audrow merged commit 54e7959 into ros2:rolling Jun 9, 2022
mergify bot pushed a commit that referenced this pull request Jun 9, 2022
@audrow
Copy link
Member

audrow commented Jun 9, 2022

Thanks for the PR @krsche!

audrow pushed a commit that referenced this pull request Jun 9, 2022
(cherry picked from commit 54e7959)

Co-authored-by: krsche <fabian.kirschner@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble backport at reviewers discretion; from rolling to humble
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants