blob: 590c74a434fd9514d3d0c9dea1ee6e52b4e6b22f [file] [log] [blame]
Brian Silverman17f503e2015-08-02 18:17:18 -07001#include <stdio.h>
2#include <string.h>
3#include <unistd.h>
4#include <math.h>
5
Austin Schuhbfb04122019-05-22 21:16:51 -07006#include "aos/actions/actions.h"
John Park398c74a2018-10-20 21:17:39 -07007#include "aos/init.h"
Austin Schuhbfb04122019-05-22 21:16:51 -07008#include "aos/input/action_joystick_input.h"
John Park33858a32018-09-28 23:05:48 -07009#include "aos/input/driver_station_data.h"
10#include "aos/logging/logging.h"
John Park33858a32018-09-28 23:05:48 -070011#include "aos/time/time.h"
Austin Schuhbfb04122019-05-22 21:16:51 -070012#include "aos/util/log_interval.h"
Brian Silverman17f503e2015-08-02 18:17:18 -070013
Brian Silverman17f503e2015-08-02 18:17:18 -070014#include "frc971/autonomous/auto.q.h"
Austin Schuhbfb04122019-05-22 21:16:51 -070015#include "frc971/control_loops/drivetrain/drivetrain.q.h"
16#include "frc971/queues/gyro.q.h"
Brian Silverman17f503e2015-08-02 18:17:18 -070017#include "y2014/actors/shoot_actor.h"
Austin Schuhbfb04122019-05-22 21:16:51 -070018#include "y2014/constants.h"
19#include "y2014/control_loops/claw/claw.q.h"
20#include "y2014/control_loops/drivetrain/drivetrain_base.h"
21#include "y2014/control_loops/shooter/shooter.q.h"
Brian Silverman17f503e2015-08-02 18:17:18 -070022
Comran Morshed5323ecb2015-12-26 20:50:55 +000023using ::frc971::control_loops::drivetrain_queue;
Brian Silverman17f503e2015-08-02 18:17:18 -070024
25using ::aos::input::driver_station::ButtonLocation;
26using ::aos::input::driver_station::JoystickAxis;
27using ::aos::input::driver_station::ControlBit;
28
29#define OLD_DS 0
30
Brian Silvermanb601d892015-12-20 18:24:38 -050031namespace y2014 {
Brian Silverman17f503e2015-08-02 18:17:18 -070032namespace input {
33namespace joysticks {
34
35const ButtonLocation kDriveControlLoopEnable1(1, 7),
36 kDriveControlLoopEnable2(1, 11);
37const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
Campbell Crowley5b27f022016-02-20 16:55:35 -080038const ButtonLocation kShiftHigh(2, 3), kShiftLow(2, 1);
Brian Silverman17f503e2015-08-02 18:17:18 -070039const ButtonLocation kQuickTurn(1, 5);
40
41const ButtonLocation kCatch(3, 10);
42
43#if OLD_DS
44const ButtonLocation kFire(3, 11);
45const ButtonLocation kUnload(1, 4);
46const ButtonLocation kReload(1, 2);
47
48const ButtonLocation kRollersOut(3, 12);
49const ButtonLocation kRollersIn(3, 7);
50
51const ButtonLocation kTuck(3, 9);
52const ButtonLocation kIntakePosition(3, 8);
53const ButtonLocation kIntakeOpenPosition(3, 10);
54const ButtonLocation kVerticalTuck(3, 1);
55const JoystickAxis kFlipRobot(3, 3);
56
57const ButtonLocation kLongShot(3, 5);
58const ButtonLocation kCloseShot(3, 2);
59const ButtonLocation kFenderShot(3, 3);
60const ButtonLocation kTrussShot(2, 11);
61const ButtonLocation kHumanPlayerShot(3, 2);
62#else
63const ButtonLocation kFire(3, 9);
64const ButtonLocation kUnload(1, 4);
65const ButtonLocation kReload(1, 2);
66
67const ButtonLocation kRollersOut(3, 8);
68const ButtonLocation kRollersIn(3, 3);
69
70const ButtonLocation kTuck(3, 4);
71const ButtonLocation kIntakePosition(3, 5);
72const ButtonLocation kIntakeOpenPosition(3, 11);
73const ButtonLocation kVerticalTuck(2, 6);
74const JoystickAxis kFlipRobot(3, 3);
75
76const ButtonLocation kLongShot(3, 7);
77const ButtonLocation kCloseShot(3, 6);
78const ButtonLocation kFenderShot(3, 2);
79const ButtonLocation kTrussShot(2, 11);
80const ButtonLocation kHumanPlayerShot(3, 1);
81#endif
82
83const ButtonLocation kUserLeft(2, 7);
84const ButtonLocation kUserRight(2, 10);
85
86const JoystickAxis kAdjustClawGoal(3, 2);
87const JoystickAxis kAdjustClawSeparation(3, 1);
88
89struct ClawGoal {
90 double angle;
91 double separation;
92};
93
94struct ShotGoal {
95 ClawGoal claw;
96 double shot_power;
97 double velocity_compensation;
98 double intake_power;
99};
100
101const double kIntakePower = 4.0;
102// In case we have to quickly adjust it.
103const double kGrabSeparation = 0;
104const double kShootSeparation = 0.11 + kGrabSeparation;
105
106const ClawGoal kTuckGoal = {-2.273474, -0.749484};
107const ClawGoal kVerticalTuckGoal = {0, kGrabSeparation};
108const ClawGoal kIntakeGoal = {-2.24, kGrabSeparation};
109const ClawGoal kIntakeOpenGoal = {-2.0, 1.1};
110
111// TODO(austin): Tune these by hand...
112const ClawGoal kFlippedTuckGoal = {2.733474, -0.75};
113const ClawGoal kFlippedIntakeGoal = {2.0, kGrabSeparation};
114const ClawGoal kFlippedIntakeOpenGoal = {0.95, 1.0};
115
116// 34" between near edge of colored line and rear edge of bumper.
117// Only works running?
118const ShotGoal kLongShotGoal = {
119 {-1.08, kShootSeparation}, 145, 0.04, kIntakePower};
120// old 34" {-1.06, kShootSeparation}, 140, 0.04, kIntakePower};
121const ShotGoal kFlippedLongShotGoal = {
122 {0.96, kShootSeparation}, 145, 0.09, kIntakePower};
123// old 34" {0.96, kShootSeparation}, 140, 0.09, kIntakePower};
124
125// 78" between near edge of colored line and rear edge of bumper.
126const ShotGoal kCloseShotGoal = {
127 {-0.95, kShootSeparation}, 105, 0.2, kIntakePower};
128// 3/4" plunger {-0.90, kShootSeparation}, 105, 0.2, kIntakePower};
129const ShotGoal kFlippedMediumShotGoal = {
130 {0.865, kShootSeparation}, 120, 0.2, kIntakePower};
131// 3/4" plunger {0.80, kShootSeparation}, 105, 0.2, kIntakePower};
132
133// Shot from the fender.
134const ShotGoal kFenderShotGoal = {
135 {-0.68, kShootSeparation}, 115.0, 0.0, kIntakePower};
136const ShotGoal kFlippedShortShotGoal = {
137 {0.63, kShootSeparation}, 115.0, 0.0, kIntakePower};
138
139const ShotGoal kHumanShotGoal = {
140 {-0.90, kShootSeparation}, 140, 0.04, kIntakePower};
141const ShotGoal kFlippedHumanShotGoal = {
142 {0.90, kShootSeparation}, 140, 0, kIntakePower};
143const ShotGoal kTrussShotGoal = {
144 {-0.68, kShootSeparation}, 88.0, 0.4, kIntakePower};
145const ShotGoal kFlippedTrussShotGoal = {
146 {0.68, kShootSeparation}, 92.0, 0.4, kIntakePower};
147
148const ShotGoal kFlippedDemoShotGoal = {
149 {1.0, kShootSeparation}, 65.0, 0.0, kIntakePower};
150const ShotGoal kDemoShotGoal = {
151 {-1.0, kShootSeparation}, 50.0, 0.0, kIntakePower};
152
153const ClawGoal k254PassGoal = {-1.95, kGrabSeparation};
154const ClawGoal kFlipped254PassGoal = {1.96, kGrabSeparation};
155
Austin Schuhbfb04122019-05-22 21:16:51 -0700156class Reader : public ::aos::input::ActionJoystickInput {
Brian Silverman17f503e2015-08-02 18:17:18 -0700157 public:
Austin Schuh3e45c752019-02-02 12:19:11 -0800158 Reader(::aos::EventLoop *event_loop)
Austin Schuhbfb04122019-05-22 21:16:51 -0700159 : ::aos::input::ActionJoystickInput(
160 event_loop, control_loops::GetDrivetrainConfig(),
161 ::aos::input::DrivetrainInputReader::InputType::kSteeringWheel, {}),
Austin Schuhb2461f42019-06-29 18:17:06 -0700162 claw_status_fetcher_(
163 event_loop->MakeFetcher<::y2014::control_loops::ClawQueue::Status>(
164 ".y2014.control_loops.claw_queue.status")),
165 claw_goal_sender_(
166 event_loop->MakeSender<::y2014::control_loops::ClawQueue::Goal>(
167 ".y2014.control_loops.claw_queue.goal")),
Brian Silverman17f503e2015-08-02 18:17:18 -0700168 shot_power_(80.0),
169 goal_angle_(0.0),
170 separation_angle_(kGrabSeparation),
171 velocity_compensation_(0.0),
Austin Schuh1bf8a212019-05-26 22:13:14 -0700172 intake_power_(0.0),
173 shoot_action_factory_(actors::ShootActor::MakeFactory(event_loop)) {}
Brian Silverman17f503e2015-08-02 18:17:18 -0700174
175 void SetGoal(ClawGoal goal) {
176 goal_angle_ = goal.angle;
177 separation_angle_ = goal.separation;
178 moving_for_shot_ = false;
179 velocity_compensation_ = 0.0;
180 intake_power_ = 0.0;
181 }
182
183 void SetGoal(ShotGoal goal) {
184 goal_angle_ = goal.claw.angle;
185 shot_separation_angle_ = goal.claw.separation;
186 separation_angle_ = kGrabSeparation;
187 moving_for_shot_ = true;
188 shot_power_ = goal.shot_power;
189 velocity_compensation_ = goal.velocity_compensation;
190 intake_power_ = goal.intake_power;
191 }
192
Austin Schuhbfb04122019-05-22 21:16:51 -0700193 void HandleTeleop(const ::aos::input::driver_station::Data &data) override {
Brian Silverman17f503e2015-08-02 18:17:18 -0700194 if (data.IsPressed(kRollersIn) || data.IsPressed(kRollersOut)) {
195 intake_power_ = 0.0;
196 separation_angle_ = kGrabSeparation;
197 moving_for_shot_ = false;
198 }
199
200 static const double kAdjustClawGoalDeadband = 0.08;
201 double claw_goal_adjust = data.GetAxis(kAdjustClawGoal);
202 if (OLD_DS || ::std::abs(claw_goal_adjust) < kAdjustClawGoalDeadband) {
203 claw_goal_adjust = 0;
204 } else {
205 claw_goal_adjust = (claw_goal_adjust -
206 ((claw_goal_adjust < 0) ? -kAdjustClawGoalDeadband
207 : kAdjustClawGoalDeadband)) *
208 0.035;
209 }
210 double claw_separation_adjust = data.GetAxis(kAdjustClawSeparation);
211 if (OLD_DS ||
212 ::std::abs(claw_separation_adjust) < kAdjustClawGoalDeadband) {
213 claw_separation_adjust = 0;
214 } else {
215 claw_separation_adjust =
216 (claw_separation_adjust -
217 ((claw_separation_adjust < 0) ? -kAdjustClawGoalDeadband
218 : kAdjustClawGoalDeadband)) *
219 -0.035;
220 }
221
222#if OLD_DS
223 if (data.IsPressed(kFenderShot)) {
224#else
225 if (data.GetAxis(kFlipRobot) > 0.9) {
226#endif
227 claw_goal_adjust += claw_separation_adjust;
228 claw_goal_adjust *= -1;
229
230 if (data.IsPressed(kIntakeOpenPosition)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700231 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700232 LOG(DEBUG, "Canceling\n");
233 SetGoal(kFlippedIntakeOpenGoal);
234 } else if (data.IsPressed(kIntakePosition)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700235 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700236 LOG(DEBUG, "Canceling\n");
237 SetGoal(kFlippedIntakeGoal);
238 } else if (data.IsPressed(kVerticalTuck)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700239 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700240 LOG(DEBUG, "Canceling\n");
241 SetGoal(kVerticalTuckGoal);
242 } else if (data.IsPressed(kTuck)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700243 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700244 LOG(DEBUG, "Canceling\n");
245 SetGoal(kFlippedTuckGoal);
246 } else if (data.PosEdge(kLongShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700247 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700248 LOG(DEBUG, "Canceling\n");
249 SetGoal(kFlippedLongShotGoal);
250 } else if (data.PosEdge(kCloseShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700251 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700252 LOG(DEBUG, "Canceling\n");
253 SetGoal(kFlippedMediumShotGoal);
254 } else if (data.PosEdge(kFenderShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700255 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700256 LOG(DEBUG, "Canceling\n");
257 SetGoal(kFlippedShortShotGoal);
258 } else if (data.PosEdge(kHumanPlayerShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700259 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700260 LOG(DEBUG, "Canceling\n");
261 SetGoal(kFlippedHumanShotGoal);
262 } else if (data.PosEdge(kUserLeft)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700263 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700264 LOG(DEBUG, "Canceling\n");
265 SetGoal(kFlipped254PassGoal);
266 } else if (data.PosEdge(kUserRight)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700267 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700268 LOG(DEBUG, "Canceling\n");
269 SetGoal(kFlippedDemoShotGoal);
270 } else if (data.PosEdge(kTrussShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700271 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700272 LOG(DEBUG, "Canceling\n");
273 SetGoal(kFlippedTrussShotGoal);
274 }
275 } else {
276 if (data.IsPressed(kIntakeOpenPosition)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700277 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700278 LOG(DEBUG, "Canceling\n");
279 SetGoal(kIntakeOpenGoal);
280 } else if (data.IsPressed(kIntakePosition)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700281 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700282 LOG(DEBUG, "Canceling\n");
283 SetGoal(kIntakeGoal);
284 } else if (data.IsPressed(kVerticalTuck)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700285 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700286 LOG(DEBUG, "Canceling\n");
287 SetGoal(kVerticalTuckGoal);
288 } else if (data.IsPressed(kTuck)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700289 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700290 LOG(DEBUG, "Canceling\n");
291 SetGoal(kTuckGoal);
292 } else if (data.PosEdge(kLongShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700293 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700294 LOG(DEBUG, "Canceling\n");
295 SetGoal(kLongShotGoal);
296 } else if (data.PosEdge(kCloseShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700297 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700298 LOG(DEBUG, "Canceling\n");
299 SetGoal(kCloseShotGoal);
300 } else if (data.PosEdge(kFenderShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700301 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700302 LOG(DEBUG, "Canceling\n");
303 SetGoal(kFenderShotGoal);
304 } else if (data.PosEdge(kHumanPlayerShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700305 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700306 LOG(DEBUG, "Canceling\n");
307 SetGoal(kHumanShotGoal);
308 } else if (data.PosEdge(kUserLeft)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700309 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700310 LOG(DEBUG, "Canceling\n");
311 SetGoal(k254PassGoal);
312 } else if (data.PosEdge(kUserRight)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700313 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700314 LOG(DEBUG, "Canceling\n");
315 SetGoal(kDemoShotGoal);
316 } else if (data.PosEdge(kTrussShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700317 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700318 LOG(DEBUG, "Canceling\n");
319 SetGoal(kTrussShotGoal);
320 }
321 }
322
323 if (data.PosEdge(kFire)) {
Austin Schuh1bf8a212019-05-26 22:13:14 -0700324 EnqueueAction(shoot_action_factory_.Make(0.0));
Brian Silverman17f503e2015-08-02 18:17:18 -0700325 } else if (data.NegEdge(kFire)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700326 CancelCurrentAction();
Brian Silverman17f503e2015-08-02 18:17:18 -0700327 }
328
Brian Silverman17f503e2015-08-02 18:17:18 -0700329 if (data.IsPressed(kUnload) || data.IsPressed(kReload)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700330 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700331 LOG(DEBUG, "Canceling\n");
332 intake_power_ = 0.0;
333 velocity_compensation_ = 0.0;
334 }
335
336 // Send out the claw and shooter goals if no actions are running.
Austin Schuhbfb04122019-05-22 21:16:51 -0700337 if (!ActionRunning()) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700338 goal_angle_ += claw_goal_adjust;
339 separation_angle_ += claw_separation_adjust;
340
341 // If the action just ended, turn the intake off and stop velocity
342 // compensating.
Austin Schuhbfb04122019-05-22 21:16:51 -0700343 if (was_running_action()) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700344 intake_power_ = 0.0;
345 velocity_compensation_ = 0.0;
346 }
347
Comran Morshed5323ecb2015-12-26 20:50:55 +0000348 ::frc971::control_loops::drivetrain_queue.status.FetchLatest();
Brian Silverman17f503e2015-08-02 18:17:18 -0700349 double goal_angle = goal_angle_;
Comran Morshed5323ecb2015-12-26 20:50:55 +0000350 if (::frc971::control_loops::drivetrain_queue.status.get()) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700351 goal_angle += SpeedToAngleOffset(
Comran Morshed5323ecb2015-12-26 20:50:55 +0000352 ::frc971::control_loops::drivetrain_queue.status->robot_speed);
Brian Silverman17f503e2015-08-02 18:17:18 -0700353 } else {
354 LOG_INTERVAL(no_drivetrain_status_);
355 }
356
357 if (moving_for_shot_) {
Austin Schuhb2461f42019-06-29 18:17:06 -0700358 claw_status_fetcher_.Fetch();
359 if (claw_status_fetcher_.get()) {
360 if (::std::abs(claw_status_fetcher_->bottom - goal_angle) < 0.2) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700361 moving_for_shot_ = false;
362 separation_angle_ = shot_separation_angle_;
363 }
364 }
365 }
366
367 double separation_angle = separation_angle_;
368
369 if (data.IsPressed(kCatch)) {
370 const double kCatchSeparation = 1.0;
371 goal_angle -= kCatchSeparation / 2.0;
372 separation_angle = kCatchSeparation;
373 }
374
375 bool intaking =
376 data.IsPressed(kRollersIn) || data.IsPressed(kIntakePosition) ||
377 data.IsPressed(kIntakeOpenPosition) || data.IsPressed(kCatch);
Austin Schuhb2461f42019-06-29 18:17:06 -0700378 {
379 auto goal_message = claw_goal_sender_.MakeMessage();
380 goal_message->bottom_angle = goal_angle;
381 goal_message->separation_angle = separation_angle;
382 goal_message->intake =
383 intaking ? 12.0
384 : (data.IsPressed(kRollersOut) ? -12.0 : intake_power_);
385 goal_message->centering = intaking ? 12.0 : 0.0;
386
387 if (!goal_message.Send()) {
388 LOG(WARNING, "sending claw goal failed\n");
389 }
Brian Silverman17f503e2015-08-02 18:17:18 -0700390 }
391
392 if (!control_loops::shooter_queue.goal.MakeWithBuilder()
393 .shot_power(shot_power_)
394 .shot_requested(data.IsPressed(kFire))
395 .unload_requested(data.IsPressed(kUnload))
396 .load_requested(data.IsPressed(kReload))
397 .Send()) {
398 LOG(WARNING, "sending shooter goal failed\n");
399 }
400 }
Brian Silverman17f503e2015-08-02 18:17:18 -0700401 }
402
403 double SpeedToAngleOffset(double speed) {
Brian Silvermanb601d892015-12-20 18:24:38 -0500404 const ::y2014::constants::Values &values = ::y2014::constants::GetValues();
Brian Silverman17f503e2015-08-02 18:17:18 -0700405 // scale speed to a [0.0-1.0] on something close to the max
406 // TODO(austin): Change the scale factor for different shots.
407 return (speed / values.drivetrain_max_speed) * velocity_compensation_;
408 }
409
410 private:
Austin Schuhb2461f42019-06-29 18:17:06 -0700411 ::aos::Fetcher<::y2014::control_loops::ClawQueue::Status>
412 claw_status_fetcher_;
413 ::aos::Sender<::y2014::control_loops::ClawQueue::Goal> claw_goal_sender_;
414
Brian Silverman17f503e2015-08-02 18:17:18 -0700415 double shot_power_;
416 double goal_angle_;
417 double separation_angle_, shot_separation_angle_;
418 double velocity_compensation_;
419 double intake_power_;
Brian Silverman17f503e2015-08-02 18:17:18 -0700420 bool moving_for_shot_ = false;
421
Austin Schuh1bf8a212019-05-26 22:13:14 -0700422 actors::ShootActor::Factory shoot_action_factory_;
423
Brian Silverman17f503e2015-08-02 18:17:18 -0700424 ::aos::util::SimpleLogInterval no_drivetrain_status_ =
Austin Schuh61bdc602016-12-04 19:10:10 -0800425 ::aos::util::SimpleLogInterval(::std::chrono::milliseconds(200), WARNING,
Brian Silverman17f503e2015-08-02 18:17:18 -0700426 "no drivetrain status");
427};
428
429} // namespace joysticks
430} // namespace input
Brian Silvermanb601d892015-12-20 18:24:38 -0500431} // namespace y2014
Brian Silverman17f503e2015-08-02 18:17:18 -0700432
433int main() {
Brian Silverman5090c432016-01-02 14:44:26 -0800434 ::aos::Init(-1);
Austin Schuh3e45c752019-02-02 12:19:11 -0800435 ::aos::ShmEventLoop event_loop;
436 ::y2014::input::joysticks::Reader reader(&event_loop);
Brian Silverman17f503e2015-08-02 18:17:18 -0700437 reader.Run();
438 ::aos::Cleanup();
439}