24
24
25
25
from launch import LaunchDescription
26
26
from launch .actions import EmitEvent
27
- from launch .actions import SetEnvironmentVariable
27
+ from launch .actions import SetEnvironmentVariable ,DeclareLaunchArgument
28
+ from launch .substitutions import LaunchConfiguration
28
29
from launch_ros .actions import LifecycleNode
29
30
from launch_ros .events .lifecycle import ChangeState
30
31
@@ -45,11 +46,11 @@ def generate_launch_description():
45
46
46
47
driver_node = LifecycleNode (
47
48
name = 'mocap4r2_optitrack_driver_node' ,
48
- namespace = '' ,
49
+ namespace = LaunchConfiguration ( 'namespace' ) ,
49
50
package = 'mocap4r2_optitrack_driver' ,
50
51
executable = 'mocap4r2_optitrack_driver_main' ,
51
52
output = 'screen' ,
52
- parameters = [params_file_path ],
53
+ parameters = [LaunchConfiguration ( 'config_file' ) ],
53
54
)
54
55
55
56
# Make the driver node take the 'configure' transition
@@ -72,6 +73,8 @@ def generate_launch_description():
72
73
ld = LaunchDescription ()
73
74
74
75
ld .add_action (stdout_linebuf_envvar )
76
+ ld .add_action (DeclareLaunchArgument ('namespace' , default_value = '' ))
77
+ ld .add_action (DeclareLaunchArgument ('config_file' , default_value = params_file_path ))
75
78
ld .add_action (driver_node )
76
79
ld .add_action (driver_configure_trans_event )
77
80
# ld.add_action(driver_activate_trans_event)
0 commit comments