Skip to content

Commit

Permalink
Fix launcher using as2 utils
Browse files Browse the repository at this point in the history
  • Loading branch information
RPS98 committed Jul 10, 2024
1 parent ace9609 commit 85803e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 2 additions & 3 deletions launch/as2_platform_dji_psdk.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'
Expand Down
14 changes: 8 additions & 6 deletions launch/psdk_wrapper.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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'),
])

Expand Down

0 comments on commit 85803e7

Please sign in to comment.