1
- #!/usr/bin/env python3
2
-
3
- """Launch as2_platform_dji_psdk node."""
4
-
5
- # Copyright 2023 Universidad Politécnica de Madrid
1
+ # Copyright 2024 Universidad Politécnica de Madrid
6
2
#
7
3
# Redistribution and use in source and binary forms, with or without
8
4
# modification, are permitted provided that the following conditions are met:
30
26
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
27
# POSSIBILITY OF SUCH DAMAGE.
32
28
33
- __authors__ = 'Rafael Pérez Seguí'
34
- __copyright__ = 'Copyright (c) 2022 Universidad Politécnica de Madrid'
29
+ """Launch as2_platform_dji_psdk node."""
30
+
31
+ __authors__ = 'Rafael Pérez Seguí, Pedro Arias Pérez'
32
+ __copyright__ = 'Copyright (c) 2024 Universidad Politécnica de Madrid'
35
33
__license__ = 'BSD-3-Clause'
36
- __version__ = '0.1.0'
37
34
38
35
import os
39
36
40
37
from ament_index_python .packages import get_package_share_directory
41
- import as2_core .launch_param_utils as as2_utils
38
+ from as2_core .declare_launch_arguments_from_config_file import DeclareLaunchArgumentsFromConfigFile
39
+ from as2_core .launch_configuration_from_config_file import LaunchConfigurationFromConfigFile
42
40
from launch import LaunchDescription
43
41
from launch .actions import DeclareLaunchArgument
44
42
from launch .substitutions import EnvironmentVariable , LaunchConfiguration , PathJoinSubstitution
@@ -57,7 +55,6 @@ def generate_launch_description() -> LaunchDescription:
57
55
package_folder = get_package_share_directory ('as2_platform_dji_psdk' )
58
56
platform_config_file = os .path .join (package_folder ,
59
57
'config/platform_config_file.yaml' )
60
-
61
58
control_modes = PathJoinSubstitution ([
62
59
FindPackageShare ('as2_platform_dji_psdk' ),
63
60
'config' , 'control_modes.yaml'
@@ -73,9 +70,8 @@ def generate_launch_description() -> LaunchDescription:
73
70
DeclareLaunchArgument ('control_modes_file' ,
74
71
default_value = control_modes ,
75
72
description = 'Platform control modes file' ),
76
- * as2_utils .declare_launch_arguments (
77
- 'config_file' ,
78
- default_value = platform_config_file ,
73
+ DeclareLaunchArgumentsFromConfigFile (
74
+ name = 'config_file' , source_file = platform_config_file ,
79
75
description = 'Platform configuration file' ),
80
76
Node (
81
77
package = 'as2_platform_dji_psdk' ,
@@ -87,11 +83,12 @@ def generate_launch_description() -> LaunchDescription:
87
83
arguments = ['--ros-args' , '--log-level' ,
88
84
LaunchConfiguration ('log_level' )],
89
85
parameters = [
90
- * as2_utils .launch_configuration ('config_file' ,
91
- default_value = platform_config_file ),
92
86
{
93
87
'control_modes_file' : LaunchConfiguration ('control_modes_file' ),
94
- }
88
+ },
89
+ LaunchConfigurationFromConfigFile (
90
+ 'config_file' ,
91
+ default_file = platform_config_file ),
95
92
]
96
93
)
97
94
])
0 commit comments