Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions voxblox_ros/src/esdf_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,21 @@ void EsdfServer::publishMap(bool reset_remote_map) {
}
const bool only_updated = !reset_remote_map;
timing::Timer publish_map_timer("map/publish_esdf");
auto layer = this->esdf_map_->getEsdfLayerPtr();
voxblox_msgs::Layer layer_msg;
serializeLayerAsMsg<EsdfVoxel>(this->esdf_map_->getEsdfLayer(),
only_updated, &layer_msg);
serializeLayerAsMsg<EsdfVoxel>(*layer, only_updated, &layer_msg);
if (reset_remote_map) {
layer_msg.action = static_cast<uint8_t>(MapDerializationAction::kReset);
}
this->esdf_map_pub_.publish(layer_msg);
publish_map_timer.Stop();

// Clear the updated flag if we have published the map
BlockIndexList block_list;
layer->getAllUpdatedBlocks(Update::kMap, &block_list);
for (const BlockIndex& index : block_list) {
layer->getBlockPtrByIndex(index)->updated().reset(Update::kMap);
}
}
num_subscribers_esdf_map_ = subscribers;
TsdfServer::publishMap();
Expand Down
11 changes: 9 additions & 2 deletions voxblox_ros/src/tsdf_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,21 @@ void TsdfServer::publishMap(bool reset_remote_map) {
}
const bool only_updated = !reset_remote_map;
timing::Timer publish_map_timer("map/publish_tsdf");
auto layer = this->tsdf_map_->getTsdfLayerPtr();
voxblox_msgs::Layer layer_msg;
serializeLayerAsMsg<TsdfVoxel>(this->tsdf_map_->getTsdfLayer(),
only_updated, &layer_msg);
serializeLayerAsMsg<TsdfVoxel>(*layer, only_updated, &layer_msg);
if (reset_remote_map) {
layer_msg.action = static_cast<uint8_t>(MapDerializationAction::kReset);
}
this->tsdf_map_pub_.publish(layer_msg);
publish_map_timer.Stop();

// Clear the updated flag if we have published the map
BlockIndexList block_list;
layer->getAllUpdatedBlocks(Update::kMap, &block_list);
for (const BlockIndex& index : block_list) {
layer->getBlockPtrByIndex(index)->updated().reset(Update::kMap);
}
}
num_subscribers_tsdf_map_ = subscribers;
}
Expand Down