20 #include "glog/logging.h" 27 constexpr
double kSensorDataRatesLoggingPeriodSeconds = 15.;
33 const std::set<SensorId>& expected_sensor_ids,
34 std::unique_ptr<TrajectoryBuilderInterface> wrapped_trajectory_builder)
35 : sensor_collator_(sensor_collator),
37 wrapped_trajectory_builder_(std::move(wrapped_trajectory_builder)),
38 last_logging_time_(std::chrono::steady_clock::now()) {
39 std::unordered_set<std::string> expected_sensor_id_strings;
40 for (
const auto& sensor_id : expected_sensor_ids) {
41 expected_sensor_id_strings.insert(sensor_id.id);
44 trajectory_id, expected_sensor_id_strings,
45 [
this](
const std::string& sensor_id, std::unique_ptr<sensor::Data> data) {
57 const std::string& sensor_id, std::unique_ptr<sensor::Data> data) {
62 std::piecewise_construct, std::forward_as_tuple(sensor_id),
63 std::forward_as_tuple(
67 it->second.Pulse(data->GetTime());
72 LOG(INFO) << pair.first <<
" rate: " << pair.second.DebugString();
void AddData(std::unique_ptr< sensor::Data > data)
std::unique_ptr< TrajectoryBuilderInterface > wrapped_trajectory_builder_
void HandleCollatedSensorData(const std::string &sensor_id, std::unique_ptr< sensor::Data > data)
virtual void AddSensorData(int trajectory_id, std::unique_ptr< Data > data)=0
CollatedTrajectoryBuilder(sensor::CollatorInterface *sensor_collator, int trajectory_id, const std::set< SensorId > &expected_sensor_ids, std::unique_ptr< TrajectoryBuilderInterface > wrapped_trajectory_builder)
sensor::CollatorInterface *const sensor_collator_
std::map< std::string, common::RateTimer<> > rate_timers_
virtual void AddTrajectory(int trajectory_id, const std::unordered_set< std::string > &expected_sensor_ids, const Callback &callback)=0
Duration FromSeconds(const double seconds)
~CollatedTrajectoryBuilder() override
std::chrono::steady_clock::time_point last_logging_time_