Apollo 10.0
自动驾驶开放平台
realtime_record_processor.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <memory>
20#include <string>
21#include <vector>
22
23#include "absl/strings/str_cat.h"
24#include "cyber/cyber.h"
27#include "modules/common_msgs/monitor_msgs/smart_recorder_status.pb.h"
28#include "modules/data/tools/smart_recorder/proto/smart_recorder_triggers.pb.h"
30
31namespace apollo {
32namespace data {
33
39 public:
40 RealtimeRecordProcessor(const std::string& source_record_dir,
41 const std::string& restored_output_dir);
42 bool Init(const SmartRecordTrigger& trigger_conf) override;
43 bool Process() override;
44 std::string GetDefaultOutputFile() const override {
45 return absl::StrCat(restored_output_dir_, "/", default_output_filename_);
46 };
47 void MonitorStatus();
48 virtual ~RealtimeRecordProcessor() = default;
49
50 private:
51 bool GetNextValidRecord(std::string* record_path) const;
52 void RestoreMessage(const uint64_t message_time);
53 void PublishStatus(const RecordingState state,
54 const std::string& message) const;
55 void ProcessRestoreRecord(const std::string& record_path);
56 double GetDuration(const std::string& record_file);
57
58 std::shared_ptr<cyber::record::Recorder> recorder_ = nullptr;
59 std::shared_ptr<cyber::Node> smart_recorder_node_ = nullptr;
60 std::shared_ptr<cyber::Writer<SmartRecorderStatus>> recorder_status_writer_ =
61 nullptr;
62 std::vector<std::string> record_files_;
63 std::string default_output_filename_;
64 std::string restore_path_;
65 uint32_t reused_record_num_ = 0;
66 uint64_t restore_reader_time_ = 0;
67 double max_backward_time_ = 30.0;
68 double min_restore_chunk_ = 5.0;
69 bool is_terminating_ = false;
70 const int recorder_wait_time_ = 5000;
71};
72
73} // namespace data
74} // namespace apollo
Realtime processor against recorded tasks that are being recorded
bool Init(const SmartRecordTrigger &trigger_conf) override
virtual ~RealtimeRecordProcessor()=default
std::string GetDefaultOutputFile() const override
Process messages and apply the rules based on configured triggers
const std::string restored_output_dir_
class register implement
Definition arena_queue.h:37