ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
24.81k stars 9.65k forks source link

start_time in planning_component #13180

Open chlois opened 3 years ago

chlois commented 3 years ago

Hi Team, I am reading the code of Apollo v6.0.0 and have a question about the start_time in _modules/planning/planningcomponent.cc. In the commit 26ae1720f57, start_time is moved from before FillHeader to after FillHeader.

  ADCTrajectory adc_trajectory_pb;
  planning_base_->RunOnce(local_view_, &adc_trajectory_pb);
  common::util::FillHeader(node_->Name(), &adc_trajectory_pb);

  // modify trajectory relative time due to the timestamp change in header
  auto start_time = adc_trajectory_pb.header().timestamp_sec();
  const double dt = start_time - adc_trajectory_pb.header().timestamp_sec();
  for (auto& p : *adc_trajectory_pb.mutable_trajectory_point()) {
    p.set_relative_time(p.relative_time() + dt);
  }
  planning_writer_->Write(adc_trajectory_pb);

May I ask why this modification is done? Thanks!

chentairan commented 3 years ago

I have the same confusion