Make max image age a parameter in code
Remove the flag and put it in the constructor for ImageCallback, so that
intrinsics calibration can define a much shorter age. This shorter age
is needed so that the watcher doesn't get too far behind and we aren't
able to quit the application.
Signed-off-by: milind-u <milind.upadhyay@gmail.com>
Change-Id: I9400f1c42d93285cc30065513e766ec7c6f34186
diff --git a/frc971/vision/charuco_lib.h b/frc971/vision/charuco_lib.h
index de6d4fb..7759482 100644
--- a/frc971/vision/charuco_lib.h
+++ b/frc971/vision/charuco_lib.h
@@ -54,9 +54,13 @@
BGR = 1,
GRAYSCALE = 2,
};
- ImageCallback(aos::EventLoop *event_loop, std::string_view channel,
- std::function<void(cv::Mat, aos::monotonic_clock::time_point)>
- &&handle_image_fn);
+
+ // `max_age` is the age to start dropping frames at
+ ImageCallback(
+ aos::EventLoop *event_loop, std::string_view channel,
+ std::function<void(cv::Mat, aos::monotonic_clock::time_point)>
+ &&handle_image_fn,
+ aos::monotonic_clock::duration max_age = std::chrono::milliseconds(100));
void set_format(Format format) { format_ = format; }
@@ -74,6 +78,8 @@
aos::Ftrace ftrace_;
Format format_ = Format::BGR;
+
+ aos::monotonic_clock::duration max_age_;
};
// Types of targets that a CharucoExtractor can detect in images