[Frontend] hydra code - src/frontend/frontend_module.cpp (updateDeformationGraph)

About_work·2024년 10월 16일
0

lifelong scene graph

목록 보기
23/56

0. 핵심 요약

  • kimera_pgmo::MeshCompression(deformation_compression_) 에서, 오래된 mesh 제거
  • reconstruction input 의 요소인 mesh를 kimera_pgmo::MeshCompression(deformation_compression_)에 추가한 후, 압축
  • kimera_pgmo::Graph (deformation_graph_)에, 위 과정에서 새로 생성된 압축된 mesh 면(삼각형, 꼭지점)들을 그래프 형태(노드 + 엣지)로 변환하여 추가해줌
  • kimera_pgmo::Graph (deformation_graph_)에 추가된 새 압축된 edge들을 이용해서, PoseGraph를 만듭니다.
    • 이 PoseGraph는 새롭게 추가된 mesh 정보들을 담고 있습니다.
      • node: mesh 꼭지점
      • edge: 꼭지점들간 연결 관계 (두 꼭지점간 거리 관계)
void FrontendModule::updateDeformationGraph(const ReconstructionOutput& input) {
  ScopedTimer timer("frontend/dgraph_compresssion", input.timestamp_ns, true, 1, false);
  const auto& prefix = GlobalInfo::instance().getRobotPrefix();
  const auto time_ns = std::chrono::nanoseconds(input.timestamp_ns);
  double time_s =
      std::chrono::duration_cast<std::chrono::duration<double>>(time_ns).count();
  auto interface = PgmoMeshLayerInterface(input.map().getMeshLayer());

  PgmoCloud new_vertices;
  std::vector<size_t> new_indices;
  std::vector<pcl::Vertices> new_triangles;
  deformation_compression_->pruneStoredMesh(time_s - config.pgmo.time_horizon);
  deformation_compression_->compressAndIntegrate(interface,
                                                 new_vertices,
                                                 new_triangles,
                                                 new_indices,
                                                 deformation_remapping_,
                                                 time_s);

  PgmoCloud::Ptr vertices(new PgmoCloud());
  deformation_compression_->getVertices(vertices);

  std::vector<kimera_pgmo::Edge> new_edges;
  if (new_indices.size() > 0 && new_triangles.size() > 0) {
    // Add nodes and edges to graph
    new_edges = deformation_graph_.addPointsAndSurfaces(new_indices, new_triangles);
  }

  if (backend_input_) {
    backend_input_->deformation_graph = kimera_pgmo::makePoseGraph(
        prefix.id, time_s, new_edges, new_indices, *vertices);
  }
}

1. 변형 그래프 업데이트(Deformation Graph Update) 로직의 개념적 설명

  • Deformation Graph(변형 그래프)업데이트
  • 변형 그래프는 메시의 정점 간 연결을 추적하고, 이를 기반으로 맵이 변형되거나 재구성될 때 메시를 효율적으로 관리하는 데 사용
  • 이 함수는 새로운 정점과 표면 데이터를 통합하고, 이를 Pose Graph 형식으로 백엔드에 전달

주요 역할과 개념 정리

  1. 변형 그래프 관리

    • 이전 정점들을 삭제하고, 새 정점과 삼각형을 압축 및 통합해 그래프에 반영
  2. Pose Graph 생성과 전달

    • 정점과 edge을 기반으로 한 Pose Graph를 만들어 백엔드에 전달함으로써, 정점 간의 변형 관계를 최적화할 수 있게 함

정리

  • 이 함수는 메시 데이터와 변형 그래프를 업데이트해, 실시간으로 변화하는 환경을 반영
  • 주로 정점과 표면의 압축, 정점 간 연결 추적, Pose Graph 생성에 집중하며, 이를 통해 백엔드에서 최적화된 변형 그래프를 사용할 수 있도록 함

세부 로직 설명

kimera_pgmo::MeshCompression(deformation_compression_)

3. kimera_pgmo::Graph (deformation_graph_): mesh 를 추가하여 graph 형태로 변환


4. Pose Graph 생성 및 백엔드로 전달

  • makePoseGraph() 호출:
  • 백엔드로 전달:
    • 생성된 Pose Graph를 backend_input_에 저장해 백엔드 모듈이 최적화에 사용할 수 있도록 합니다.

profile
새로운 것이 들어오면 이미 있는 것과 충돌을 시도하라.

0개의 댓글