Remove global .frc971.control_loops.drivetrain_queue object
Change-Id: I424f09dcc8bc210e49cbdc805d1a423a72332617
diff --git a/y2017/actors/autonomous_actor.cc b/y2017/actors/autonomous_actor.cc
index 9b7855c..33c29a8 100644
--- a/y2017/actors/autonomous_actor.cc
+++ b/y2017/actors/autonomous_actor.cc
@@ -14,7 +14,6 @@
namespace y2017 {
namespace actors {
using ::aos::monotonic_clock;
-using ::frc971::control_loops::drivetrain_queue;
namespace chrono = ::std::chrono;
namespace this_thread = ::std::this_thread;
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_;
diff --git a/y2017/joystick_reader.cc b/y2017/joystick_reader.cc
index 10bf20d..79d5c12 100644
--- a/y2017/joystick_reader.cc
+++ b/y2017/joystick_reader.cc
@@ -18,8 +18,6 @@
#include "y2017/control_loops/superstructure/superstructure.q.h"
#include "y2017/control_loops/drivetrain/drivetrain_base.h"
-using ::frc971::control_loops::drivetrain_queue;
-
using ::aos::input::driver_station::ButtonLocation;
using ::aos::input::driver_station::ControlBit;
using ::aos::input::driver_station::JoystickAxis;
diff --git a/y2017/wpilib_interface.cc b/y2017/wpilib_interface.cc
index e8dca61..4fac858 100644
--- a/y2017/wpilib_interface.cc
+++ b/y2017/wpilib_interface.cc
@@ -58,7 +58,6 @@
#define M_PI 3.14159265358979323846
#endif
-using ::frc971::control_loops::drivetrain_queue;
using ::y2017::control_loops::SuperstructureQueue;
using ::y2017::constants::Values;
using ::aos::monotonic_clock;
@@ -132,7 +131,11 @@
".frc971.autonomous.auto_mode")),
superstructure_position_sender_(
event_loop->MakeSender<SuperstructureQueue::Position>(
- ".y2017.control_loops.superstructure_queue.position")) {
+ ".y2017.control_loops.superstructure_queue.position")),
+ drivetrain_position_sender_(
+ event_loop->MakeSender<
+ ::frc971::control_loops::DrivetrainQueue::Position>(
+ ".frc971.control_loops.drivetrain_queue.position")) {
// Set to filter out anything shorter than 1/4 of the minimum pulse width
// we should ever see.
UpdateFastEncoderFilterHz(kMaxFastEncoderPulsesPerSecond);
@@ -204,7 +207,7 @@
void RunIteration() {
{
- auto drivetrain_message = drivetrain_queue.position.MakeMessage();
+ auto drivetrain_message = drivetrain_position_sender_.MakeMessage();
drivetrain_message->right_encoder =
drivetrain_translate(drivetrain_right_encoder_->GetRaw());
drivetrain_message->right_speed =
@@ -265,6 +268,8 @@
private:
::aos::Sender<::frc971::autonomous::AutonomousMode> auto_mode_sender_;
::aos::Sender<SuperstructureQueue::Position> superstructure_position_sender_;
+ ::aos::Sender<::frc971::control_loops::DrivetrainQueue::Position>
+ drivetrain_position_sender_;
DigitalGlitchFilter hall_filter_;