Remove the final users of robot_state and joystick_state
This means we can remove them from the .q file.
Change-Id: Iefded3cf4537b2635341f3248c5f50af1534a241
diff --git a/y2017/wpilib_interface.cc b/y2017/wpilib_interface.cc
index 12e5760..49ff30c 100644
--- a/y2017/wpilib_interface.cc
+++ b/y2017/wpilib_interface.cc
@@ -22,6 +22,7 @@
#undef ERROR
#include "aos/commonmath.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
#include "aos/logging/queue_logging.h"
@@ -124,7 +125,8 @@
// Class to send position messages with sensor readings to our loops.
class SensorReader : public ::frc971::wpilib::SensorReader {
public:
- SensorReader() {
+ SensorReader(::aos::EventLoop *event_loop)
+ : ::frc971::wpilib::SensorReader(event_loop) {
// Set to filter out anything shorter than 1/4 of the minimum pulse width
// we should ever see.
UpdateFastEncoderFilterHz(kMaxFastEncoderPulsesPerSecond);
@@ -333,6 +335,9 @@
class SuperstructureWriter : public ::frc971::wpilib::LoopOutputHandler {
public:
+ SuperstructureWriter(::aos::EventLoop *event_loop)
+ : ::frc971::wpilib::LoopOutputHandler(event_loop) {}
+
void set_intake_victor(::std::unique_ptr<::frc::VictorSP> t) {
intake_victor_ = ::std::move(t);
}
@@ -436,12 +441,14 @@
::aos::InitNRT();
::aos::SetCurrentThreadName("StartCompetition");
- ::frc971::wpilib::JoystickSender joystick_sender;
+ ::aos::ShmEventLoop event_loop;
+
+ ::frc971::wpilib::JoystickSender joystick_sender(&event_loop);
::std::thread joystick_thread(::std::ref(joystick_sender));
::frc971::wpilib::PDPFetcher pdp_fetcher;
::std::thread pdp_fetcher_thread(::std::ref(pdp_fetcher));
- SensorReader reader;
+ SensorReader reader(&event_loop);
// TODO(campbell): Update port numbers
reader.set_drivetrain_left_encoder(make_encoder(0));
@@ -470,20 +477,21 @@
::std::thread reader_thread(::std::ref(reader));
auto imu_trigger = make_unique<DigitalInput>(3);
- ::frc971::wpilib::ADIS16448 imu(SPI::Port::kOnboardCS1, imu_trigger.get());
+ ::frc971::wpilib::ADIS16448 imu(&event_loop, SPI::Port::kOnboardCS1,
+ imu_trigger.get());
imu.SetDummySPI(SPI::Port::kOnboardCS2);
auto imu_reset = make_unique<DigitalOutput>(6);
imu.set_reset(imu_reset.get());
::std::thread imu_thread(::std::ref(imu));
- ::frc971::wpilib::DrivetrainWriter drivetrain_writer;
+ ::frc971::wpilib::DrivetrainWriter drivetrain_writer(&event_loop);
drivetrain_writer.set_left_controller0(
::std::unique_ptr<::frc::VictorSP>(new ::frc::VictorSP(7)), true);
drivetrain_writer.set_right_controller0(
::std::unique_ptr<::frc::VictorSP>(new ::frc::VictorSP(3)), false);
::std::thread drivetrain_writer_thread(::std::ref(drivetrain_writer));
- SuperstructureWriter superstructure_writer;
+ SuperstructureWriter superstructure_writer(&event_loop);
superstructure_writer.set_intake_victor(
::std::unique_ptr<::frc::VictorSP>(new ::frc::VictorSP(1)));
superstructure_writer.set_intake_rollers_victor(