Move VisionStatus to an event loop
Convert the simulation over to using SimulatedEventLoop as well.
Change-Id: I05d837530f83df5432f056ca5ef6515fbab5f897
diff --git a/y2017/control_loops/superstructure/superstructure.cc b/y2017/control_loops/superstructure/superstructure.cc
index 730cd24..9b0297e 100644
--- a/y2017/control_loops/superstructure/superstructure.cc
+++ b/y2017/control_loops/superstructure/superstructure.cc
@@ -26,7 +26,11 @@
Superstructure::Superstructure(::aos::EventLoop *event_loop,
const ::std::string &name)
: aos::controls::ControlLoop<control_loops::SuperstructureQueue>(event_loop,
- name) {
+ name),
+ vision_status_fetcher_(
+ event_loop->MakeFetcher<::y2017::vision::VisionStatus>(
+ ".y2017.vision.vision_status")),
+ column_(event_loop) {
shot_interpolation_table_ =
::frc971::shooter_interpolation::InterpolationTable<ShotParams>({
// { distance_to_target, { shot_angle, shot_power, indexer_velocity }},
@@ -57,8 +61,8 @@
}
const vision::VisionStatus *vision_status = nullptr;
- if (vision::vision_status.FetchLatest()) {
- vision_status = vision::vision_status.get();
+ if (vision_status_fetcher_.Fetch()) {
+ vision_status = vision_status_fetcher_.get();
}
// Create a copy of the goals so that we can modify them.