Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(yabloc_particle_filter): apply static analysis #7519

Conversation

a-maumau
Copy link
Contributor

@a-maumau a-maumau commented Jun 17, 2024

Description

This PR applies some suggestions from the linter to localization/yabloc/yabloc_particle_filter.
Checked with clang-tidy and cppcheck.

Fixed:

  • use explicit cast
  • change variable names
    • camelCase to snake_case for method/variable
    • snake_case to CamelCase for class name
    • add _ to private variable
    • align variable name in header's definition and the implementation
    • LOCAL_VAR to local_var
    • rename some variables to avoid shadowed declaration
  • add or removed keyword from function/method which linter suggested
  • use std::accumulate instead of a raw loop
  • remove unused methods/functions and files

not Fixed:

Tests performed

Checked with clang-tidy and cppcheck (v2.14.1)

check_linter.sh
#!/bin/bash
set -eux

TARGET_DIR=$1

current_dir=$(basename $(pwd))
if [[ ! $current_dir =~ ^(autoware|pilot-auto) ]]; then
    echo "This script must be run in a directory with a prefix of autoware or pilot-auto."
    exit 1
fi

set +eux
export CPLUS_INCLUDE_PATH=/usr/include/c++/11:/usr/include/x86_64-linux-gnu/c++/11:$CPLUS_INCLUDE_PATH
set -eux

fdfind -e cpp -e hpp --full-path ${TARGET_DIR} | xargs -P $(nproc) -I{} cpplint {}
fdfind -e cpp -e hpp --full-path ${TARGET_DIR} | xargs -P $(nproc) -I{} clang-tidy -p build/ {}

Before fixing the code:

Check with check_linter.sh
$ ./check_linter.sh yabloc_particle_filter
...
2016 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/prediction/resampling_history.hpp:38:3: warning: function 'check_history_validity' should be marked [[nodiscard]] [modernize-use-nodiscard]
  bool check_history_validity() const
  ^
  [[nodiscard]] 
Suppressed 2015 warnings (2015 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2387 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/logit.cpp:27:3: warning: constructor does not initialize these fields: table_ [cppcoreguidelines-pro-type-member-init]
  ProbToLogitTable()
  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/logit.cpp:30:17: warning: narrowing conversion from 'int' to 'float' [cppcoreguidelines-narrowing-conversions]
      float p = i / 100.0f;
                ^
Suppressed 2385 warnings (2385 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5487 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/prediction/resampler.hpp:25:7: warning: invalid case style for class 'resampling_skip_exception' [readability-identifier-naming]
class resampling_skip_exception : public std::runtime_error
      ^~~~~~~~~~~~~~~~~~~~~~~~~
      ResamplingSkipException
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/prediction/resampler.hpp:59:3: warning: function 'random_from_01_uniformly' should be marked [[nodiscard]] [modernize-use-nodiscard]
  double random_from_01_uniformly() const;
  ^
  [[nodiscard]] 
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/prediction/resampler.hpp:61:3: warning: function 'check_weighted_particles_validity' should be marked [[nodiscard]] [modernize-use-nodiscard]
  bool check_weighted_particles_validity(const ParticleArray & weighted_particles) const;
  ^
  [[nodiscard]] 
Suppressed 5484 warnings (5484 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7987 warnings generated.
Suppressed 7987 warnings (7987 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10483 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/mean.hpp:23:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
namespace yabloc
^~~~~~~~~~~~~~~~
namespace yabloc::modularized_particle_filter
Suppressed 10484 warnings (10482 in non-user code, 2 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
14026 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/prediction_util.hpp:25:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
namespace yabloc
^~~~~~~~~~~~~~~~
namespace yabloc::modularized_particle_filter::util
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/prediction_util.hpp:29:20: warning: variable 'seed_gen' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
std::random_device seed_gen;
                   ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/prediction_util.hpp:30:28: warning: variable 'engine' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
std::default_random_engine engine(seed_gen());
                           ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/prediction_util.hpp:32:17: warning: function 'nrand_2d' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
Eigen::Vector2d nrand_2d(const Eigen::Matrix2d cov)
                ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/prediction_util.hpp:32:17: note: make as 'inline'
Eigen::Vector2d nrand_2d(const Eigen::Matrix2d cov)
                ^
inline 
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/prediction_util.hpp:32:48: warning: the const qualified parameter 'cov' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
Eigen::Vector2d nrand_2d(const Eigen::Matrix2d cov)
                                               ^
                                              &
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/prediction_util.hpp:53:8: warning: function 'normalize_radian' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
double normalize_radian(const double rad, const double min_rad = -M_PI)
       ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/common/prediction_util.hpp:53:8: note: make as 'inline'
double normalize_radian(const double rad, const double min_rad = -M_PI)
       ^
inline 
Suppressed 14022 warnings (14020 in non-user code, 2 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8066 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:19:9: warning: function 'direct_cost_map' has cognitive complexity of 36 (threshold 25) [readability-function-cognitive-complexity]
cv::Mat direct_cost_map(const cv::Mat & cost_map, const cv::Mat & intensity)
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:25:3: note: +1, including nesting penalty of 0, nesting level increased to 1
  for (int i = 0; i < cost_map.rows; i++) {
  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:29:5: note: +2, including nesting penalty of 1, nesting level increased to 2
    for (int j = 0; j < cost_map.cols; j++) {
    ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:30:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      if (intensity_ptr[j] == 0) distances.at(i).at(j) = 0;
      ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:37:3: note: +1, including nesting penalty of 0, nesting level increased to 1
  for (int r = 1; r < cost_map.rows; r++) {
  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:41:5: note: +2, including nesting penalty of 1, nesting level increased to 2
    for (int c = 1; c < cost_map.cols; c++) {
    ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:44:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      if (up < left) {
      ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:45:9: note: +4, including nesting penalty of 3, nesting level increased to 4
        if (distances.at(r).at(c) < up + 1) continue;
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:48:9: note: +1, nesting level increased to 3
      } else {
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:49:9: note: +4, including nesting penalty of 3, nesting level increased to 4
        if (distances.at(r).at(c) < left + 1) continue;
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:57:3: note: +1, including nesting penalty of 0, nesting level increased to 1
  for (int r = cost_map.rows - 2; r >= 0; r--) {
  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:61:5: note: +2, including nesting penalty of 1, nesting level increased to 2
    for (int c = cost_map.cols - 2; c >= 0; c--) {
    ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:64:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      if (down < right) {
      ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:65:9: note: +4, including nesting penalty of 3, nesting level increased to 4
        if (distances.at(r).at(c) < down + 1) continue;
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:68:9: note: +1, nesting level increased to 3
      } else {
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:69:9: note: +4, including nesting penalty of 3, nesting level increased to 4
        if (distances.at(r).at(c) < right + 1) continue;
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:21:17: warning: invalid case style for constexpr variable 'MAX_INT' [readability-identifier-naming]
  constexpr int MAX_INT = std::numeric_limits<int>::max();
                ^~~~~~~
                max_int
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:28:11: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
    const uchar * intensity_ptr = intensity.ptr<uchar>(i);
          ^~~~~
          auto
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:30:11: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
      if (intensity_ptr[j] == 0) distances.at(i).at(j) = 0;
          ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:39:5: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
    uchar * current_ptr = dst.ptr<uchar>(r);
    ^~~~~
    auto
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:47:9: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = upper_ptr[c];
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:47:26: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = upper_ptr[c];
                         ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:51:9: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = current_ptr[c - 1];
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:51:26: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = current_ptr[c - 1];
                         ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:59:5: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
    uchar * current_ptr = dst.ptr<uchar>(r);
    ^~~~~
    auto
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:67:9: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = downer_ptr[c];
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:67:26: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = downer_ptr[c];
                         ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:71:9: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = current_ptr[c + 1];
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:71:26: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = current_ptr[c + 1];
                         ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:83:3: warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
  cv::Mat hsv, rgb;
  ^~~~~~~~~~~~~~~~~
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:88:11: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
    const uchar * src_ptr = cost_map.ptr<uchar>(r);
          ^~~~~
          auto
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:89:5: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
    cv::Vec3b * dst_ptr = rgb.ptr<cv::Vec3b>(r);
    ^~~~~~~~~
    auto
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:91:11: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
      if (src_ptr[c] == 0) dst_ptr[c] = cv::Vec3b(0, 0, 0);
          ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:91:28: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
      if (src_ptr[c] == 0) dst_ptr[c] = cv::Vec3b(0, 0, 0);
                           ^
Suppressed 8047 warnings (8047 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7658 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/test/src/test_resampler.cpp:25:15: warning: invalid case style for constexpr variable 'PARTICLE_COUNT' [readability-identifier-naming]
constexpr int PARTICLE_COUNT = 10;
              ^~~~~~~~~~~~~~
              particle_count
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/test/src/test_resampler.cpp:26:15: warning: invalid case style for constexpr variable 'HISTORY_SIZE' [readability-identifier-naming]
constexpr int HISTORY_SIZE = 10;
              ^~~~~~~~~~~~
              history_size
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/test/src/test_resampler.cpp:150:60: warning: narrowing conversion from 'geometry_msgs::msg::Point_::_x_type' (aka 'double') to 'int' [cppcoreguidelines-narrowing-conversions]
    for (const auto & p : predicted.particles) centroid += p.pose.position.x;
                                                           ^
Suppressed 7673 warnings (7655 in non-user code, 18 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13153 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:41:3: warning: constructor does not initialize these fields: for_fixed_, for_not_fixed_ [cppcoreguidelines-pro-type-member-init]
  explicit WeightManager(rclcpp::Node * node)
  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:43:31: warning: narrowing conversion from 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
    for_fixed_.flat_radius_ = node->declare_parameter<float>("for_fixed/flat_radius");
                              ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:44:30: warning: narrowing conversion from 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
    for_fixed_.max_radius_ = node->declare_parameter<float>("for_fixed/max_radius");
                             ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:45:30: warning: narrowing conversion from 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
    for_fixed_.min_weight_ = node->declare_parameter<float>("for_fixed/min_weight");
                             ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:46:30: warning: narrowing conversion from 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
    for_fixed_.max_weight_ = node->declare_parameter<float>("for_fixed/max_weight");
                             ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:49:35: warning: narrowing conversion from 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
    for_not_fixed_.flat_radius_ = node->declare_parameter<float>("for_not_fixed/flat_radius");
                                  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:50:34: warning: narrowing conversion from 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
    for_not_fixed_.max_radius_ = node->declare_parameter<float>("for_not_fixed/max_radius");
                                 ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:51:34: warning: narrowing conversion from 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
    for_not_fixed_.min_weight_ = node->declare_parameter<float>("for_not_fixed/min_weight");
                                 ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:52:34: warning: narrowing conversion from 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
    for_not_fixed_.max_weight_ = node->declare_parameter<float>("for_not_fixed/max_weight");
                                 ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:56:3: warning: function 'normal_pdf' should be marked [[nodiscard]] [modernize-use-nodiscard]
  float normal_pdf(float distance, const Parameter & param) const
  ^
  [[nodiscard]] 
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:56:9: warning: method 'normal_pdf' can be made static [readability-convert-member-functions-to-static]
  float normal_pdf(float distance, const Parameter & param) const
        ^                                                   ~~~~~
  static 
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/include/yabloc_particle_filter/gnss_corrector/weight_manager.hpp:63:3: warning: function 'normal_pdf' should be marked [[nodiscard]] [modernize-use-nodiscard]
  float normal_pdf(float distance, bool is_rtk_fixed) const
  ^
  ... (omitted)
Check with cppcheck
(in localization/yabloc)
$ cppcheck --enable=warning --enable=style --enable=performance --enable=portability --enable=unusedFunction --inconclusive --check-level=exhaustive .

Checking yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp ...
yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:310:13: style: The scope of the variable 'gain' can be reduced. [variableScope]
      float gain = std::exp(-far_weight_gain_ * squared_norm);
            ^
yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:190:10: style: Local variable 'mean_pose' shadows outer variable [shadowVariable]
    Pose mean_pose = get_mean_pose(weighted_particles);
         ^
yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:150:14: note: Shadowed declaration
  const Pose mean_pose = get_mean_pose(weighted_particles);
             ^
yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:190:10: note: Shadow variable
    Pose mean_pose = get_mean_pose(weighted_particles);
         ^
yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:114:47: style: Parameter 'cloud' can be declared as reference to const [constParameterReference]
    auto draw = [&debug_image](LineSegments & cloud, cv::Scalar color) -> void {
                                              ^
yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:204:17: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
      max_score = std::max(max_score, std::abs(p.intensity));
                ^
22/41 files checked 52% done
Checking yabloc_particle_filter/src/camera_corrector/filter_line_segments.cpp ...
23/41 files checked 53% done
Checking yabloc_particle_filter/src/camera_corrector/logit.cpp ...
24/41 files checked 54% done
Checking yabloc_particle_filter/src/common/mean.cpp ...
yabloc_particle_filter/src/common/mean.cpp:123:10: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
    mean += p.weight;
         ^
yabloc_particle_filter/src/common/mean.cpp:129:11: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
    sigma += (p.weight - mean) * (p.weight - mean);
          ^
25/41 files checked 57% done
Checking yabloc_particle_filter/src/common/particle_visualize_node.cpp ...
26/41 files checked 59% done
Checking yabloc_particle_filter/src/common/visualize.cpp ...
27/41 files checked 60% done
Checking yabloc_particle_filter/src/correction/abstract_corrector.cpp ...
28/41 files checked 61% done
Checking yabloc_particle_filter/src/correction/correction_util.cpp ...
29/41 files checked 62% done
Checking yabloc_particle_filter/src/gnss_corrector/gnss_corrector_core.cpp ...
yabloc_particle_filter/src/gnss_corrector/gnss_corrector_core.cpp:99:21: style: Local variable 'mean_position' shadows outer variable [shadowVariable]
    Eigen::Vector3f mean_position = common::pose_to_affine(mean_pose).translation();
                    ^
yabloc_particle_filter/src/gnss_corrector/gnss_corrector_core.cpp:86:25: note: Shadowed declaration
  const Eigen::Vector3f mean_position = common::pose_to_affine(mean_pose).translation();
                        ^
yabloc_particle_filter/src/gnss_corrector/gnss_corrector_core.cpp:99:21: note: Shadow variable
    Eigen::Vector3f mean_position = common::pose_to_affine(mean_pose).translation();
                    ^
30/41 files checked 66% done
Checking yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp ...
31/41 files checked 68% done
Checking yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp ...
yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp:205:12: style: Local variable 'w' shadows outer variable [shadowVariable]
  for (int w = 0; w < image_size_; w++) {
           ^
yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp:193:9: note: Shadowed declaration
  float w = pose.orientation.w;
        ^
yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp:205:12: note: Shadow variable
  for (int w = 0; w < image_size_; w++) {
           ^
32/41 files checked 72% done
Checking yabloc_particle_filter/src/prediction/predictor.cpp ...
33/41 files checked 81% done
Checking yabloc_particle_filter/src/prediction/resampler.cpp ...
34/41 files checked 84% done
Checking yabloc_particle_filter/test/src/test_resampler.cpp ...
yabloc_particle_filter/test/src/test_resampler.cpp:150:57: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
    for (const auto & p : predicted.particles) centroid += p.pose.position.x;
                                                        ^
yabloc_particle_filter/test/src/test_resampler.cpp:184:23: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
      before_centroid += p.pose.position.x * p.weight;
                      ^
yabloc_particle_filter/test/src/test_resampler.cpp:204:22: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
      after_centroid += p.pose.position.x * p.weight;
                     ^
...
yabloc_particle_filter/src/camera_corrector/logit.cpp:50:0: style: The function 'prob_to_logit' is never used. [unusedFunction]
float prob_to_logit(float prob)
^
yabloc_particle_filter/src/common/mean.cpp:116:0: style: The function 'std_of_weight' is never used. [unusedFunction]
float std_of_weight(const yabloc_particle_filter::msg::ParticleArray & particle_array)
^
yabloc_particle_filter/src/common/particle_visualize_node.cpp:49:0: style: The function 'compute_color' is never used. [unusedFunction]
  std_msgs::msg::ColorRGBA compute_color(float value) const
^
yabloc_particle_filter/src/correction/correction_util.cpp:19:0: style: The function 'find_synced_particles' is never used. [unusedFunction]
std::optional<yabloc_particle_filter::msg::ParticleArray> find_synced_particles(
^
yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:79:0: style: The function 'visualize_direction_map' is never used. [unusedFunction]
cv::Mat visualize_direction_map(const cv::Mat & cost_map)

After this PR:

Check with check_linter.sh
$ ./check_linter.sh yabloc_particle_filter
...
2015 warnings generated.
Suppressed 2015 warnings (2015 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2385 warnings generated.
Suppressed 2385 warnings (2385 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5483 warnings generated.
Suppressed 5483 warnings (5483 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7987 warnings generated.
Suppressed 7987 warnings (7987 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10482 warnings generated.
Suppressed 10484 warnings (10482 in non-user code, 2 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8059 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:19:9: warning: function 'direct_cost_map' has cognitive complexity of 36 (threshold 25) [readability-function-cognitive-complexity]
cv::Mat direct_cost_map(const cv::Mat & cost_map, const cv::Mat & intensity)
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:25:3: note: +1, including nesting penalty of 0, nesting level increased to 1
  for (int i = 0; i < cost_map.rows; i++) {
  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:29:5: note: +2, including nesting penalty of 1, nesting level increased to 2
    for (int j = 0; j < cost_map.cols; j++) {
    ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:30:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      if (intensity_ptr[j] == 0) distances.at(i).at(j) = 0;
      ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:37:3: note: +1, including nesting penalty of 0, nesting level increased to 1
  for (int r = 1; r < cost_map.rows; r++) {
  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:41:5: note: +2, including nesting penalty of 1, nesting level increased to 2
    for (int c = 1; c < cost_map.cols; c++) {
    ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:44:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      if (up < left) {
      ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:45:9: note: +4, including nesting penalty of 3, nesting level increased to 4
        if (distances.at(r).at(c) < up + 1) continue;
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:48:9: note: +1, nesting level increased to 3
      } else {
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:49:9: note: +4, including nesting penalty of 3, nesting level increased to 4
        if (distances.at(r).at(c) < left + 1) continue;
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:57:3: note: +1, including nesting penalty of 0, nesting level increased to 1
  for (int r = cost_map.rows - 2; r >= 0; r--) {
  ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:61:5: note: +2, including nesting penalty of 1, nesting level increased to 2
    for (int c = cost_map.cols - 2; c >= 0; c--) {
    ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:64:7: note: +3, including nesting penalty of 2, nesting level increased to 3
      if (down < right) {
      ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:65:9: note: +4, including nesting penalty of 3, nesting level increased to 4
        if (distances.at(r).at(c) < down + 1) continue;
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:68:9: note: +1, nesting level increased to 3
      } else {
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:69:9: note: +4, including nesting penalty of 3, nesting level increased to 4
        if (distances.at(r).at(c) < right + 1) continue;
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:30:11: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
      if (intensity_ptr[j] == 0) distances.at(i).at(j) = 0;
          ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:47:9: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = upper_ptr[c];
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:47:26: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = upper_ptr[c];
                         ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:51:9: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = current_ptr[c - 1];
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:51:26: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = current_ptr[c - 1];
                         ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:67:9: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = downer_ptr[c];
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:67:26: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = downer_ptr[c];
                         ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:71:9: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = current_ptr[c + 1];
        ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:71:26: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
        current_ptr[c] = current_ptr[c + 1];
                         ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:92:11: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
      if (src_ptr[c] == 0) dst_ptr[c] = cv::Vec3b(0, 0, 0);
          ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp:92:28: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
      if (src_ptr[c] == 0) dst_ptr[c] = cv::Vec3b(0, 0, 0);
                           ^
Suppressed 8047 warnings (8047 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
14020 warnings generated.
Suppressed 14022 warnings (14020 in non-user code, 2 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7651 warnings generated.
Suppressed 7669 warnings (7651 in non-user code, 18 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13136 warnings generated.
Suppressed 13147 warnings (13136 in non-user code, 11 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13404 warnings generated.
Suppressed 13415 warnings (13404 in non-user code, 11 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17201 warnings generated.
Suppressed 17212 warnings (17201 in non-user code, 11 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
17237 warnings generated.
Suppressed 17248 warnings (17237 in non-user code, 11 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
35558 warnings generated.
Suppressed 35571 warnings (35558 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
18310 warnings generated.
Suppressed 18323 warnings (18310 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16612 warnings generated.
18804 warnings generated.
Suppressed 18817 warnings (18804 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
20951 warnings generated.
Suppressed 20964 warnings (20951 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
21497 warnings generated.
Suppressed 21508 warnings (21497 in non-user code, 11 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
19212 warnings generated.
Suppressed 19223 warnings (19212 in non-user code, 11 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
24576 warnings generated.
21011 warnings generated.
Suppressed 21024 warnings (21011 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
39274 warnings generated.
Suppressed 39287 warnings (39274 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
42446 warnings generated.
Suppressed 42459 warnings (42446 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
33224 warnings generated.
Suppressed 33246 warnings (33224 in non-user code, 22 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
57356 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp:61:37: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
  cv::Vec3b b3 = cost_maps_.at(key).ptr<cv::Vec3b>(tmp.y)[tmp.x];
                                    ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp:91:38: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
    poly.outer().push_back(BgPoint(p.x, p.y));
                                     ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp:91:43: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
    poly.outer().push_back(BgPoint(p.x, p.y));
                                          ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp:118:23: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      if (std::abs(pn.z - *height_) > 4) continue;
                      ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp:119:23: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      if (std::abs(pn.normal_z - *height_) > 4) continue;
                      ^
Suppressed 57364 warnings (57351 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
49152 warnings generated.
Suppressed 49178 warnings (49152 in non-user code, 26 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
52236 warnings generated.
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:106:13: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      if (p.label == 0)
            ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:205:82: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      [](float max_score, const auto& p) { return std::max(max_score, std::abs(p.intensity)); }
                                                                                 ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:210:11: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      rgb.rgba = common::color_scale::blue_red(p.intensity / max_score);
          ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:210:50: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      rgb.rgba = common::color_scale::blue_red(p.intensity / max_score);
                                                 ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:216:11: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      rgb.rgba = common::color_scale::blue_red(p.intensity / max_score);
          ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:216:50: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      rgb.rgba = common::color_scale::blue_red(p.intensity / max_score);
                                                 ^
/home/masakibaba/autoware/src/universe/autoware.universe/localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp:288:14: warning: do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
      if (pn.label == 0) {  // posteriori
             ^
Suppressed 52242 warnings (52229 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
60287 warnings generated.
Suppressed 60300 warnings (60287 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
40327 warnings generated.
Suppressed 40340 warnings (40327 in non-user code, 13 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Check with cppcheck
(in localization/yabloc)
$ cppcheck --enable=warning --enable=style --enable=performance --enable=portability --enable=unusedFunction --inconclusive --check-level=exhaustive .

...
Checking yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp ...
22/41 files checked 51% done
Checking yabloc_particle_filter/src/camera_corrector/filter_line_segments.cpp ...
23/41 files checked 53% done
Checking yabloc_particle_filter/src/camera_corrector/logit.cpp ...
24/41 files checked 54% done
Checking yabloc_particle_filter/src/common/mean.cpp ...
25/41 files checked 56% done
Checking yabloc_particle_filter/src/common/particle_visualize_node.cpp ...
26/41 files checked 58% done
Checking yabloc_particle_filter/src/common/visualize.cpp ...
27/41 files checked 60% done
Checking yabloc_particle_filter/src/correction/abstract_corrector.cpp ...
28/41 files checked 61% done
Checking yabloc_particle_filter/src/correction/correction_util.cpp ...
29/41 files checked 62% done
Checking yabloc_particle_filter/src/gnss_corrector/gnss_corrector_core.cpp ...
30/41 files checked 65% done
Checking yabloc_particle_filter/src/ll2_cost_map/direct_cost_map.cpp ...
31/41 files checked 68% done
Checking yabloc_particle_filter/src/ll2_cost_map/hierarchical_cost_map.cpp ...
32/41 files checked 72% done
Checking yabloc_particle_filter/src/prediction/predictor.cpp ...
33/41 files checked 81% done
Checking yabloc_particle_filter/src/prediction/resampler.cpp ...
34/41 files checked 84% done
Checking yabloc_particle_filter/test/src/test_resampler.cpp ...
35/41 files checked 88% done
...

Effects on system behavior

Not applicable.

Interface changes

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

@github-actions github-actions bot added the component:localization Vehicle's position determination in its environment. (auto-assigned) label Jun 17, 2024
@KYabuuchi KYabuuchi added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jun 17, 2024
Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>
@a-maumau a-maumau force-pushed the mau/refactor/localization/yabloc_particle_filter branch from 1a210ff to bb74bf4 Compare June 17, 2024 10:02
@a-maumau a-maumau marked this pull request as draft June 17, 2024 10:04
pre-commit-ci bot and others added 2 commits June 17, 2024 10:06
Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>
@a-maumau a-maumau marked this pull request as ready for review June 18, 2024 01:04
@a-maumau
Copy link
Contributor Author

a-maumau commented Jun 18, 2024

I removed the unused methods/functions and files also.

@KYabuuchi
Copy link
Contributor

Thanks for the comprehensive fix! 🙏 I will review it soon.

a-maumau and others added 2 commits June 18, 2024 15:12
…r/camera_particle_corrector_core.cpp

change to use get_mean_pose directly

Co-authored-by: Kento Yabuuchi <moc.liamg.8y8@gmail.com>
Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>
Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>
@a-maumau a-maumau force-pushed the mau/refactor/localization/yabloc_particle_filter branch from 2685165 to 31e2994 Compare June 18, 2024 06:13
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

Attention: Patch coverage is 16.25000% with 134 lines in your changes missing coverage. Please review.

Project coverage is 14.70%. Comparing base (7bc9ae0) to head (31e2994).
Report is 52 commits behind head on main.

Files Patch % Lines
..._filter/src/ll2_cost_map/hierarchical_cost_map.cpp 0.00% 32 Missing ⚠️
..._particle_filter/gnss_corrector/weight_manager.hpp 0.00% 22 Missing ⚠️
...abloc_particle_filter/src/prediction/predictor.cpp 0.00% 22 Missing ⚠️
...amera_corrector/camera_particle_corrector_core.cpp 0.00% 14 Missing ⚠️
...lter/src/camera_corrector/filter_line_segments.cpp 0.00% 10 Missing ⚠️
..._filter/src/gnss_corrector/gnss_corrector_core.cpp 0.00% 10 Missing ⚠️
.../yabloc/yabloc_particle_filter/src/common/mean.cpp 0.00% 7 Missing ⚠️
...icle_filter/ll2_cost_map/hierarchical_cost_map.hpp 0.00% 5 Missing ⚠️
...yabloc_particle_filter/test/src/test_resampler.cpp 81.48% 0 Missing and 5 partials ⚠️
.../yabloc_particle_filter/common/prediction_util.hpp 0.00% 2 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7519      +/-   ##
==========================================
+ Coverage   14.61%   14.70%   +0.08%     
==========================================
  Files        1995     2001       +6     
  Lines      139077   139166      +89     
  Branches    43429    43539     +110     
==========================================
+ Hits        20333    20463     +130     
- Misses      96134    96223      +89     
+ Partials    22610    22480     -130     
Flag Coverage Δ *Carryforward flag
differential 8.47% <16.25%> (?)
total 14.62% <ø> (+<0.01%) ⬆️ Carriedforward from 7bc9ae0

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@KYabuuchi KYabuuchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

I have confirmed that YabLoc works as before in logging_simualtor

@KYabuuchi KYabuuchi merged commit f90f216 into autowarefoundation:main Jun 19, 2024
29 of 30 checks passed
simon-eisenmann-driveblocks pushed a commit to simon-eisenmann-driveblocks/autoware.universe that referenced this pull request Jun 26, 2024
…dation#7519)

* removed unused

Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>

* style(pre-commit): autofix

* removed unused

Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>

* Update localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp

change to use get_mean_pose directly

Co-authored-by: Kento Yabuuchi <moc.liamg.8y8@gmail.com>
Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>

* apply suggestion

Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>

---------

Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kento Yabuuchi <moc.liamg.8y8@gmail.com>
Signed-off-by: Simon Eisenmann <simon.eisenmann@driveblocks.ai>
KhalilSelyan pushed a commit that referenced this pull request Jul 22, 2024
* removed unused

Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>

* style(pre-commit): autofix

* removed unused

Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>

* Update localization/yabloc/yabloc_particle_filter/src/camera_corrector/camera_particle_corrector_core.cpp

change to use get_mean_pose directly

Co-authored-by: Kento Yabuuchi <moc.liamg.8y8@gmail.com>
Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>

* apply suggestion

Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>

---------

Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kento Yabuuchi <moc.liamg.8y8@gmail.com>
@a-maumau a-maumau deleted the mau/refactor/localization/yabloc_particle_filter branch August 1, 2024 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:localization Vehicle's position determination in its environment. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants