Skip to content

Commit

Permalink
fix: resolve cppcheck issue shadowVariable
Browse files Browse the repository at this point in the history
Signed-off-by: Taekjin LEE <[email protected]>
  • Loading branch information
technolojin committed Dec 26, 2024
1 parent f5a5a56 commit e4e666d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class FusionNode : public rclcpp::Node
// 2d detection management methods
bool checkAllDet2dFused()

Check warning on line 109 in perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp#L109

Added line #L109 was not covered by tests
{
std::lock_guard<std::mutex> lock(mutex_det2d_flags_);
std::lock_guard<std::mutex> lock_det2d_flags(mutex_det2d_flags_);

Check warning on line 111 in perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp#L111

Added line #L111 was not covered by tests
for (const auto & det2d : det2d_list_) {
if (!det2d.is_fused) {
return false;
Expand All @@ -118,12 +118,12 @@ class FusionNode : public rclcpp::Node
}
void setDet2dFused(Det2dManager<Msg2D> & det2d)

Check warning on line 119 in perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp#L119

Added line #L119 was not covered by tests
{
std::lock_guard<std::mutex> lock(mutex_det2d_flags_);
std::lock_guard<std::mutex> lock_det2d_flags(mutex_det2d_flags_);
det2d.is_fused = true;
}
void clearAllDet2dFlags()

Check warning on line 124 in perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp#L122-L124

Added lines #L122 - L124 were not covered by tests
{
std::lock_guard<std::mutex> lock(mutex_det2d_flags_);
std::lock_guard<std::mutex> lock_det2d_flags(mutex_det2d_flags_);

Check warning on line 126 in perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp#L126

Added line #L126 was not covered by tests
for (auto & det2d : det2d_list_) {
det2d.is_fused = false;

Check warning on line 128 in perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/include/autoware/image_projection_based_fusion/fusion_node.hpp#L128

Added line #L128 was not covered by tests
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ void FusionNode<Msg3D, Msg2D, ExportObj>::subCallback(
// PROCESS: if the main message is remained (and roi is not collected all) publish the main
// message may processed partially with arrived 2d rois
stop_watch_ptr_->toc("processing_time", true);
std::lock_guard<std::mutex> lock(mutex_det3d_msg_);
std::lock_guard<std::mutex> lock_det3d(mutex_det3d_msg_);
exportProcess();

// reset flags
Expand Down Expand Up @@ -293,7 +293,7 @@ void FusionNode<Msg3D, Msg2D, ExportObj>::subCallback(
// for loop for each roi
for (auto & det2d : det2d_list_) {
const auto roi_i = det2d.id;
std::lock_guard<std::mutex> lock(*(det2d.mtx_ptr));
std::lock_guard<std::mutex> lock_det2d(*(det2d.mtx_ptr));

// check camera info
if (det2d.camera_projector_ptr == nullptr) {
Expand Down Expand Up @@ -350,7 +350,7 @@ void FusionNode<Msg3D, Msg2D, ExportObj>::subCallback(
}

// PROCESS: check if the fused message is ready to publish
std::lock_guard<std::mutex> lock(mutex_det3d_msg_);
std::lock_guard<std::mutex> lock_det3d(mutex_det3d_msg_);
cached_det3d_msg_timestamp_ = timestamp_nsec;

Check warning on line 354 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/src/fusion_node.cpp#L354

Added line #L354 was not covered by tests
cached_det3d_msg_ptr_ = output_msg;
if (checkAllDet2dFused()) {
Expand All @@ -376,13 +376,13 @@ void FusionNode<Msg3D, Msg2D, ExportObj>::roiCallback(
stop_watch_ptr_->toc("processing_time", true);

auto & det2d = det2d_list_.at(roi_i);
std::lock_guard<std::mutex> lock(*(det2d.mtx_ptr));
std::lock_guard<std::mutex> lock_det2d(*(det2d.mtx_ptr));

int64_t timestamp_nsec =

Check warning on line 381 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/src/fusion_node.cpp#L381

Added line #L381 was not covered by tests
(*det2d_msg).header.stamp.sec * static_cast<int64_t>(1e9) + (*det2d_msg).header.stamp.nanosec;
// if cached Msg exist, try to match
if (cached_det3d_msg_ptr_ != nullptr) {
std::lock_guard<std::mutex> lock(mutex_det3d_msg_);
std::lock_guard<std::mutex> lock_det3d(mutex_det3d_msg_);

int64_t new_stamp =
cached_det3d_msg_timestamp_ + det2d.input_offset_ms * static_cast<int64_t>(1e6);

Check warning on line 388 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_image_projection_based_fusion/src/fusion_node.cpp#L387-L388

Added lines #L387 - L388 were not covered by tests
Expand Down

0 comments on commit e4e666d

Please sign in to comment.