MCPcopy Create free account
hub / github.com/MIT-SPARK/Clio / updateActiveParents

Method updateActiveParents

clio/src/object_update_functor.cpp:340–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340void ObjectUpdateFunctor::updateActiveParents(DynamicSceneGraph& graph) const {
341 std::vector<NodeId> place_ids;
342 const auto& places = graph.getLayer(DsgLayers::PLACES);
343 for (const auto& id_node_pair : graph.getLayer(DsgLayers::PLACES).nodes()) {
344 place_ids.push_back(id_node_pair.first);
345 }
346
347 // TODO(nathan) drop this once edges start behaving
348 for (const auto& id_node_pair : graph.getLayer(DsgLayers::OBJECTS).nodes()) {
349 active_.insert(id_node_pair.first);
350 }
351
352 hydra::NearestNodeFinder places_finder(places, place_ids);
353 auto iter = active_.begin();
354 while (iter != active_.end()) {
355 const auto& node = graph.getNode(*iter);
356 const auto parent_id = node.getParent();
357 if (parent_id) {
358 const bool is_active = places.getNode(*parent_id).attributes().is_active;
359 if (is_active) {
360 ++iter;
361 } else {
362 iter = active_.erase(iter);
363 }
364
365 continue;
366 }
367
368 bool found = false;
369 places_finder.find(node.attributes().position,
370 1,
371 false,
372 [&](NodeId place_id, size_t, double distance) {
373 if (config.neighbor_max_distance > 0.0 &&
374 distance >= config.neighbor_max_distance) {
375 LOG(WARNING)
376 << "Discarding nearest neighbor '"
377 << NodeSymbol(place_id).getLabel() << "' for node '"
378 << NodeSymbol(node.id).getLabel() << "' with distance "
379 << distance << " >= " << config.neighbor_max_distance;
380 }
381
382 graph.insertEdge(place_id, node.id);
383 found = true;
384 });
385 if (found) {
386 iter = active_.erase(iter);
387 } else {
388 ++iter;
389 }
390 }
391}
392
393} // namespace clio

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected