Skip to content
Snippets Groups Projects

support new import in memory for prior data

Merged Fabian Tërnava requested to merge fix/navigationAronData into master
4 unresolved threads

update import for new data format

Merge request reports

Approval is optional

Merged by Fabian TërnavaFabian Tërnava 3 years ago (Mar 22, 2022 8:59am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
178 178
179 179 if (std::filesystem::is_directory(graph))
180 180 {
181 // TODO:
181 armem::Commit c;
182 armem::MemoryID providerID = workingMemory().id();
183 providerID.coreSegmentName = "Graph";
184 providerID.providerSegmentName = providerName;
185
186 for (const auto& graphdir : std::filesystem::directory_iterator(graph))
  • 187 {
    188 const std::filesystem::path singleGraph = graphdir.path();
    189 if (std::filesystem::is_directory(singleGraph))
    190 {
    191 navigation::core::arondto::Graph g;
    192
    193 for (const auto& subdir : std::filesystem::directory_iterator(singleGraph))
    194 {
    195 const std::filesystem::path vertice = subdir.path();
    196 if (std::filesystem::is_regular_file(vertice))
    197 {
    198 std::ifstream ifs(vertice);
    199 const std::string content((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
    200
    201 // parse graph
    202 nlohmann::json j = nlohmann::json::parse(content);
  • 206 auto split = simox::alg::split(location, "/");
    207 ARMARX_CHECK_EQUAL(split.size(), 4);
    208
    209 armarx::navigation::core::arondto::Vertex v;
    210 v.vertexID = id;
    211 v.locationID.memoryName = split[0];
    212 v.locationID.coreSegmentName = split[1];
    213 v.locationID.providerSegmentName = split[2];
    214 v.locationID.entityName = split[3];
    215 v.locationID.timestamp = armem::Time::microSeconds(-1);
    216 v.locationID.instanceIndex = 0;
    217
    218 g.vertices.push_back(v);
    219
    220 // load edges
    221 std::vector<float> edges = j.at("outgoingEdges");
  • 220 // load edges
    221 std::vector<float> edges = j.at("outgoingEdges");
    222
    223 for (const auto edge_id : edges)
    224 {
    225 armarx::navigation::core::arondto::Edge e;
    226 e.sourceVertexID = id;
    227 e.targetVertexID = edge_id;
    228 g.edges.push_back(e);
    229 }
    230 }
    231 }
    232
    233 auto& up = c.add();
    234 up.confidence = 1.0;
    235 up.timeCreated = armem::Time::now();
  • Fabian Tërnava added 32 commits

    added 32 commits

    Compare with previous version

  • added 1 commit

    • b56ad5d6 - added checks whether the key in the json exists

    Compare with previous version

  • Fabian Tërnava mentioned in commit 7ce367da

    mentioned in commit 7ce367da

  • Please register or sign in to reply
    Loading