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

prediction: code refactor on prediction component

上级 61011dc2
......@@ -23,8 +23,6 @@
#include "boost/filesystem.hpp"
#include "boost/range/iterator_range.hpp"
// #include "rosbag/bag.h"
// #include "rosbag/view.h"
#include "modules/common/adapters/adapter_gflags.h"
#include "modules/common/math/vec2d.h"
......@@ -87,7 +85,8 @@ std::string PredictionComponent::Name() const {
// }
// bag.close();
// }
void PredictionComponent::ProcessRosbag(const std::string& filename) {
void PredictionComponent::ProcessOfflineData(const std::string& filename) {
// TODO(all) implement
}
......@@ -154,14 +153,14 @@ bool PredictionComponent::Init() {
apollo::common::util::split(FLAGS_prediction_offline_bags, ':', &inputs);
for (const auto& input : inputs) {
std::vector<std::string> offline_bags;
GetDataFiles(boost::filesystem::path(input), &offline_bags);
GetDataFileNames(boost::filesystem::path(input), &offline_bags);
std::sort(offline_bags.begin(), offline_bags.end());
AINFO << "For input " << input << ", found " << offline_bags.size()
<< " rosbags to process";
for (std::size_t i = 0; i < offline_bags.size(); ++i) {
AINFO << "\tProcessing: [ " << i << " / " << offline_bags.size()
<< " ]: " << offline_bags[i];
ProcessRosbag(offline_bags[i]);
ProcessOfflineData(offline_bags[i]);
}
}
Stop();
......
......@@ -93,11 +93,13 @@ class PredictionComponent :
* @brief process rosbag in offline mode, mainly for extracting prediction
* features.
*/
void ProcessRosbag(const std::string &filename);
void ProcessOfflineData(const std::string &filename);
private:
double start_time_ = 0.0;
PredictionConf prediction_conf_;
common::adapter::AdapterManagerConfig adapter_conf_;
};
......
......@@ -24,7 +24,7 @@
namespace apollo {
namespace prediction {
void GetDataFiles(const boost::filesystem::path& p,
void GetDataFileNames(const boost::filesystem::path& p,
std::vector<std::string>* bag_files) {
CHECK(bag_files);
if (!boost::filesystem::exists(p)) {
......@@ -41,7 +41,7 @@ void GetDataFiles(const boost::filesystem::path& p,
if (boost::filesystem::is_directory(p)) {
for (auto& entry : boost::make_iterator_range(
boost::filesystem::directory_iterator(p), {})) {
GetDataFiles(entry.path(), bag_files);
GetDataFileNames(entry.path(), bag_files);
}
}
}
......
......@@ -26,8 +26,8 @@
namespace apollo {
namespace prediction {
void GetDataFiles(const boost::filesystem::path& p,
std::vector<std::string>* bag_files);
void GetDataFileNames(const boost::filesystem::path& p,
std::vector<std::string>* data_files);
} // namespace prediction
} // namespace apollo
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册