"""
uwb_calibration.launch.py — Launch the UWB anchor auto-calibration service.

Usage:
    ros2 launch saltybot_uwb_calibration uwb_calibration.launch.py

Then trigger from command line:
    ros2 service call /saltybot/uwb/calibrate_anchors \\
        saltybot_uwb_calibration_msgs/srv/CalibrateAnchors \\
        "{anchor_ids: [], n_samples: 5}"
"""

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


def generate_launch_description() -> LaunchDescription:
    pkg_dir = get_package_share_directory("saltybot_uwb_calibration")
    params_file = os.path.join(pkg_dir, "config", "calibration_params.yaml")

    calibration_node = Node(
        package="saltybot_uwb_calibration",
        executable="uwb_calibration",
        name="uwb_anchor_calibration",
        parameters=[params_file],
        output="screen",
        emulate_tty=True,
    )

    return LaunchDescription([calibration_node])
