Remove global .frc971.control_loops.drivetrain_queue object
Change-Id: I424f09dcc8bc210e49cbdc805d1a423a72332617
diff --git a/y2017/control_loops/superstructure/superstructure.cc b/y2017/control_loops/superstructure/superstructure.cc
index 9b0297e..c76dd19 100644
--- a/y2017/control_loops/superstructure/superstructure.cc
+++ b/y2017/control_loops/superstructure/superstructure.cc
@@ -21,7 +21,6 @@
} // namespace
typedef ::y2017::constants::Values::ShotParams ShotParams;
-using ::frc971::control_loops::drivetrain_queue;
Superstructure::Superstructure(::aos::EventLoop *event_loop,
const ::std::string &name)
@@ -30,6 +29,10 @@
vision_status_fetcher_(
event_loop->MakeFetcher<::y2017::vision::VisionStatus>(
".y2017.vision.vision_status")),
+ drivetrain_status_fetcher_(
+ event_loop
+ ->MakeFetcher<::frc971::control_loops::DrivetrainQueue::Status>(
+ ".frc971.control_loops.drivetrain_queue.status")),
column_(event_loop) {
shot_interpolation_table_ =
::frc971::shooter_interpolation::InterpolationTable<ShotParams>({
@@ -84,9 +87,9 @@
// If we are moving too fast, disable shooting and clear the accumulator.
double robot_velocity = 0.0;
- drivetrain_queue.status.FetchLatest();
- if (drivetrain_queue.status.get()) {
- robot_velocity = drivetrain_queue.status->robot_speed;
+ drivetrain_status_fetcher_.Fetch();
+ if (drivetrain_status_fetcher_.get()) {
+ robot_velocity = drivetrain_status_fetcher_->robot_speed;
}
if (::std::abs(robot_velocity) > 0.2) {
diff --git a/y2017/control_loops/superstructure/superstructure.h b/y2017/control_loops/superstructure/superstructure.h
index e387cf2..660b861 100644
--- a/y2017/control_loops/superstructure/superstructure.h
+++ b/y2017/control_loops/superstructure/superstructure.h
@@ -43,6 +43,8 @@
private:
::aos::Fetcher<::y2017::vision::VisionStatus> vision_status_fetcher_;
+ ::aos::Fetcher<::frc971::control_loops::DrivetrainQueue::Status>
+ drivetrain_status_fetcher_;
hood::Hood hood_;
intake::Intake intake_;