Apollo 10.0
自动驾驶开放平台
smart_recorder.cc
浏览该文件的文档.
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#include <memory>
18
19#include "gflags/gflags.h"
20
21#include "absl/strings/str_cat.h"
22#include "cyber/common/file.h"
23#include "cyber/common/log.h"
24
28
34
35int main(int argc, char** argv) {
36 google::ParseCommandLineFlags(&argc, &argv, true);
37 if (FLAGS_restored_output_dir.empty()) {
38 FLAGS_restored_output_dir =
39 absl::StrCat(FLAGS_source_records_dir, "_restored");
40 }
41 AINFO << "input dir: " << FLAGS_source_records_dir
42 << ". output dir: " << FLAGS_restored_output_dir
43 << ". config file: " << FLAGS_smart_recorder_config_filename
44 << ". program name: " << argv[0];
45 SmartRecordTrigger trigger_conf;
46 ACHECK(GetProtoFromFile(FLAGS_smart_recorder_config_filename, &trigger_conf))
47 << "Failed to load triggers config file "
48 << FLAGS_smart_recorder_config_filename;
49 auto processor = std::unique_ptr<RecordProcessor>(new RealtimeRecordProcessor(
50 FLAGS_source_records_dir, FLAGS_restored_output_dir));
51 if (!FLAGS_real_time_trigger) {
52 processor = std::unique_ptr<RecordProcessor>(new PostRecordProcessor(
53 FLAGS_source_records_dir, FLAGS_restored_output_dir));
54 }
55 if (!processor->Init(trigger_conf)) {
56 AERROR << "failed to init record processor";
57 return -1;
58 }
59 if (!processor->Process()) {
60 AERROR << "failed to process records";
61 return -1;
62 }
63 return 0;
64}
Post processor against recorded tasks that have been completed
Realtime processor against recorded tasks that are being recorded
Process messages and apply the rules based on configured triggers
#define ACHECK(cond)
Definition log.h:80
#define AERROR
Definition log.h:44
#define AINFO
Definition log.h:42
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132
int main(int argc, char **argv)