@@ -61,7 +61,6 @@ class MetricsCatcher : public rclcpp::Node {
6161 stop_thresh_ = this ->declare_parameter <double >(" stop_thresh" , 0.02 ); // |vx| <= stop
6262 resume_thresh_ = this ->declare_parameter <double >(
6363 " resume_thresh" , 0.10 ); // vx >= resume
64-
6564 debounce_n_ = this ->declare_parameter <int >(
6665 " debounce_n" , 3 ); // need K in arow
6766
@@ -144,13 +143,18 @@ class MetricsCatcher : public rclcpp::Node {
144143
145144 if (!R.have_data ) {return R;}
146145
147- // helper: pick samples in a time range
148- auto in_range = [&](double t0, double t1){
149- std::vector<Sample> out; out.reserve (samples_.size ());
150- for (const auto & s : samples_) {if (s.t >= t0 && s.t <= t1) {out.push_back (s);}}
146+ auto in_range = [&](double t0, double t1) { // helper: pick samples in [t0, t1]
147+ std::vector<Sample> out;
148+ out.reserve (samples_.size ());
149+ for (const auto & s : samples_) {
150+ if (s.t >= t0 && s.t <= t1) {
151+ out.push_back (s);
152+ }
153+ }
151154 return out;
152155 };
153156
157+
154158 // Segments:
155159 // 0..(3 - 0.2) → must be clean (no stop) (guard band)
156160 const auto stop_seg = in_range (stop_window_start_, stop_window_end_);
@@ -193,9 +197,12 @@ class MetricsCatcher : public rclcpp::Node {
193197 // 4) false-stop%: outside the window we should mostly be moving
194198 const size_t clean_total = pre_seg.size () + post_seg.size ();
195199 if (clean_total > 0 ) {
196- auto count_stopped = [&](const std::vector<Sample> & seg){
197- return std::count_if (seg.begin (), seg.end (),
198- [&](const Sample & s){return std::fabs (s.vx ) <= stop_thresh_;});
200+ auto count_stopped = [&](const std::vector<Sample> & seg) {
201+ return std::count_if (
202+ seg.begin (), seg.end (),
203+ [&](const Sample & s) {
204+ return std::fabs (s.vx ) <= stop_thresh_;
205+ });
199206 };
200207 const size_t clean_stopped = count_stopped (pre_seg) + count_stopped (post_seg);
201208 R.false_stop_pct = static_cast <double >(clean_stopped) / static_cast <double >(clean_total);
0 commit comments