Skip to content

Commit

Permalink
fix version warning and add new variant of addOrUpdateNode
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanhhughes committed Dec 5, 2024
1 parent 6e47e78 commit f493d1e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
14 changes: 14 additions & 0 deletions include/spark_dsg/dynamic_scene_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,20 @@ class DynamicSceneGraph {
NodeId node_id,
std::unique_ptr<NodeAttributes>&& attrs);

/**
* @brief add a node to the graph or update an existing node
*
* @param layer layer to add to
* @param node_id node to add
* @param attrs attributes to add
* @param partition to add to
* @return true if the node was added or updated successfully
*/
bool addOrUpdateNode(const std::string& layer,
NodeId node_id,
std::unique_ptr<NodeAttributes>&& attrs,
PartitionId partition = 0);

/**
* @brief add a node to the graph or update an existing node
*
Expand Down
12 changes: 12 additions & 0 deletions src/dynamic_scene_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,18 @@ bool DynamicSceneGraph::emplaceNode(const std::string& layer,
return emplaceNode(iter->second, node_id, std::move(attrs), partition);
}

bool DynamicSceneGraph::addOrUpdateNode(const std::string& layer,
NodeId node_id,
std::unique_ptr<NodeAttributes>&& attrs,
PartitionId partition) {
auto iter = layer_names_.find(layer);
if (iter == layer_names_.end()) {
return false;
}

return addOrUpdateNode(iter->second, node_id, std::move(attrs), partition);
}

bool DynamicSceneGraph::addOrUpdateNode(LayerId layer_id,
NodeId node_id,
std::unique_ptr<NodeAttributes>&& attrs,
Expand Down
3 changes: 2 additions & 1 deletion src/node_attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,9 @@ void AgentNodeAttributes::serialization_info() {

const auto& header = io::GlobalInfo::loadedHeader();
if (header.version >= io::Version(1, 1, 0)) {
io::warnOutdatedHeader(header);
serialization::field("timestamp", timestamp);
} else {
io::warnOutdatedHeader(header);
}

serialization::field("world_R_body", world_R_body);
Expand Down

0 comments on commit f493d1e

Please sign in to comment.