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

def generate_launch_description():
    config_dir = os.path.join(
        os.path.dirname(__file__),
        '..',
        'config'
    )

    curiosity_config = os.path.join(config_dir, 'curiosity_params.yaml')

    return LaunchDescription([
        DeclareLaunchArgument(
            'curiosity_level',
            default_value='0.7',
            description='Curiosity activation probability (0.0-1.0)'
        ),
        DeclareLaunchArgument(
            'idle_threshold_sec',
            default_value='60',
            description='Seconds of idle before exploration activates'
        ),
        Node(
            package='saltybot_curiosity',
            executable='curiosity_node',
            name='curiosity_node',
            parameters=[
                curiosity_config,
                {
                    'curiosity_level': LaunchConfiguration('curiosity_level'),
                    'idle_threshold_sec': LaunchConfiguration('idle_threshold_sec'),
                }
            ],
            remappings=[],
            output='screen',
        ),
    ])
