Apollo 11.0
自动驾驶开放平台
evaluate_trajectory.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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 <boost/filesystem.hpp>
18
19#include "absl/strings/str_split.h"
20
21#include "cyber/common/file.h"
25
26DEFINE_string(planning_source_dirs, "",
27 "a list of source files or directories for offline mode. "
28 "The items need to be separated by colon ':'. ");
29
30namespace apollo {
31namespace planning {
32
34 const std::vector<std::string> inputs =
35 absl::StrSplit(FLAGS_planning_source_dirs, ':');
36 Evaluator evaluator;
37 evaluator.Init();
38 for (const auto& input : inputs) {
39 std::vector<std::string> source_files;
40 util::GetFilesByPath(boost::filesystem::path(input), &source_files);
41 auto it = source_files.begin();
42 while (it != source_files.end()) {
43 if ((*it).substr((*it).size() - 4) != ".bin") {
44 it = source_files.erase(it);
45 } else {
46 ++it;
47 }
48 }
49 AINFO << "For input " << input << ", found " << source_files.size()
50 << " files to process";
51 for (std::size_t i = 0; i < source_files.size(); ++i) {
52 AINFO << "\tProcessing: [ " << i + 1 << " / " << source_files.size()
53 << " ]: " << source_files[i];
54 evaluator.Evaluate(source_files[i]);
55 }
56 }
57 evaluator.Close();
58}
59
60} // namespace planning
61} // namespace apollo
62
63int main(int argc, char* argv[]) {
64 google::ParseCommandLineFlags(&argc, &argv, true);
66 return 0;
67}
void Evaluate(const std::string &source_file)
Definition evaluator.cc:49
Planning module main class.
int main(int argc, char *argv[])
DEFINE_string(planning_source_dirs, "", "a list of source files or directories for offline mode. " "The items need to be separated by colon ':'. ")
#define AINFO
Definition log.h:42
void GetFilesByPath(const boost::filesystem::path &path, std::vector< std::string > *files)
Definition util.cc:138
class register implement
Definition arena_queue.h:37