Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <string.h> |
| 3 | #include <unistd.h> |
| 4 | #include <inttypes.h> |
| 5 | |
Austin Schuh | 8aec1ed | 2016-05-01 13:29:20 -0700 | [diff] [blame] | 6 | #include <chrono> |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 7 | #include <thread> |
| 8 | #include <mutex> |
| 9 | #include <functional> |
| 10 | |
Parker Schuh | d3b7a887 | 2018-02-19 16:42:27 -0800 | [diff] [blame] | 11 | #include "frc971/wpilib/ahal/AnalogInput.h" |
| 12 | #include "frc971/wpilib/ahal/Compressor.h" |
| 13 | #include "frc971/wpilib/ahal/DigitalGlitchFilter.h" |
| 14 | #include "frc971/wpilib/ahal/DriverStation.h" |
| 15 | #include "frc971/wpilib/ahal/Encoder.h" |
| 16 | #include "frc971/wpilib/ahal/PowerDistributionPanel.h" |
| 17 | #include "frc971/wpilib/ahal/Relay.h" |
| 18 | #include "frc971/wpilib/ahal/Talon.h" |
Brian Silverman | 5090c43 | 2016-01-02 14:44:26 -0800 | [diff] [blame] | 19 | #include "frc971/wpilib/wpilib_robot_base.h" |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 20 | #undef ERROR |
| 21 | |
Austin Schuh | df6cbb1 | 2019-02-02 13:46:52 -0800 | [diff] [blame] | 22 | #include "aos/events/shm-event-loop.h" |
Brian Silverman | f819b44 | 2019-01-20 16:51:04 -0800 | [diff] [blame] | 23 | #include "aos/init.h" |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 24 | #include "aos/logging/logging.h" |
| 25 | #include "aos/logging/queue_logging.h" |
Brian Silverman | f819b44 | 2019-01-20 16:51:04 -0800 | [diff] [blame] | 26 | #include "aos/make_unique.h" |
| 27 | #include "aos/robot_state/robot_state.q.h" |
| 28 | #include "aos/stl_mutex/stl_mutex.h" |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 29 | #include "aos/time/time.h" |
| 30 | #include "aos/util/log_interval.h" |
| 31 | #include "aos/util/phased_loop.h" |
| 32 | #include "aos/util/wrapping_counter.h" |
Austin Schuh | 2a671df | 2016-11-26 15:00:06 -0800 | [diff] [blame] | 33 | #include "frc971/control_loops/drivetrain/drivetrain.q.h" |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 34 | #include "frc971/wpilib/buffered_pcm.h" |
Austin Schuh | 2a671df | 2016-11-26 15:00:06 -0800 | [diff] [blame] | 35 | #include "frc971/wpilib/buffered_solenoid.h" |
Brian Silverman | b5b46ca | 2016-03-13 01:14:17 -0500 | [diff] [blame] | 36 | #include "frc971/wpilib/dma.h" |
Austin Schuh | 2a671df | 2016-11-26 15:00:06 -0800 | [diff] [blame] | 37 | #include "frc971/wpilib/dma_edge_counting.h" |
Sabina Davis | e33f59a | 2019-02-03 01:17:45 -0800 | [diff] [blame] | 38 | #include "frc971/wpilib/drivetrain_writer.h" |
Austin Schuh | 2a671df | 2016-11-26 15:00:06 -0800 | [diff] [blame] | 39 | #include "frc971/wpilib/encoder_and_potentiometer.h" |
Austin Schuh | 2a671df | 2016-11-26 15:00:06 -0800 | [diff] [blame] | 40 | #include "frc971/wpilib/interrupt_edge_counting.h" |
| 41 | #include "frc971/wpilib/joystick_sender.h" |
| 42 | #include "frc971/wpilib/logging.q.h" |
| 43 | #include "frc971/wpilib/loop_output_handler.h" |
Austin Schuh | 45a549f | 2019-02-02 15:43:56 -0800 | [diff] [blame] | 44 | #include "frc971/wpilib/sensor_reader.h" |
Austin Schuh | 2a671df | 2016-11-26 15:00:06 -0800 | [diff] [blame] | 45 | #include "y2012/control_loops/accessories/accessories.q.h" |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 46 | |
| 47 | #ifndef M_PI |
| 48 | #define M_PI 3.14159265358979323846 |
| 49 | #endif |
| 50 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 51 | using ::y2012::control_loops::AccessoriesQueue; |
Parker Schuh | d3b7a887 | 2018-02-19 16:42:27 -0800 | [diff] [blame] | 52 | using namespace frc; |
Brian Silverman | f819b44 | 2019-01-20 16:51:04 -0800 | [diff] [blame] | 53 | using aos::make_unique; |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 54 | |
| 55 | namespace y2012 { |
| 56 | namespace wpilib { |
| 57 | |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 58 | double drivetrain_translate(int32_t in) { |
| 59 | return -static_cast<double>(in) / |
| 60 | (256.0 /*cpr*/ * 4.0 /*4x*/) * |
| 61 | 1 * |
| 62 | (3.5 /*wheel diameter*/ * 2.54 / 100.0 * M_PI) * 2.0 / 2.0; |
| 63 | } |
| 64 | |
| 65 | double drivetrain_velocity_translate(double in) { |
| 66 | return (1.0 / in) / 256.0 /*cpr*/ * |
| 67 | 1 * |
| 68 | (3.5 /*wheel diameter*/ * 2.54 / 100.0 * M_PI) * 2.0 / 2.0; |
| 69 | } |
| 70 | |
Austin Schuh | 45a549f | 2019-02-02 15:43:56 -0800 | [diff] [blame] | 71 | class SensorReader : public ::frc971::wpilib::SensorReader { |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 72 | public: |
Austin Schuh | df6cbb1 | 2019-02-02 13:46:52 -0800 | [diff] [blame] | 73 | SensorReader(::aos::EventLoop *event_loop) |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 74 | : ::frc971::wpilib::SensorReader(event_loop), |
| 75 | accessories_position_sender_( |
| 76 | event_loop->MakeSender<::aos::control_loops::Position>( |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 77 | ".y2012.control_loops.accessories_queue.position")), |
| 78 | drivetrain_position_sender_( |
| 79 | event_loop->MakeSender< |
| 80 | ::frc971::control_loops::DrivetrainQueue::Position>( |
| 81 | ".frc971.control_loops.drivetrain_queue.position")) {} |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 82 | |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 83 | void RunIteration() { |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 84 | { |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 85 | auto drivetrain_message = drivetrain_position_sender_.MakeMessage(); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 86 | drivetrain_message->right_encoder = |
| 87 | drivetrain_translate(drivetrain_right_encoder_->GetRaw()); |
| 88 | drivetrain_message->left_encoder = |
| 89 | -drivetrain_translate(drivetrain_left_encoder_->GetRaw()); |
| 90 | drivetrain_message->left_speed = |
| 91 | drivetrain_velocity_translate(drivetrain_left_encoder_->GetPeriod()); |
| 92 | drivetrain_message->right_speed = |
| 93 | drivetrain_velocity_translate(drivetrain_right_encoder_->GetPeriod()); |
| 94 | |
| 95 | drivetrain_message.Send(); |
| 96 | } |
| 97 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 98 | accessories_position_sender_.MakeMessage().Send(); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 99 | } |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 100 | |
| 101 | private: |
| 102 | ::aos::Sender<::aos::control_loops::Position> accessories_position_sender_; |
Austin Schuh | bd0a40f | 2019-06-30 14:56:31 -0700 | [diff] [blame] | 103 | ::aos::Sender<::frc971::control_loops::DrivetrainQueue::Position> |
| 104 | drivetrain_position_sender_; |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | class SolenoidWriter { |
| 108 | public: |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 109 | SolenoidWriter(::aos::EventLoop *event_loop, |
| 110 | const ::std::unique_ptr<::frc971::wpilib::BufferedPcm> &pcm) |
| 111 | : event_loop_(event_loop), |
| 112 | pcm_(pcm), |
| 113 | drivetrain_fetcher_( |
| 114 | event_loop_ |
| 115 | ->MakeFetcher<::frc971::control_loops::DrivetrainQueue::Output>( |
| 116 | ".y2012.control_loops.drivetrain_queue.output")), |
| 117 | accessories_fetcher_(event_loop_->MakeFetcher< |
| 118 | ::y2012::control_loops::AccessoriesQueue::Message>( |
| 119 | ".y2012.control_loops.accessories_queue.output")) { |
| 120 | event_loop_->set_name("Solenoids"); |
| 121 | event_loop_->SetRuntimeRealtimePriority(27); |
| 122 | |
| 123 | event_loop_->AddPhasedLoop([this](int iterations) { Loop(iterations); }, |
| 124 | ::std::chrono::milliseconds(20), |
| 125 | ::std::chrono::milliseconds(1)); |
| 126 | } |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 127 | |
| 128 | void set_drivetrain_high( |
| 129 | ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) { |
| 130 | drivetrain_high_ = ::std::move(s); |
| 131 | } |
| 132 | |
| 133 | void set_drivetrain_low( |
| 134 | ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) { |
| 135 | drivetrain_low_ = ::std::move(s); |
| 136 | } |
| 137 | |
| 138 | void set_s1(::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) { |
| 139 | s1_ = ::std::move(s); |
| 140 | } |
| 141 | |
| 142 | void set_s2(::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) { |
| 143 | s2_ = ::std::move(s); |
| 144 | } |
| 145 | |
| 146 | void set_s3(::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) { |
| 147 | s3_ = ::std::move(s); |
| 148 | } |
| 149 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 150 | void Loop(const int iterations) { |
| 151 | if (iterations != 1) { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame^] | 152 | AOS_LOG(DEBUG, "Solenoids skipped %d iterations\n", iterations - 1); |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 153 | } |
Brian Silverman | 5090c43 | 2016-01-02 14:44:26 -0800 | [diff] [blame] | 154 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 155 | { |
| 156 | accessories_fetcher_.Fetch(); |
| 157 | if (accessories_fetcher_.get()) { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame^] | 158 | AOS_LOG_STRUCT(DEBUG, "solenoids", *accessories_fetcher_); |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 159 | s1_->Set(accessories_fetcher_->solenoids[0]); |
| 160 | s2_->Set(accessories_fetcher_->solenoids[1]); |
| 161 | s3_->Set(accessories_fetcher_->solenoids[2]); |
Brian Silverman | 5090c43 | 2016-01-02 14:44:26 -0800 | [diff] [blame] | 162 | } |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 163 | } |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 164 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 165 | { |
| 166 | drivetrain_fetcher_.Fetch(); |
| 167 | if (drivetrain_fetcher_.get()) { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame^] | 168 | AOS_LOG_STRUCT(DEBUG, "solenoids", *drivetrain_fetcher_); |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 169 | const bool high = |
| 170 | drivetrain_fetcher_->left_high || drivetrain_fetcher_->right_high; |
| 171 | drivetrain_high_->Set(high); |
| 172 | drivetrain_low_->Set(!high); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 173 | } |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 174 | } |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 175 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 176 | { |
| 177 | ::frc971::wpilib::PneumaticsToLog to_log; |
| 178 | pcm_->Flush(); |
| 179 | to_log.read_solenoids = pcm_->GetAll(); |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame^] | 180 | AOS_LOG_STRUCT(DEBUG, "pneumatics info", to_log); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 181 | } |
| 182 | } |
| 183 | |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 184 | private: |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 185 | ::aos::EventLoop *event_loop_; |
| 186 | |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 187 | const ::std::unique_ptr<::frc971::wpilib::BufferedPcm> &pcm_; |
| 188 | |
| 189 | ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> drivetrain_high_; |
| 190 | ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> drivetrain_low_; |
| 191 | ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s1_, s2_, s3_; |
| 192 | |
| 193 | ::std::unique_ptr<Compressor> compressor_; |
| 194 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 195 | ::aos::Fetcher<::frc971::control_loops::DrivetrainQueue::Output> |
| 196 | drivetrain_fetcher_; |
| 197 | ::aos::Fetcher<::y2012::control_loops::AccessoriesQueue::Message> |
| 198 | accessories_fetcher_; |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 199 | }; |
| 200 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 201 | class AccessoriesWriter |
| 202 | : public ::frc971::wpilib::LoopOutputHandler<AccessoriesQueue::Message> { |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 203 | public: |
Austin Schuh | df6cbb1 | 2019-02-02 13:46:52 -0800 | [diff] [blame] | 204 | AccessoriesWriter(::aos::EventLoop *event_loop) |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 205 | : ::frc971::wpilib::LoopOutputHandler<AccessoriesQueue::Message>( |
| 206 | event_loop, ".y2012.control_loops.accessories_queue.output") {} |
Austin Schuh | df6cbb1 | 2019-02-02 13:46:52 -0800 | [diff] [blame] | 207 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 208 | void set_talon1(::std::unique_ptr<Talon> t) { talon1_ = ::std::move(t); } |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 209 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 210 | void set_talon2(::std::unique_ptr<Talon> t) { talon2_ = ::std::move(t); } |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 211 | |
| 212 | private: |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 213 | virtual void Write(const AccessoriesQueue::Message &output) override { |
| 214 | talon1_->SetSpeed(output.sticks[0]); |
| 215 | talon2_->SetSpeed(output.sticks[1]); |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame^] | 216 | AOS_LOG_STRUCT(DEBUG, "will output", output); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | virtual void Stop() override { |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame^] | 220 | AOS_LOG(WARNING, "shooter output too old\n"); |
Brian Silverman | 6eaa2d8 | 2017-02-04 20:48:30 -0800 | [diff] [blame] | 221 | talon1_->SetDisabled(); |
| 222 | talon2_->SetDisabled(); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | ::std::unique_ptr<Talon> talon1_, talon2_; |
| 226 | }; |
| 227 | |
Brian Silverman | 5090c43 | 2016-01-02 14:44:26 -0800 | [diff] [blame] | 228 | class WPILibRobot : public ::frc971::wpilib::WPILibRobotBase { |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 229 | public: |
| 230 | ::std::unique_ptr<Encoder> make_encoder(int index) { |
| 231 | return make_unique<Encoder>(10 + index * 2, 11 + index * 2, false, |
| 232 | Encoder::k4X); |
| 233 | } |
| 234 | |
Brian Silverman | 5090c43 | 2016-01-02 14:44:26 -0800 | [diff] [blame] | 235 | void Run() override { |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 236 | // Thread 1. |
| 237 | ::aos::ShmEventLoop joystick_sender_event_loop; |
| 238 | ::frc971::wpilib::JoystickSender joystick_sender( |
| 239 | &joystick_sender_event_loop); |
| 240 | AddLoop(&joystick_sender_event_loop); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 241 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 242 | // Thread 2. |
| 243 | ::aos::ShmEventLoop sensor_reader_event_loop; |
| 244 | SensorReader sensor_reader(&sensor_reader_event_loop); |
| 245 | sensor_reader.set_drivetrain_left_encoder(make_encoder(0)); |
| 246 | sensor_reader.set_drivetrain_right_encoder(make_encoder(1)); |
| 247 | AddLoop(&sensor_reader_event_loop); |
Austin Schuh | df6cbb1 | 2019-02-02 13:46:52 -0800 | [diff] [blame] | 248 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 249 | // Thread 3. |
| 250 | ::aos::ShmEventLoop output_event_loop; |
| 251 | ::frc971::wpilib::DrivetrainWriter drivetrain_writer(&output_event_loop); |
Sabina Davis | e33f59a | 2019-02-03 01:17:45 -0800 | [diff] [blame] | 252 | drivetrain_writer.set_left_controller0( |
| 253 | ::std::unique_ptr<Talon>(new Talon(3)), true); |
| 254 | drivetrain_writer.set_right_controller0( |
| 255 | ::std::unique_ptr<Talon>(new Talon(4)), false); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 256 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 257 | ::y2012::wpilib::AccessoriesWriter accessories_writer(&output_event_loop); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 258 | accessories_writer.set_talon1(::std::unique_ptr<Talon>(new Talon(5))); |
| 259 | accessories_writer.set_talon2(::std::unique_ptr<Talon>(new Talon(6))); |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 260 | AddLoop(&output_event_loop); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 261 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 262 | // Thread 4. |
| 263 | ::aos::ShmEventLoop solenoid_writer_event_loop; |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 264 | ::std::unique_ptr<::frc971::wpilib::BufferedPcm> pcm( |
| 265 | new ::frc971::wpilib::BufferedPcm()); |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 266 | SolenoidWriter solenoid_writer(&solenoid_writer_event_loop, pcm); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 267 | solenoid_writer.set_drivetrain_high(pcm->MakeSolenoid(0)); |
| 268 | solenoid_writer.set_drivetrain_low(pcm->MakeSolenoid(2)); |
| 269 | solenoid_writer.set_s1(pcm->MakeSolenoid(1)); |
| 270 | solenoid_writer.set_s2(pcm->MakeSolenoid(3)); |
| 271 | solenoid_writer.set_s3(pcm->MakeSolenoid(4)); |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 272 | AddLoop(&solenoid_writer_event_loop); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 273 | |
Austin Schuh | bd1fe9c | 2019-06-29 16:35:48 -0700 | [diff] [blame] | 274 | RunLoops(); |
Brian Silverman | c71537c | 2016-01-01 13:43:14 -0800 | [diff] [blame] | 275 | } |
| 276 | }; |
| 277 | |
| 278 | } // namespace wpilib |
| 279 | } // namespace y2012 |
| 280 | |
| 281 | |
Brian Silverman | 5090c43 | 2016-01-02 14:44:26 -0800 | [diff] [blame] | 282 | AOS_ROBOT_CLASS(::y2012::wpilib::WPILibRobot); |