-
Notifications
You must be signed in to change notification settings - Fork 146
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
Bug when setting launch arguments of included descriptions #749
Comments
@methylDragon Would you be willing to look into the behavior and figure out where the bug is? 🧇 It seems like passing |
As a workaround I currently push required arguments explicitly to included launch files in IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[
str(Path(get_package_share_directory("launch_args_ex")) / "launch" / "bottom.launch.py"),
]
),
launch_arguments={"bottom1": LaunchConfiguration("bottom1"), "bottom2": LaunchConfiguration("bottom2")}.items(), # <-- Push required arguments explicitly
) Starting the launch file with I would much rather that the required arguments check takes into account the context of the top launch file automatically. |
After sleeping a night on this and doing some testing this morning, I want to make some remarks on my previous comment.
A caveat with this approach is that you will get a different, less descriptive error message if you do not start the launch file with one of the required arguments: Running
Running
Something to be aware of when using the workaround.
Actually, after sleeping a night on this I do not think I completely agree with myself anymore. I guess my main confusion is how the required arguments check seems to behave differently from how the arguments are evaluated. If we use # bottom.launch.py
import launch
from launch.actions import DeclareLaunchArgument, LogInfo
from launch.substitutions import LaunchConfiguration
def generate_launch_description():
return launch.LaunchDescription(
[
DeclareLaunchArgument("bottom1", description="Inner argument 1", default_value="false"),
DeclareLaunchArgument("bottom2", description="Inner argument 2", default_value="false"),
LogInfo(msg=["bottom1 = ", LaunchConfiguration("bottom1")]),
LogInfo(msg=["bottom2 = ", LaunchConfiguration("bottom2")]),
]
) Then running
Running
So the launch arguments passed to Then the question becomes, why doesn't this also work for the required arguments check, i.e. when we do not define default values for |
Bug report
Required Info:
Steps to reproduce issue
Build this package and run
ros2 launch launch_args_ex top.launch.py bottom1:=true bottom2:=true
top.launch.py
bottom.launch.py
Expected behavior
The
bottom1
andbottom2
arguments receive values passed from the command-line.Actual behavior
What's weird is if you don't set one of the args, it now sees that the other one was given:
Here's a full debug output as well:
The text was updated successfully, but these errors were encountered: