#!/usr/bin/env python3

from launch import LaunchDescription
from launch_ros.actions import Node
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
import os


def generate_launch_description():
    """Launch emotion engine node with configuration."""

    # Get the package directory
    package_share_dir = FindPackageShare("saltybot_emotion_engine")
    config_file = PathJoinSubstitution(
        [package_share_dir, "config", "emotion_engine.yaml"]
    )

    # Emotion engine node
    emotion_engine_node = Node(
        package="saltybot_emotion_engine",
        executable="emotion_engine",
        name="emotion_engine",
        output="screen",
        parameters=[config_file],
        remappings=[
            # Remap topic names if needed
            ("/saltybot/battery", "/saltybot/battery_level"),
            ("/saltybot/balance_stable", "/saltybot/balance_status"),
        ],
        on_exit_event_handlers=[],  # Could add custom handlers
    )

    return LaunchDescription([
        emotion_engine_node,
    ])
