Convert BallDetector to event loops.
Change-Id: Ic2716e5cc6d2573835aa039ce50d1ed96c882eed
diff --git a/y2016/dashboard/dashboard.cc b/y2016/dashboard/dashboard.cc
index d105a10..af6019c 100644
--- a/y2016/dashboard/dashboard.cc
+++ b/y2016/dashboard/dashboard.cc
@@ -54,6 +54,9 @@
: vision_status_fetcher_(
event_loop->MakeFetcher<::y2016::vision::VisionStatus>(
".y2016.vision.vision_status")),
+ ball_detector_fetcher_(
+ event_loop->MakeFetcher<::y2016::sensors::BallDetector>(
+ ".y2016.sensors.ball_detector")),
cur_raw_data_("no data"),
sample_id_(0),
measure_index_(0),
@@ -87,7 +90,7 @@
::frc971::autonomous::auto_mode.FetchLatest();
::y2016::control_loops::superstructure_queue.status.FetchLatest();
- ::y2016::sensors::ball_detector.FetchLatest();
+ ball_detector_fetcher_.Fetch();
vision_status_fetcher_.Fetch();
// Caused glitching with auto-aim at NASA, so be cautious with this until
@@ -108,11 +111,11 @@
// Ball detector comes after vision because we want to prioritize that
// indication.
- if (::y2016::sensors::ball_detector.get()) {
+ if (ball_detector_fetcher_.get()) {
// TODO(comran): Grab detected voltage from joystick_reader. Except this
// value may not change, so it may be worth it to keep it as it is right
// now.
- if (::y2016::sensors::ball_detector->voltage > 2.5) {
+ if (ball_detector_fetcher_->voltage > 2.5) {
big_indicator = big_indicator::kBallIntaked;
}
}
diff --git a/y2016/dashboard/dashboard.h b/y2016/dashboard/dashboard.h
index 8c64348..665d656 100644
--- a/y2016/dashboard/dashboard.h
+++ b/y2016/dashboard/dashboard.h
@@ -17,6 +17,7 @@
#include "aos/events/event-loop.h"
#include "aos/mutex/mutex.h"
#include "aos/time/time.h"
+#include "y2016/queues/ball_detector.q.h"
#include "y2016/vision/vision.q.h"
namespace y2016 {
@@ -64,6 +65,7 @@
};
::aos::Fetcher<::y2016::vision::VisionStatus> vision_status_fetcher_;
+ ::aos::Fetcher<::y2016::sensors::BallDetector> ball_detector_fetcher_;
// Storage vector that is written and overwritten with data in a FIFO fashion.
::std::vector<SampleItem> sample_items_;