ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The launch argument's value is stored in the "Launch Configurations", and those can be accessed using a substitution called launch.substitution.LaunchConfiguration(name) -> string
.
If you want to do something conditionally based on this, I'd recommend using a launch.Condition
which may be passed to any launch.Action
, e.g.:
def generate_launch_description():
run_rqt_arg = DeclareLaunchArgument(
name="run_rqt",
default_value="True",
description="Launch RQT?")
run_rviz_arg = DeclareLaunchArgument(
name="run_rviz",
default_value="True",
description="Launch RVIZ?")
rqt = Node(...,
condition=launch.conditions.IfCondition(launch.LaunchConfiguration("run_rqt")))
rviz = Node(...,
condition=launch.conditions.IfCondition(launch.LaunchConfiguration("run_rviz")))
return launch.LaunchDescription([run_rqt_arg, run_rviz_arg, run_rqt, run_rviz])
See also: