Stop buffering up images in aprilrobotics
We were processing images up to 100ms old. This was causing indefinate
queueing, making control-c not work, and adding up to 30ms of latency to
readings.
Change-Id: Iad49bfbd128c9b3043f9146b9c6e4213a38a782f
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2023/vision/aprilrobotics.cc b/y2023/vision/aprilrobotics.cc
index d20a247..cbfd3f6 100644
--- a/y2023/vision/aprilrobotics.cc
+++ b/y2023/vision/aprilrobotics.cc
@@ -9,15 +9,19 @@
namespace y2023 {
namespace vision {
+namespace chrono = std::chrono;
+
AprilRoboticsDetector::AprilRoboticsDetector(aos::EventLoop *event_loop,
std::string_view channel_name)
: calibration_data_(CalibrationData()),
ftrace_(),
- image_callback_(event_loop, channel_name,
- [&](cv::Mat image_color_mat,
- const aos::monotonic_clock::time_point eof) {
- HandleImage(image_color_mat, eof);
- }),
+ image_callback_(
+ event_loop, channel_name,
+ [&](cv::Mat image_color_mat,
+ const aos::monotonic_clock::time_point eof) {
+ HandleImage(image_color_mat, eof);
+ },
+ chrono::milliseconds(5)),
target_map_sender_(
event_loop->MakeSender<frc971::vision::TargetMap>("/camera")) {
tag_family_ = tag16h5_create();
@@ -151,8 +155,8 @@
aos::monotonic_clock::now();
VLOG(1) << "Took "
- << std::chrono::duration<double>(after_pose_estimation -
- before_pose_estimation)
+ << chrono::duration<double>(after_pose_estimation -
+ before_pose_estimation)
.count()
<< " seconds for pose estimation";
}
@@ -164,8 +168,7 @@
timeprofile_display(tag_detector_->tp);
- VLOG(1) << "Took "
- << std::chrono::duration<double>(end_time - start_time).count()
+ VLOG(1) << "Took " << chrono::duration<double>(end_time - start_time).count()
<< " seconds to detect overall";
return results;