返回教程正文

配套源码

bridge.yaml

ros2/ros_ws_bridge/config/bridge.yaml
ROS 2 与 App 通讯 01:用四组 LED 跑通双向链路ros2/ros_ws_bridge/config/bridge.yaml
YAML21 行
websocket:
  uri: "ws://127.0.0.1:8765/ros"
  reconnect_delay_s: 1.0
  max_message_bytes: 16384

topics:
  - topic: "/bridge/demo_text_to_app"
    ros_type: "std_msgs/msg/String"
    direction: "ros_to_ws"

  - topic: "/bridge/demo_text_from_app"
    ros_type: "std_msgs/msg/String"
    direction: "ws_to_ros"

  - topic: "/bridge/demo_array_to_app"
    ros_type: "std_msgs/msg/UInt8MultiArray"
    direction: "ros_to_ws"

  - topic: "/bridge/demo_array_from_app"
    ros_type: "std_msgs/msg/UInt8MultiArray"
    direction: "ws_to_ros"