Skip to content

Commit f1b13f9

Browse files
someonechhtSteveMacenski
authored andcommitted
If guard around _publish_voxels (#317) (#318)
* If guard around _publish_voxels (#317) * removed redundant _voxel_pub check
1 parent 612be94 commit f1b13f9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spatio_temporal_voxel_layer/src/spatio_temporal_voxel_layer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,11 @@ void SpatioTemporalVoxelLayer::onInitialize(void)
146146
auto pub_opt = rclcpp::PublisherOptions();
147147
pub_opt.callback_group = callback_group_;
148148

149-
_voxel_pub = node->create_publisher<sensor_msgs::msg::PointCloud2>(
150-
"voxel_grid", rclcpp::QoS(1), pub_opt);
149+
if(_publish_voxels)
150+
{
151+
_voxel_pub = node->create_publisher<sensor_msgs::msg::PointCloud2>(
152+
"voxel_grid", rclcpp::QoS(1), pub_opt);
153+
}
151154

152155
auto save_grid_callback = std::bind(
153156
&SpatioTemporalVoxelLayer::SaveGridCallback, this, _1, _2, _3);

0 commit comments

Comments
 (0)