import os
from launch import LaunchDescription
from launch_ros.actions import Node


def generate_launch_description():
    return LaunchDescription([
        Node(
            package='teleop_twist_keyboard',
            executable='teleop_twist_keyboard',
            name='teleop_keyboard',
            output='screen',
            prefix='xterm -e',  # 或 'gnome-terminal --' 替换为你的终端命令
            # mecanum_drive_controller expects a stamped reference; teleop must
            # publish geometry_msgs/TwistStamped with a fresh timestamp.
            # It publishes on the standard /cmd_vel topic, which the sim launch
            # feeds to the controller (spawner remap + cmd_vel_relay), mirroring
            # the physical robot.
            parameters=[{
                'stamped': True,
                'frame_id': 'base_link',
            }],
        )
    ])
