HydraPythonPipeline
클래스의 헤더 파일. class HydraPythonPipeline : public HydraPipeline {
public:
using PositionMatrix = FrontendModule::PositionMatrix;
PositionMatrix
타입 정의: PositionMatrix
라는 타입을 정의하고 있는데, 이는 FrontendModule::PositionMatrix
에서 가져온 타입으로, HydraPythonPipeline(const PipelineConfig& config,
int robot_id = 0,
int config_verbosity = 0,
bool step_mode_only = true);
virtual ~HydraPythonPipeline();
HydraPythonPipeline
의 생성자는 여러 매개변수를 받는데, PipelineConfig
, robot_id
, config_verbosity
, 그리고 step_mode_only
야.PipelineConfig
: config_verbosity
: step_mode_only
:true
이면 단계별로 처리, false
이면 연속 실행일 가능성이 있어.virtual ~HydraPythonPipeline()
은 이 클래스가 삭제될 때 호출되는 가상 소멸자야. 메모리 관리와 관련된 작업이 있을 수 있어.initPython
void initPython(const PythonConfig& config, const PythonCamera& camera);
PythonConfig
: 파이프라인의 동작을 제어하는 데 사용
PythonCamera
: start
, stop
, save
void start() override;
void stop() override;
void save() override;
protected:
bool step_mode_only_;
std::shared_ptr<ReconstructionModule> reconstruction_;
std::shared_ptr<FrontendModule> frontend_;
std::shared_ptr<BackendModule> backend_;
std::shared_ptr<LoopClosureModule> loop_closure_;
DynamicSceneGraph::Ptr graph_;
step_mode_only_
: reconstruction_
: frontend_
: backend_
: loop_closure_
: ㅌㅈ
HydraPythonPipeline
클래스를 Python에서 사용할 수 있도록 만들어주는 역할을 해. initPython
modules_["reconstruction"] = reconstruction_;
modules_["frontend"] = frontend_;
modules_["backend"] = backend_;
if (GlobalInfo::instance().getConfig().enable_lcd) {
auto lcd_config = config::fromYaml<LoopClosureConfig>(node);
lcd_config.detector.num_semantic_classes = GlobalInfo::instance().getTotalLabels();
config::checkValid(lcd_config);
shared_state_->lcd_queue.reset(new InputQueue<LcdInput::Ptr>());
loop_closure_ = std::make_shared<LoopClosureModule>(lcd_config, shared_state_);
modules_["lcd"] = loop_closure_;
}
HydraPipeline::start()
를 써야하는듯step
메서드 (Overloading).def("step",
[](HydraPythonPipeline& pipeline,
size_t timestamp_ns,
const Eigen::Vector3d& world_t_body,
const Eigen::Vector4d& world_R_body,
const py::buffer& depth,
const py::buffer& labels,
const py::buffer& rgb) {
auto input = std::make_shared<InputPacket>();
input->timestamp_ns = timestamp_ns;
input->world_t_body = world_t_body;
input->world_R_body = Eigen::Quaterniond(
world_R_body[0], world_R_body[1], world_R_body[2], world_R_body[3]);
input->sensor_input =
std::make_unique<PythonSensorInput>(timestamp_ns, depth, labels, rgb);
return pipeline.spinOnce(*input);
})
step
: depth
, labels
, rgb
데이터를 받아 처리InputPacket
)을 구성한 후, spinOnce
메서드를 통해 한 단계를 처리함.pipeline.step(timestamp_ns, world_t_body, world_R_body, depth, labels, rgb)
bool HydraPythonPipeline::spinOnce(const InputPacket& input) {
if (!reconstruction_->spinOnce(input)) {
return false;
}
if (!frontend_->spinOnce()) {
LOG(ERROR) << "[Hydra] Frontend failed to return output";
return false;
}
backend_->spinOnce(true);
return true;
}
__init__
): HydraPythonPipeline
객체를 초기화하며, 설정 파일, 로봇 ID 등을 전달받아 초기 상태를 설정.init
: save
: step
(오버로드): graph
(속성):