ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.22k stars 9.72k forks source link

ParserNodelet and RtcmParserNodelet publish Topic "rtk_eph" and "rtk_obs" at the same time #3492

Closed jilinzhou closed 6 years ago

jilinzhou commented 6 years ago

In gnss_driver.launch, both ParserNodelet and RtcmParserNodelet are launched:

    <node pkg="nodelet" type="nodelet" name="parser_nodelet"
        args="load gnss_driver/ParserNodelet gnss_nodelet_manager" output="screen">
        <param name="gnss_conf" value="$(arg gnss_conf)" />
        <param name="proj4_text" value="$(arg proj4_text)" />
    </node>

    <node pkg="nodelet" type="nodelet" name="rtcm_parser_nodelet"
        args="load gnss_driver/RtcmParserNodelet gnss_nodelet_manager" output="screen">
    </node>

In data_parser.cpp, the topics are published with the following code:

void DataParser::dispatch_message(Parser::MessageType type,
                                  MessagePtr message) {
  std_msgs::String msg_pub;

  switch (type) {
    case Parser::MessageType::GNSS:
      check_gnss_status(As<::apollo::drivers::gnss::Gnss>(message));
      break;

    case Parser::MessageType::BEST_GNSS_POS:
      publish_bestpos_message(message);
      break;

    case Parser::MessageType::IMU:
      publish_imu_message(message);
      break;

    case Parser::MessageType::INS:
      check_ins_status(As<::apollo::drivers::gnss::Ins>(message));
      publish_corrimu_message(message);
      publish_odometry_message(message);
      break;

    case Parser::MessageType::INS_STAT:
      publish_ins_stat(message);
      break;

    case Parser::MessageType::BDSEPHEMERIDES:
    case Parser::MessageType::GPSEPHEMERIDES:
    case Parser::MessageType::GLOEPHEMERIDES:
      publish_ephemeris(message);
      break;

    case Parser::MessageType::OBSERVATION:
      publish_observation(message);
      break;

    default:
      break;
  }
}

void DataParser::publish_ephemeris(const MessagePtr message) {
  boost::shared_ptr<::apollo::drivers::gnss::GnssEphemeris> eph(
      new apollo::drivers::gnss::GnssEphemeris(
          *As<::apollo::drivers::gnss::GnssEphemeris>(message)));

  _ephemeris_publisher.publish(eph);
}

void DataParser::publish_observation(const MessagePtr message) {
  boost::shared_ptr<::apollo::drivers::gnss::EpochObservation> observation(
      new ::apollo::drivers::gnss::EpochObservation(
          *As<::apollo::drivers::gnss::EpochObservation>(message)));

  _observation_publisher.publish(observation);
}

And in rtcm_parser.cpp, they are also published:

void RtcmParser::dispatch_message(Parser::MessageType type,
                                  MessagePtr message) {
  std_msgs::String msg_pub;

  switch (type) {
    case Parser::MessageType::EPHEMERIDES:
      publish_ephemeris(message);
      break;

    case Parser::MessageType::OBSERVATION:
      publish_observation(message);
      break;

    default:
      break;
  }
}

void RtcmParser::publish_ephemeris(const MessagePtr message) {
  boost::shared_ptr<::apollo::drivers::gnss::GnssEphemeris> eph(
      new apollo::drivers::gnss::GnssEphemeris(
          *As<::apollo::drivers::gnss::GnssEphemeris>(message)));

  _ephemeris_publisher.publish(eph);
}

void RtcmParser::publish_observation(const MessagePtr message) {
  boost::shared_ptr<::apollo::drivers::gnss::EpochObservation> observation(
      new ::apollo::drivers::gnss::EpochObservation(
          *As<::apollo::drivers::gnss::EpochObservation>(message)));

  _observation_publisher.publish(observation);
}

Should be only one publisher for these two topics?

jilinzhou commented 6 years ago

The rtcm data are for correction only.