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')
    dashboard_config = os.path.join(config_dir, 'dashboard_params.yaml')

    return LaunchDescription([
        DeclareLaunchArgument(
            'port',
            default_value='8080',
            description='Flask server port'
        ),
        Node(
            package='saltybot_dashboard',
            executable='dashboard_node',
            name='dashboard_node',
            parameters=[
                dashboard_config,
                {'port': LaunchConfiguration('port')},
            ],
            output='screen',
        ),
    ])
