ATT_POWER 076f76394e
refactor(echo_plugin): Remove executor configuration and simplify echo logic (#78)
* refactor(echo_plugin): Remove executor configuration and simplify echo logic

- Removed executor field from echo_plugin configuration
- Simplified echo message handling process by processing directly in main thread
- Updated example configurations and descriptions in documentation

* refactor(echo_plugin): Refactor EchoPlugin class

- Remove get_type_support_func_ member variable, replace with direct GetTypeSupport method call in RegisterEchoChannel
- Merge EchoFunc creation and subscription callback logic to reduce intermediate variables

* refactor(echo_plugin): Remove GetTypeSupport function, directly access type_support_map where needed

* refactor(echo_plugin): Remove unused headers and member functions

* refactor(echo_plugin): Remove unnecessary 'this' capture in lambda expression

* refactor(echo_plugin): optimize buffer handling logic in EchoPlugin

* format

* fix(echo_plugin):  add release_callback func before return in sub_wrapper.callback

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-11-04 17:18:00 +08:00

2.4 KiB
Raw Blame History

echo插件

相关链接

参考示例:

插件概述

echo_plugin用于对 Channel 中的消息进行回显,插件支持独立的 type_support_pkg并支持指定执行器, 必须设定 log_lvl 为 TraceDebugInfo 之一才能正常工作。

插件的配置项如下:

节点 类型 是否可选 默认值 作用
type_support_pkgs array 必选 [] type support 包配置
type_support_pkgs[i].path string 必选 "" type support 包的路径
topic_meta_list array 必选 [] 要回显的 topic 和类型
topic_meta_list[j].topic_name string 必选 "" 要回显的 topic
topic_meta_list[j].msg_type string 必选 "" 要回显的消息类型
topic_meta_list[j].echo_type string 可选 "json" 回显消息的格式ros2 支持 "json", "yaml" pb 只支持 "json"

回显消息的简单示例配置

对于回显消息的格式ros2 消息类型 支持 "json", "yaml" pb只支持 "json"

以下是一个 pb 消息类型回显消息格式为 json 的简单示例配置:

aimrt:
  plugin:
    plugins:
      - name: echo_plugin
        path: ./libaimrt_echo_plugin.so
        options:
          type_support_pkgs:
            - path: ./libexample_event_ts_pkg.so       
          topic_meta_list:
            - topic_name: test_topic
              msg_type: pb:aimrt.protocols.example.ExampleEventMsg                
              echo_type: json
  log:
    core_lvl: Info # Trace/Debug/Info
    backends:
      - type: console
  channel:
    # ...

以下是一个 ros2 消息类型回显消息格式为 yaml 的简单示例配置:

aimrt:
  plugin:
    plugins:
      - name: echo_plugin
        path: ./libaimrt_echo_plugin.so
        options:
          type_support_pkgs:
            - path: ./libexample_event_ts_pkg.so       
          topic_meta_list:
            - topic_name: test_topic
              msg_type: ros2:example_ros2/msg/RosTestMsg       
              echo_type: yaml
  log:
    core_lvl: Info # Trace/Debug/Info
    backends:
      - type: console
  channel:
    # ...