Skip to content

Commit ac9620a

Browse files
style(pre-commit): autofix
1 parent a5ef9bb commit ac9620a

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

perception/autoware_euclidean_cluster/include/autoware/euclidean_cluster/voxel_grid_based_euclidean_cluster.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#pragma once
1616
#include "autoware/euclidean_cluster/euclidean_cluster_interface.hpp"
1717
#include "autoware/euclidean_cluster/utils.hpp"
18+
1819
#include <autoware_utils/ros/diagnostics_interface.hpp>
1920
#include <rclcpp/node.hpp>
2021

@@ -45,10 +46,11 @@ class VoxelGridBasedEuclideanCluster : public EuclideanClusterInterface
4546
{
4647
min_points_number_per_voxel_ = min_points_number_per_voxel;
4748
}
48-
void setDiagnosticsInterface(autoware_utils::DiagnosticsInterface* diag_ptr)
49+
void setDiagnosticsInterface(autoware_utils::DiagnosticsInterface * diag_ptr)
4950
{
5051
diagnostics_interface_ptr_ = diag_ptr;
5152
}
53+
5254
private:
5355
pcl::VoxelGrid<pcl::PointXYZ> voxel_grid_;
5456
float tolerance_;
@@ -58,7 +60,7 @@ class VoxelGridBasedEuclideanCluster : public EuclideanClusterInterface
5860
void publishDiagnosticsSummary(
5961
const std::vector<std::string> & warnings,
6062
const sensor_msgs::msg::PointCloud2::ConstSharedPtr & pointcloud_msg);
61-
autoware_utils::DiagnosticsInterface* diagnostics_interface_ptr_{nullptr};
63+
autoware_utils::DiagnosticsInterface * diagnostics_interface_ptr_{nullptr};
6264
};
6365

6466
} // namespace autoware::euclidean_cluster

perception/autoware_euclidean_cluster/lib/voxel_grid_based_euclidean_cluster.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#include "autoware/euclidean_cluster/voxel_grid_based_euclidean_cluster.hpp"
16+
1617
#include <rclcpp/node.hpp>
1718

1819
#include <pcl/kdtree/kdtree.h>
@@ -55,8 +56,9 @@ void VoxelGridBasedEuclideanCluster::publishDiagnosticsSummary(
5556

5657
std::stringstream summary;
5758
if (!warnings.empty()) {
58-
summary << warnings.size() << " clusters skipped because cluster size exceeds the maximum allowed "
59-
<< max_cluster_size_ << " \n";
59+
summary << warnings.size()
60+
<< " clusters skipped because cluster size exceeds the maximum allowed "
61+
<< max_cluster_size_ << " \n";
6062
for (const auto & warn : warnings) {
6163
summary << " - " << warn << "\n";
6264
}
@@ -65,12 +67,12 @@ void VoxelGridBasedEuclideanCluster::publishDiagnosticsSummary(
6567
diagnostics_interface_ptr_->add_key_value("is_cluster_data_size_within_range", true);
6668
}
6769
diagnostics_interface_ptr_->update_level_and_message(
68-
warnings.empty() ? static_cast<int8_t>(diagnostic_msgs::msg::DiagnosticStatus::OK) : static_cast<int8_t>(diagnostic_msgs::msg::DiagnosticStatus::WARN),
70+
warnings.empty() ? static_cast<int8_t>(diagnostic_msgs::msg::DiagnosticStatus::OK)
71+
: static_cast<int8_t>(diagnostic_msgs::msg::DiagnosticStatus::WARN),
6972
summary.str());
7073
diagnostics_interface_ptr_->publish(pointcloud_msg->header.stamp);
7174
}
7275

73-
7476
// TODO(badai-nguyen): remove this function when field copying also implemented for
7577
// euclidean_cluster.cpp
7678
bool VoxelGridBasedEuclideanCluster::cluster(
@@ -167,17 +169,18 @@ bool VoxelGridBasedEuclideanCluster::cluster(
167169
// build output and check cluster size
168170
{
169171
// At the start, create a container to collect warnings.
170-
std::vector<std::string> warning_messages;
172+
std::vector<std::string> warning_messages;
171173
for (size_t i = 0; i < temporary_clusters.size(); ++i) {
172174
auto & i_cluster_data_size = clusters_data_size.at(i);
173175
int cluster_size = static_cast<int>(i_cluster_data_size / point_step);
174176
if (cluster_size < min_cluster_size_) {
175177
// Cluster size is below the minimum threshold; skip without messaging.
176178
continue;
177179
}
178-
if (cluster_size > max_cluster_size_ ) {
180+
if (cluster_size > max_cluster_size_) {
179181
// Cluster size exceeds the maximum threshold; log a warning.
180-
warning_messages.push_back(" Cluster " + std::to_string(i) + " (" + std::to_string(cluster_size) + ").");
182+
warning_messages.push_back(
183+
" Cluster " + std::to_string(i) + " (" + std::to_string(cluster_size) + ").");
181184
continue;
182185
}
183186
const auto & cluster = temporary_clusters.at(i);
@@ -203,8 +206,7 @@ bool VoxelGridBasedEuclideanCluster::cluster(
203206
}
204207
objects.header = pointcloud_msg->header;
205208

206-
publishDiagnosticsSummary(warning_messages, pointcloud_msg);
207-
209+
publishDiagnosticsSummary(warning_messages, pointcloud_msg);
208210
}
209211

210212
return true;

perception/autoware_euclidean_cluster/src/voxel_grid_based_euclidean_cluster_node.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ VoxelGridBasedEuclideanClusterNode::VoxelGridBasedEuclideanClusterNode(
3636
use_height, min_cluster_size, max_cluster_size, tolerance, voxel_leaf_size,
3737
min_points_number_per_voxel);
3838
// Pass the diagnostics interface pointer from the node to the cluster
39-
diagnostics_interface_ptr_ = std::make_unique<autoware_utils::DiagnosticsInterface>(this, "euclidean_cluster");
39+
diagnostics_interface_ptr_ =
40+
std::make_unique<autoware_utils::DiagnosticsInterface>(this, "euclidean_cluster");
4041
cluster_->setDiagnosticsInterface(diagnostics_interface_ptr_.get());
41-
42+
4243
using std::placeholders::_1;
4344
pointcloud_sub_ = this->create_subscription<sensor_msgs::msg::PointCloud2>(
4445
"input", rclcpp::SensorDataQoS().keep_last(1),
@@ -52,8 +53,6 @@ VoxelGridBasedEuclideanClusterNode::VoxelGridBasedEuclideanClusterNode(
5253
std::make_unique<autoware_utils::DebugPublisher>(this, "voxel_grid_based_euclidean_cluster");
5354
stop_watch_ptr_->tic("cyclic_time");
5455
stop_watch_ptr_->tic("processing_time");
55-
56-
5756
}
5857

5958
void VoxelGridBasedEuclideanClusterNode::onPointCloud(

perception/autoware_euclidean_cluster/src/voxel_grid_based_euclidean_cluster_node.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#include "autoware/euclidean_cluster/voxel_grid_based_euclidean_cluster.hpp"
1818

1919
#include <autoware_utils/ros/debug_publisher.hpp>
20-
#include <autoware_utils/system/stop_watch.hpp>
2120
#include <autoware_utils/ros/diagnostics_interface.hpp>
21+
#include <autoware_utils/system/stop_watch.hpp>
2222

2323
#include <geometry_msgs/msg/pose_stamped.hpp>
2424
#include <sensor_msgs/msg/point_cloud2.hpp>
@@ -45,7 +45,6 @@ class VoxelGridBasedEuclideanClusterNode : public rclcpp::Node
4545
std::unique_ptr<autoware_utils::DebugPublisher> debug_publisher_;
4646

4747
std::unique_ptr<autoware_utils::DiagnosticsInterface> diagnostics_interface_ptr_;
48-
4948
};
5049

5150
} // namespace autoware::euclidean_cluster

0 commit comments

Comments
 (0)