专栏算法工具链tros 通信插件 DataWriter 类的IsNeedSerialize() 接口未被调用

tros 通信插件 DataWriter 类的IsNeedSerialize() 接口未被调用

已解决
默认335042024-07-16
59
2

用户您好,请详细描述您所遇到的问题,详细的描述有助于帮助我们快速定位,解决问题~Thanks♪(・ω・)ノ

1. 硬件获取渠道及型号: TROS-SDK-1.7.5
2. 系统镜像版本: tros_img.tgz

3. 问题模块: 【communicaton模块】

4. 问题描述: 插件 DataWriter 类的发送数据接口 AsyncWrite() 的无法关闭序列化功能,DataWriter类的IsNeedSerialize() 接口返回为false。请问一下插件 DataWriter 类的IsNeedSerialize() 接口 的调用链路是否为: Writer::ParticipantWrite -> WriterBase::IsNeedSerialize -> 插件 DataWriter::IsNeedSerialize()

在writer_base 增加的日志,不清楚是为何调试时未输出,强制返回false也未生效。编译后的如下几个库已copy到测试程序可执行文件同一目录中.

libcommunication-static.a  libcommunication.so     libcommunication.so.4    libcommunication.so.4.10.5

5. 示例代码:

bool WriterBase::IsNeedSerialize(

    const std::vector> &participants) {

  // 强制不适用序列化

  COHLOGE("WriterBase::IsNeedSerialize , force not use serialize ......");

  return false;

  bool need_serialize{false};

  for (auto &elem : participants) {

    if (elem->GetDataWriter() && elem->GetDataWriter()->IsNeedSerialize()) {

      need_serialize = true;

      break;

    }

  }

  return need_serialize;

}

bool WriterBase::IsNeedSerialize(std::shared_ptr participant) {

  // 强制不适用序列化

  COHLOGE("WriterBase::IsNeedSerialize , force not use serialize ......");

  return false;

  if (!participant->GetDataWriter()) {

    COHLOGE("WriterBase::IsNeedSerialize , data writer obj is null ......");

    return false;

  }

  COHLOGE("WriterBase::IsNeedSerialize , data writer obj is not null ......");

  return participant->GetDataWriter()->IsNeedSerialize();

}



6. log文件(目前暂不支持附件上传,请通过百度网盘上传后贴链接):

算法工具链
评论1
0/1000
  • aaa_xxx_hobot
    Lv.1
    分析的调用逻辑是对的。按照上述方法添加强制不序列化的代码逻辑上是生效的,看下是否修改后编译的库,和运行时库是完全一样了吗。比如运行环境上是否有多个communication.so,然后某个路径下的communication.so的搜索优先级比较高。
    2024-07-16
    1
    1
    • 默认33504回复aaa_xxx_hobot:

      好的,十分感谢答复,可能是tros sdk 部署的库没有替换

      /root/.tros/1.7.5/Linux/lib/tros/libcommunic*

      2024-07-16
      0