apollo事件通信机制

        我目前用的是基于ros版本的apollo,在apollo内部有两种消息传输机制,一种是基于ros的回调函数的订阅<详细介绍>来实现各个模块之间的数据通信,还有一种就是事件的通信机制,主要用于感知模块内部的通信,这种通信是基于进程间的内存共享来实现消息的传递.下面我主要介绍第二种消息传递的方式:

  • 先看一下事件的实际应用

发布事件:

void AsyncFusionSubnode::PublishDataAndEvent(
    const double timestamp, const std::string &device_id,
    const SharedDataPtr &data) {
  CommonSharedDataKey key(timestamp, device_id);
  bool fusion_succ = fusion_data_->Add(key, data);
  if (!fusion_succ) {
    AERROR << "fusion shared data addkey failure";
  }

  ADEBUG << "adding key in fusion shared data " << key.ToString();

  for (size_t idx = 0; idx < pub_meta_events_.size(); ++idx) {
    const EventMeta &event_meta = pub_meta_events_[idx];
    Event event;
    event.eve

你可能感兴趣的:(APOLLO,Apollo,perception,shared,data)