概述
由modules\planning\common\dependency_injector.h实现,无.cc文件。
从类名来看,应该是planning模块依赖的输入数据的注入类。
从代码来看DependencyInjector类主要是实现:
将planning所有涉及到的相关信息都集中存放到这个类里 车辆状态,规划历史数据,障碍物历史状态信息等
dependency_injector.h
#pragma once
#include "modules/common/vehicle_state/vehicle_state_provider.h"
#include "modules/planning/common/ego_info.h"
#include "modules/planning/common/frame.h"
#include "modules/planning/common/history.h"
#include "modules/planning/common/learning_based_data.h"
#include "modules/planning/common/planning_context.h"
namespace apollo {
namespace planning {
class DependencyInjector {
public:
DependencyInjector() = default;
~DependencyInjector() = default;
PlanningContext* planning_context() {
return &planning_context_;
}
FrameHistory* frame_history() {
return &frame_history_;
}
History* history() {
return &history_;
}
EgoInfo* ego_info() {
return &ego_info_;
}
apollo::common::VehicleStateProvider* vehicle_state() {
return &vehicle_state_;
}
LearningBasedData* learning_based_data() {
return &learning_based_data_;
}
private:
PlanningContext planning_context_;
FrameHistory frame_history_;
History history_;
EgoInfo ego_info_;
apollo::common::VehicleStateProvider vehicle_state_;
LearningBasedData learning_based_data_;
};
}
}
|