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
@@ -58,8 +56,10 @@ def generate_launch_description() -> LaunchDescription:
58
56
platform_config_file = os .path .join (package_folder ,
59
57
'config/platform_config_file.yaml' )
60
58
61
- control_modes = os .path .join (package_folder ,
62
- 'config/control_modes.yaml' )
59
+ control_modes = PathJoinSubstitution ([
60
+ FindPackageShare ('as2_platform_dji_psdk' ),
61
+ 'config' , 'control_modes.yaml'
62
+ ])
63
63
64
64
return LaunchDescription ([
65
65
DeclareLaunchArgument ('namespace' ,
@@ -71,9 +71,8 @@ def generate_launch_description() -> LaunchDescription:
71
71
DeclareLaunchArgument ('control_modes_file' ,
72
72
default_value = control_modes ,
73
73
description = 'Platform control modes file' ),
74
- * as2_utils .declare_launch_arguments (
75
- 'config_file' ,
76
- default_value = platform_config_file ,
74
+ DeclareLaunchArgumentsFromConfigFile (
75
+ name = 'config_file' , source_file = platform_config_file ,
77
76
description = 'Platform configuration file' ),
78
77
Node (
79
78
package = 'as2_platform_dji_psdk' ,
@@ -85,11 +84,12 @@ def generate_launch_description() -> LaunchDescription:
85
84
arguments = ['--ros-args' , '--log-level' ,
86
85
LaunchConfiguration ('log_level' )],
87
86
parameters = [
88
- * as2_utils .launch_configuration ('config_file' ,
89
- default_value = platform_config_file ),
90
87
{
91
88
'control_modes_file' : LaunchConfiguration ('control_modes_file' ),
92
- }
89
+ },
90
+ LaunchConfigurationFromConfigFile (
91
+ 'config_file' ,
92
+ default_file = platform_config_file ),
93
93
]
94
94
)
95
95
])
0 commit comments