wheelos / core

Autonomous driving middleware publish subscribe system
Other
22 stars 6 forks source link

fix talker and listener #36

Open daohu527 opened 1 month ago

daohu527 commented 1 month ago

listener not work

void Manager::OnRemoteChange(const std::string& msg_str) {
  if (is_shutdown_.load()) {
    ADEBUG << "the manager has been shut down.";
    return;
  }

  ChangeMsg msg;
  RETURN_IF(!message::ParseFromString(msg_str, &msg));    // error
daohu527 commented 1 month ago

string use fastcdr will cause error, so we should regenerate underlay_message

struct underlay_message {
  int32_t m_timestamp;
  int32_t m_seq;
  std::vector<char> m_data;
  std::vector<char> m_datatype;
};

for now we use the string size patch instead.

daohu527 commented 1 month ago

The above error is temporarily fixed, but the message cannot be received

OnChannelChange not triggered by the corresponding reader and writer

https://github.com/wheelos/core/blob/cfc8a7391f97734b2f90be29cc55402b9f8b8984/cyber/node/writer.h#L196-L213

daohu527 commented 1 month ago

https://github.com/wheelos/core/issues/6

daohu527 commented 1 month ago

seems subscriber_ can't receive msg from publisher_, OnRemoteChange call just own but need others, for example reader need writer, and writer need reader

bool Manager::CreateSubscriber(RtpsParticipant* participant) {
  RtpsSubscriberAttr sub_attr;
  RETURN_VAL_IF(
      !AttributesFiller::FillInSubAttr(
          channel_name_, QosProfileConf::QOS_PROFILE_TOPO_CHANGE, &sub_attr),
      false);
  listener_ = new SubscriberListener(
      std::bind(&Manager::OnRemoteChange, this, std::placeholders::_1));

  subscriber_ = eprosima::fastrtps::Domain::createSubscriber(
      participant, sub_attr, listener_);
  return subscriber_ != nullptr;
}
daohu527 commented 1 month ago

https://github.com/eProsima/Fast-DDS/discussions/5128

Fastdds cannot send or receive data. I suspect it is due to a parameter problem in Participant::CreateFastRtpsParticipant.