提交 ea30d6cf 编写于 作者: Y Yajia Zhang 提交者: Kecheng Xu

prediction: separate data extraction from prediction_component

上级 88751c31
......@@ -30,6 +30,7 @@ cc_library(
"//modules/prediction/predictor:predictor_manager",
"//modules/prediction/proto:prediction_conf_proto",
"//modules/prediction/proto:prediction_proto",
"//modules/prediction/util:data_extraction",
"//framework:cybertron",
],
)
......
......@@ -40,6 +40,7 @@
#include "modules/prediction/evaluator/evaluator_manager.h"
#include "modules/prediction/predictor/predictor_manager.h"
#include "modules/prediction/proto/prediction_obstacle.pb.h"
#include "modules/prediction/util/data_extraction.h"
namespace apollo {
namespace prediction {
......@@ -61,28 +62,6 @@ std::string PredictionComponent::Name() const {
return FLAGS_prediction_module_name;
}
void GetDataFiles(const boost::filesystem::path& p,
std::vector<std::string>* bag_files) {
CHECK(bag_files);
if (!boost::filesystem::exists(p)) {
return;
}
if (boost::filesystem::is_regular_file(p)) {
const auto ext = p.extension();
if (ext == ".bag" || ext == ".BAG") {
AINFO << "Found bag file: " << p.c_str();
bag_files->push_back(p.c_str());
}
return;
}
if (boost::filesystem::is_directory(p)) {
for (auto& entry : boost::make_iterator_range(
boost::filesystem::directory_iterator(p), {})) {
GetDataFiles(entry.path(), bag_files);
}
}
}
void PredictionComponent::ProcessRosbag(const std::string& filename) {
const std::vector<std::string> topics{FLAGS_perception_obstacle_topic,
FLAGS_localization_topic};
......
load("//tools:cpplint.bzl", "cpplint")
package(default_visibility = ["//visibility:public"])
cc_library(
name = "data_extraction",
srcs = ["data_extraction.cc"],
hdrs = [
"data_extraction.h",
],
deps = [
"//modules/common",
"//modules/common:log",
"//framework:cybertron",
],
)
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "modules/prediction/util/data_extraction.h"
#include "modules/common/log.h"
namespace apollo {
namespace prediction {
void GetDataFiles(const boost::filesystem::path& p,
std::vector<std::string>* bag_files) {
CHECK(bag_files);
if (!boost::filesystem::exists(p)) {
return;
}
if (boost::filesystem::is_regular_file(p)) {
const auto ext = p.extension();
if (ext == ".bag" || ext == ".BAG") {
AINFO << "Found bag file: " << p.c_str();
bag_files->push_back(p.c_str());
}
return;
}
if (boost::filesystem::is_directory(p)) {
for (auto& entry : boost::make_iterator_range(
boost::filesystem::directory_iterator(p), {})) {
GetDataFiles(entry.path(), bag_files);
}
}
}
} // namespace prediction
} // namespace apollo
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#ifndef MODULES_PREDICTION_UTIL_DATA_EXTRACTION_H_
#define MODULES_PREDICTION_UTIL_DATA_EXTRACTION_H_
#include <string.h>
#include "boost/filesystem.hpp"
#include "boost/range/iterator_range.hpp"
namespace apollo {
namespace prediction {
void GetDataFiles(const boost::filesystem::path& p,
std::vector<std::string>* bag_files);
} // namespace prediction
} // namespace apollo
#endif /* MODULES_PREDICTION_UTIL_DATA_EXTRACTION_H_ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册