Skip to content

Commit d39d88b

Browse files
authored
Merge pull request #4 from aerostack2/3-update-launcher-with-param-utils
Update launcher with param utils
2 parents 86a087c + a1a41bd commit d39d88b

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

launch/as2_platform_dji_psdk.launch.py

+13-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
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
62
#
73
# Redistribution and use in source and binary forms, with or without
84
# modification, are permitted provided that the following conditions are met:
@@ -30,15 +26,17 @@
3026
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3127
# POSSIBILITY OF SUCH DAMAGE.
3228

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'
3533
__license__ = 'BSD-3-Clause'
36-
__version__ = '0.1.0'
3734

3835
import os
3936

4037
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
4240
from launch import LaunchDescription
4341
from launch.actions import DeclareLaunchArgument
4442
from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution
@@ -57,7 +55,6 @@ def generate_launch_description() -> LaunchDescription:
5755
package_folder = get_package_share_directory('as2_platform_dji_psdk')
5856
platform_config_file = os.path.join(package_folder,
5957
'config/platform_config_file.yaml')
60-
6158
control_modes = PathJoinSubstitution([
6259
FindPackageShare('as2_platform_dji_psdk'),
6360
'config', 'control_modes.yaml'
@@ -73,9 +70,8 @@ def generate_launch_description() -> LaunchDescription:
7370
DeclareLaunchArgument('control_modes_file',
7471
default_value=control_modes,
7572
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,
7975
description='Platform configuration file'),
8076
Node(
8177
package='as2_platform_dji_psdk',
@@ -87,11 +83,12 @@ def generate_launch_description() -> LaunchDescription:
8783
arguments=['--ros-args', '--log-level',
8884
LaunchConfiguration('log_level')],
8985
parameters=[
90-
*as2_utils.launch_configuration('config_file',
91-
default_value=platform_config_file),
9286
{
9387
'control_modes_file': LaunchConfiguration('control_modes_file'),
94-
}
88+
},
89+
LaunchConfigurationFromConfigFile(
90+
'config_file',
91+
default_file=platform_config_file),
9592
]
9693
)
9794
])

0 commit comments

Comments
 (0)