@@ -27,7 +27,11 @@ namespace resample_utils
27
27
{
28
28
constexpr double close_s_threshold = 1e-6 ;
29
29
30
- #define log_error (message ) std::cerr << " \033 [31m " << message << " \033 [0m" << std::endl;
30
+ static inline rclcpp::Logger get_logger ()
31
+ {
32
+ constexpr const char * logger{" motion_utils.resample_utils" };
33
+ return rclcpp::get_logger (logger);
34
+ }
31
35
32
36
template <class T >
33
37
bool validate_size (const T & points)
@@ -62,27 +66,27 @@ bool validate_arguments(const T & input_points, const std::vector<double> & resa
62
66
{
63
67
// Check size of the arguments
64
68
if (!validate_size (input_points)) {
65
- log_error ( " [resample_utils] invalid argument: The number of input points is less than 2" );
69
+ RCLCPP_DEBUG ( get_logger (), " invalid argument: The number of input points is less than 2" );
66
70
tier4_autoware_utils::print_backtrace ();
67
71
return false ;
68
72
}
69
73
if (!validate_size (resampling_intervals)) {
70
- log_error (
71
- " [resample_utils] invalid argument: The number of resampling intervals is less than 2" );
74
+ RCLCPP_DEBUG (
75
+ get_logger (), " invalid argument: The number of resampling intervals is less than 2" );
72
76
tier4_autoware_utils::print_backtrace ();
73
77
return false ;
74
78
}
75
79
76
80
// Check resampling range
77
81
if (!validate_resampling_range (input_points, resampling_intervals)) {
78
- log_error ( " [resample_utils] invalid argument: resampling interval is longer than input points" );
82
+ RCLCPP_DEBUG ( get_logger (), " invalid argument: resampling interval is longer than input points" );
79
83
tier4_autoware_utils::print_backtrace ();
80
84
return false ;
81
85
}
82
86
83
87
// Check duplication
84
88
if (!validate_points_duplication (input_points)) {
85
- log_error ( " [resample_utils] invalid argument: input points has some duplicated points" );
89
+ RCLCPP_DEBUG ( get_logger (), " invalid argument: input points has some duplicated points" );
86
90
tier4_autoware_utils::print_backtrace ();
87
91
return false ;
88
92
}
@@ -95,23 +99,23 @@ bool validate_arguments(const T & input_points, const double resampling_interval
95
99
{
96
100
// Check size of the arguments
97
101
if (!validate_size (input_points)) {
98
- log_error ( " [resample_utils] invalid argument: The number of input points is less than 2" );
102
+ RCLCPP_DEBUG ( get_logger (), " invalid argument: The number of input points is less than 2" );
99
103
tier4_autoware_utils::print_backtrace ();
100
104
return false ;
101
105
}
102
106
103
107
// check resampling interval
104
108
if (resampling_interval < motion_utils::overlap_threshold) {
105
- log_error (
106
- " [resample_utils] invalid argument: resampling interval is less than " +
107
- std::to_string ( motion_utils::overlap_threshold) );
109
+ RCLCPP_DEBUG (
110
+ get_logger (), " invalid argument: resampling interval is less than %f " ,
111
+ motion_utils::overlap_threshold);
108
112
tier4_autoware_utils::print_backtrace ();
109
113
return false ;
110
114
}
111
115
112
116
// Check duplication
113
117
if (!validate_points_duplication (input_points)) {
114
- log_error ( " [resample_utils] invalid argument: input points has some duplicated points" );
118
+ RCLCPP_DEBUG ( get_logger (), " invalid argument: input points has some duplicated points" );
115
119
tier4_autoware_utils::print_backtrace ();
116
120
return false ;
117
121
}
0 commit comments