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