Files
acRealman_xr_from_Yikai/xr_rm_input/launch/udp_receiver.launch.py

34 lines
1.4 KiB
Python
Executable File

"""XR 手柄 UDP 接收节点的独立启动入口。
该 launch 文件只启动 `udp_controller_receiver`,用于低层通信调试:确认 PICO
或 sample_udp_sender 发出的 UDP JSON 能被 ROS2 接收,并发布到指定手柄话题。
完整单臂/双臂遥操作请优先使用 xr_rm_bringup 中的 launch 文件。
"""
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
def generate_launch_description() -> LaunchDescription:
return LaunchDescription([
# UDP 监听地址和端口,需要与发送端配置一致。
DeclareLaunchArgument("udp_host", default_value="0.0.0.0"),
DeclareLaunchArgument("udp_port", default_value="15000"),
# 兼容旧版单手柄调试入口;双臂调试会使用 left_topic/right_topic。
DeclareLaunchArgument("topic", default_value="/xr/right_controller"),
# 仅启动 UDP 接收节点,不启动任何机械臂控制节点。
Node(
package="xr_rm_input",
executable="udp_controller_receiver",
name="udp_controller_receiver",
output="screen",
parameters=[{
"udp_host": LaunchConfiguration("udp_host"),
"udp_port": LaunchConfiguration("udp_port"),
"topic": LaunchConfiguration("topic"),
}],
),
])