"""pose_fusion.launch.py — Launch the multi-sensor pose fusion node (Issue #595)."""

import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():
    pkg_share = get_package_share_directory('saltybot_pose_fusion')
    default_params = os.path.join(pkg_share, 'config', 'pose_fusion_params.yaml')

    params_arg = DeclareLaunchArgument(
        'params_file',
        default_value=default_params,
        description='Path to pose_fusion_params.yaml',
    )

    pose_fusion_node = Node(
        package='saltybot_pose_fusion',
        executable='pose_fusion',
        name='pose_fusion',
        output='screen',
        parameters=[LaunchConfiguration('params_file')],
    )

    return LaunchDescription([params_arg, pose_fusion_node])
