diff --git a/launch/as2_platform_dji_psdk.launch.py b/launch/as2_platform_dji_psdk.launch.py index cc27d98..288d798 100644 --- a/launch/as2_platform_dji_psdk.launch.py +++ b/launch/as2_platform_dji_psdk.launch.py @@ -39,8 +39,9 @@ from as2_core.launch_configuration_from_config_file import LaunchConfigurationFromConfigFile from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch.substitutions import EnvironmentVariable, LaunchConfiguration +from launch.substitutions import EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare def generate_launch_description() -> LaunchDescription: @@ -52,10 +53,8 @@ def generate_launch_description() -> LaunchDescription: """ # Get default platform configuration file package_folder = get_package_share_directory('as2_platform_dji_psdk') - platform_config_file = os.path.join(package_folder, 'config/platform_config_file.yaml') - control_modes = PathJoinSubstitution([ FindPackageShare('as2_platform_dji_psdk'), 'config', 'control_modes.yaml' diff --git a/launch/psdk_wrapper.launch.py b/launch/psdk_wrapper.launch.py index b15f93d..d5fc703 100644 --- a/launch/psdk_wrapper.launch.py +++ b/launch/psdk_wrapper.launch.py @@ -38,7 +38,8 @@ import os from ament_index_python.packages import get_package_share_directory -import as2_core.launch_param_utils as as2_utils +from as2_core.declare_launch_arguments_from_config_file import DeclareLaunchArgumentsFromConfigFile +from as2_core.launch_configuration_from_config_file import LaunchConfigurationFromConfigFile import launch from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, EmitEvent @@ -79,13 +80,14 @@ def generate_launch_description() -> LaunchDescription: output='screen', emulate_tty=True, parameters=[ - *as2_utils.launch_configuration('psdk_params_file', - default_value=psdk_params_file), { 'link_config_file_path': LaunchConfiguration('link_config_file_path'), 'hms_return_codes_path': LaunchConfiguration('hms_return_codes_path'), }, LaunchConfiguration('psdk_authentication_params_file'), + LaunchConfigurationFromConfigFile( + 'psdk_params_file', + default_file=psdk_params_file), ], remappings=[ ('psdk_ros2/gps_position_fused', 'sensor_measurements/gps'), @@ -126,9 +128,9 @@ def generate_launch_description() -> LaunchDescription: DeclareLaunchArgument('hms_return_codes_path', default_value=hms_return_codes_file, description='Path to JSON file with known DJI return codes'), - *as2_utils.declare_launch_arguments( - 'psdk_params_file', - default_value=psdk_params_file, + DeclareLaunchArgumentsFromConfigFile( + name='psdk_params_file', + source_file=psdk_params_file, description='Paremeters for DJI PSDK authentication'), ])