moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
launch_utils.py
Go to the documentation of this file.
1from launch.actions import DeclareLaunchArgument
2from launch.conditions import IfCondition, UnlessCondition
3from launch.substitutions import LaunchConfiguration
4
5from launch_ros.actions import Node
6
7
8class DeclareBooleanLaunchArg(DeclareLaunchArgument):
9 """This launch action declares a launch argument with true and false as the only valid values"""
10
11 def __init__(self, name, *, default_value=False, description=None, **kwargs):
12 super().__init__(
13 name,
14 default_value=str(default_value),
15 description=description,
16 choices=["true", "false", "True", "False"],
17 **kwargs,
18 )
19
20
21def add_debuggable_node(
22 ld,
23 package,
24 executable,
25 condition_name="debug",
26 commands_file=None,
27 extra_debug_args=None,
28 **kwargs,
29):
30 """Adds two versions of a Node to the launch description, one with gdb debugging, controlled by a launch config"""
31 standard_node = Node(
32 package=package,
33 executable=executable,
34 condition=UnlessCondition(LaunchConfiguration(condition_name)),
35 **kwargs,
36 )
37 ld.add_action(standard_node)
38
39 if commands_file:
40 dash_x_arg = f"-x {commands_file} "
41 else:
42 dash_x_arg = ""
43 prefix = [f"gdb {dash_x_arg}--ex run --args"]
44
45 if "arguments" in kwargs:
46 arguments = kwargs["arguments"]
47 if extra_debug_args:
48 arguments += extra_debug_args
49 del kwargs["arguments"]
50 else:
51 arguments = None
52
53 debug_node = Node(
54 package=package,
55 executable=executable,
56 condition=IfCondition(LaunchConfiguration(condition_name)),
57 prefix=prefix,
58 arguments=arguments,
59 **kwargs,
60 )
61 ld.add_action(debug_node)
__init__(self, name, *default_value=False, description=None, **kwargs)