ZBLOG

13.2.3. Monitor Service Configuration The Monitor Service can be activated using the -DFASTDDS_STATISTICS=ON at CMake configuration step (for further information regarding the Fast DDS compilation, see Linux installation from sources and Windows ...

这段文字是关于Fast DDS(一个数据分发服务)的监控服务配置的说明。以下是对文本的逐步解释:

监控服务配置

  1. 启用监控服务

    • 你可以在CMake配置步骤中使用 -DFASTDDS_STATISTICS=ON 来激活监控服务。
    • 有关Fast DDS编译的更多信息,可以参考源代码安装的Linux和Windows部分。
  2. 编程启用与禁用监控服务

    • 一旦激活了监控服务功能,你可以通过以下API调用在DDS层和RTPS层中以编程方式启用或禁用它:
      • enable_monitor_service()
      • disable_monitor_service()
    • 另外,使用 PropertyPolicyQos 中定义的新属性:fastdds.enable_monitor_service 也可以控制此功能。
  3. 不同方式启用/禁用监控服务: 表格列出了几种不同的方法来启用或禁用监控服务,包括 C++ API、C++ 属性、XML 配置、环境变量等。

示例代码

给出了一段示例代码,展示如何通过API启用和禁用Fast DDS的监控服务:

DomainParticipant* participant = DomainParticipantFactory::get_instance()->create_participant(0,
                PARTICIPANT_QOS_DEFAULT);

// 获取子类指针
eprosima::fastdds::statistics::dds::DomainParticipant* statistics_participant =
        eprosima::fastdds::statistics::dds::DomainParticipant::narrow(participant);

// 启动 Fast DDS 监控服务
statistics_participant->enable_monitor_service();

// 停止 Fast DDS 监控服务
statistics_participant->disable_monitor_service();

端点QoS设置

对于任何使用Monitor Service的消费者应用程序,需考虑以下内容:

Monitor Service Status Topic DataWriter 的端点 QoS

Endpoint QoS Value
MONITOR_STATUS_WRITER ReliabilityQosPolicyKind RELIABLE_RELIABILITY_QOS
HistoryQosPolicyKind KEEP_LAST_HISTORY_QOS 1
DurabilityQosPolicyKind TRANSIENT_LOCAL_DURABILITY_QOS
  • ReliabilityQosPolicyKind 设置为可靠性QoS,确保数据传输的可靠性。
  • HistoryQosPolicyKind 设置为保留最后一条历史记录,以便消费者能够访问最新的数据。
  • DurabilityQosPolicyKind 设置为瞬态本地持久性,以便在读者连接时能够接收最近的数据。

这些QoS设置确保了Monitor Service的数据传输具有所需的可靠性和持续性。


内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://sdn.0voice.com/?id=7437

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?