blob: cc29bcbd26098192fcadf8f9bc8d73d10a9f5d74 [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
John Park398c74a2018-10-20 21:17:39 -07006#include "aos/init.h"
Brian Silvermanc2065732015-11-28 22:55:30 +00007#include "aos/input/joystick_input.h"
John Park33858a32018-09-28 23:05:48 -07008#include "aos/input/driver_station_data.h"
9#include "aos/logging/logging.h"
10#include "aos/util/log_interval.h"
11#include "aos/time/time.h"
12#include "aos/actions/actions.h"
Brian Silverman17f503e2015-08-02 18:17:18 -070013
Comran Morshed5323ecb2015-12-26 20:50:55 +000014#include "frc971/control_loops/drivetrain/drivetrain.q.h"
Brian Silverman17f503e2015-08-02 18:17:18 -070015#include "y2014/constants.h"
16#include "frc971/queues/gyro.q.h"
17#include "frc971/autonomous/auto.q.h"
18#include "y2014/control_loops/claw/claw.q.h"
19#include "y2014/control_loops/shooter/shooter.q.h"
20#include "y2014/actors/shoot_actor.h"
21
Comran Morshed5323ecb2015-12-26 20:50:55 +000022using ::frc971::control_loops::drivetrain_queue;
Brian Silverman17f503e2015-08-02 18:17:18 -070023using ::frc971::sensors::gyro_reading;
24
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
156class Reader : public ::aos::input::JoystickInput {
157 public:
Austin Schuh3e45c752019-02-02 12:19:11 -0800158 Reader(::aos::EventLoop *event_loop)
159 : ::aos::input::JoystickInput(event_loop),
160 is_high_gear_(false),
Brian Silverman17f503e2015-08-02 18:17:18 -0700161 shot_power_(80.0),
162 goal_angle_(0.0),
163 separation_angle_(kGrabSeparation),
164 velocity_compensation_(0.0),
165 intake_power_(0.0),
166 was_running_(false) {}
167
168 void RunIteration(const ::aos::input::driver_station::Data &data) override {
169 bool last_auto_running = auto_running_;
170 auto_running_ = data.GetControlBit(ControlBit::kAutonomous) &&
171 data.GetControlBit(ControlBit::kEnabled);
172 if (auto_running_ != last_auto_running) {
173 if (auto_running_) {
174 StartAuto();
175 } else {
176 StopAuto();
177 }
178 }
179
180 if (!data.GetControlBit(ControlBit::kAutonomous)) {
181 HandleDrivetrain(data);
182 HandleTeleop(data);
183 }
184 }
185
186 void HandleDrivetrain(const ::aos::input::driver_station::Data &data) {
187 bool is_control_loop_driving = false;
188 double left_goal = 0.0;
189 double right_goal = 0.0;
190 const double wheel = -data.GetAxis(kSteeringWheel);
191 const double throttle = -data.GetAxis(kDriveThrottle);
192 const double kThrottleGain = 1.0 / 2.5;
193 if (false && (data.IsPressed(kDriveControlLoopEnable1) ||
194 data.IsPressed(kDriveControlLoopEnable2))) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700195 if (data.PosEdge(kDriveControlLoopEnable1) ||
196 data.PosEdge(kDriveControlLoopEnable2)) {
197 if (drivetrain_queue.position.FetchLatest() &&
198 gyro_reading.FetchLatest()) {
Adam Snaider418bd822016-11-26 14:49:23 -0800199 distance_ = (drivetrain_queue.position->left_encoder +
Brian Silverman17f503e2015-08-02 18:17:18 -0700200 drivetrain_queue.position->right_encoder) /
201 2.0 -
202 throttle * kThrottleGain / 2.0;
Adam Snaider418bd822016-11-26 14:49:23 -0800203 angle_ = gyro_reading->angle;
204 filtered_goal_distance_ = distance_;
Brian Silverman17f503e2015-08-02 18:17:18 -0700205 }
206 }
207 is_control_loop_driving = true;
208
209 // const double gyro_angle = Gyro.View().angle;
Adam Snaider418bd822016-11-26 14:49:23 -0800210 const double goal_theta = angle_ - wheel * 0.27;
211 const double goal_distance = distance_ + throttle * kThrottleGain;
Brian Silverman17f503e2015-08-02 18:17:18 -0700212 const double robot_width = 22.0 / 100.0 * 2.54;
213 const double kMaxVelocity = 0.6;
Adam Snaider418bd822016-11-26 14:49:23 -0800214 if (goal_distance > kMaxVelocity * 0.02 + filtered_goal_distance_) {
215 filtered_goal_distance_ += kMaxVelocity * 0.03;
Brian Silverman17f503e2015-08-02 18:17:18 -0700216 } else if (goal_distance <
Adam Snaider418bd822016-11-26 14:49:23 -0800217 -kMaxVelocity * 0.02 + filtered_goal_distance_) {
218 filtered_goal_distance_ -= kMaxVelocity * 0.02;
Brian Silverman17f503e2015-08-02 18:17:18 -0700219 } else {
Adam Snaider418bd822016-11-26 14:49:23 -0800220 filtered_goal_distance_ = goal_distance;
Brian Silverman17f503e2015-08-02 18:17:18 -0700221 }
Adam Snaider418bd822016-11-26 14:49:23 -0800222 left_goal = filtered_goal_distance_ - robot_width * goal_theta / 2.0;
223 right_goal = filtered_goal_distance_ + robot_width * goal_theta / 2.0;
Brian Silverman17f503e2015-08-02 18:17:18 -0700224 is_high_gear_ = false;
225
226 LOG(DEBUG, "Left goal %f Right goal %f\n", left_goal, right_goal);
227 }
228 if (!drivetrain_queue.goal.MakeWithBuilder()
Austin Schuh2b1fce02018-03-02 20:05:20 -0800229 .wheel(wheel)
Brian Silverman17f503e2015-08-02 18:17:18 -0700230 .throttle(throttle)
231 .highgear(is_high_gear_)
232 .quickturn(data.IsPressed(kQuickTurn))
Austin Schuh78379ea2019-01-04 20:39:45 -0800233 .controller_type(is_control_loop_driving ? 1 : 0)
Brian Silverman17f503e2015-08-02 18:17:18 -0700234 .left_goal(left_goal)
235 .right_goal(right_goal)
236 .left_velocity_goal(0)
237 .right_velocity_goal(0)
238 .Send()) {
239 LOG(WARNING, "sending stick values failed\n");
240 }
Campbell Crowley5b27f022016-02-20 16:55:35 -0800241 if (data.PosEdge(kShiftLow)) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700242 is_high_gear_ = false;
243 }
Campbell Crowley5b27f022016-02-20 16:55:35 -0800244 if (data.PosEdge(kShiftHigh)) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700245 is_high_gear_ = true;
246 }
247 }
248
249 void SetGoal(ClawGoal goal) {
250 goal_angle_ = goal.angle;
251 separation_angle_ = goal.separation;
252 moving_for_shot_ = false;
253 velocity_compensation_ = 0.0;
254 intake_power_ = 0.0;
255 }
256
257 void SetGoal(ShotGoal goal) {
258 goal_angle_ = goal.claw.angle;
259 shot_separation_angle_ = goal.claw.separation;
260 separation_angle_ = kGrabSeparation;
261 moving_for_shot_ = true;
262 shot_power_ = goal.shot_power;
263 velocity_compensation_ = goal.velocity_compensation;
264 intake_power_ = goal.intake_power;
265 }
266
267 void HandleTeleop(const ::aos::input::driver_station::Data &data) {
268 if (!data.GetControlBit(ControlBit::kEnabled)) {
269 action_queue_.CancelAllActions();
270 LOG(DEBUG, "Canceling\n");
271 }
272 if (data.IsPressed(kRollersIn) || data.IsPressed(kRollersOut)) {
273 intake_power_ = 0.0;
274 separation_angle_ = kGrabSeparation;
275 moving_for_shot_ = false;
276 }
277
278 static const double kAdjustClawGoalDeadband = 0.08;
279 double claw_goal_adjust = data.GetAxis(kAdjustClawGoal);
280 if (OLD_DS || ::std::abs(claw_goal_adjust) < kAdjustClawGoalDeadband) {
281 claw_goal_adjust = 0;
282 } else {
283 claw_goal_adjust = (claw_goal_adjust -
284 ((claw_goal_adjust < 0) ? -kAdjustClawGoalDeadband
285 : kAdjustClawGoalDeadband)) *
286 0.035;
287 }
288 double claw_separation_adjust = data.GetAxis(kAdjustClawSeparation);
289 if (OLD_DS ||
290 ::std::abs(claw_separation_adjust) < kAdjustClawGoalDeadband) {
291 claw_separation_adjust = 0;
292 } else {
293 claw_separation_adjust =
294 (claw_separation_adjust -
295 ((claw_separation_adjust < 0) ? -kAdjustClawGoalDeadband
296 : kAdjustClawGoalDeadband)) *
297 -0.035;
298 }
299
300#if OLD_DS
301 if (data.IsPressed(kFenderShot)) {
302#else
303 if (data.GetAxis(kFlipRobot) > 0.9) {
304#endif
305 claw_goal_adjust += claw_separation_adjust;
306 claw_goal_adjust *= -1;
307
308 if (data.IsPressed(kIntakeOpenPosition)) {
309 action_queue_.CancelAllActions();
310 LOG(DEBUG, "Canceling\n");
311 SetGoal(kFlippedIntakeOpenGoal);
312 } else if (data.IsPressed(kIntakePosition)) {
313 action_queue_.CancelAllActions();
314 LOG(DEBUG, "Canceling\n");
315 SetGoal(kFlippedIntakeGoal);
316 } else if (data.IsPressed(kVerticalTuck)) {
317 action_queue_.CancelAllActions();
318 LOG(DEBUG, "Canceling\n");
319 SetGoal(kVerticalTuckGoal);
320 } else if (data.IsPressed(kTuck)) {
321 action_queue_.CancelAllActions();
322 LOG(DEBUG, "Canceling\n");
323 SetGoal(kFlippedTuckGoal);
324 } else if (data.PosEdge(kLongShot)) {
325 action_queue_.CancelAllActions();
326 LOG(DEBUG, "Canceling\n");
327 SetGoal(kFlippedLongShotGoal);
328 } else if (data.PosEdge(kCloseShot)) {
329 action_queue_.CancelAllActions();
330 LOG(DEBUG, "Canceling\n");
331 SetGoal(kFlippedMediumShotGoal);
332 } else if (data.PosEdge(kFenderShot)) {
333 action_queue_.CancelAllActions();
334 LOG(DEBUG, "Canceling\n");
335 SetGoal(kFlippedShortShotGoal);
336 } else if (data.PosEdge(kHumanPlayerShot)) {
337 action_queue_.CancelAllActions();
338 LOG(DEBUG, "Canceling\n");
339 SetGoal(kFlippedHumanShotGoal);
340 } else if (data.PosEdge(kUserLeft)) {
341 action_queue_.CancelAllActions();
342 LOG(DEBUG, "Canceling\n");
343 SetGoal(kFlipped254PassGoal);
344 } else if (data.PosEdge(kUserRight)) {
345 action_queue_.CancelAllActions();
346 LOG(DEBUG, "Canceling\n");
347 SetGoal(kFlippedDemoShotGoal);
348 } else if (data.PosEdge(kTrussShot)) {
349 action_queue_.CancelAllActions();
350 LOG(DEBUG, "Canceling\n");
351 SetGoal(kFlippedTrussShotGoal);
352 }
353 } else {
354 if (data.IsPressed(kIntakeOpenPosition)) {
355 action_queue_.CancelAllActions();
356 LOG(DEBUG, "Canceling\n");
357 SetGoal(kIntakeOpenGoal);
358 } else if (data.IsPressed(kIntakePosition)) {
359 action_queue_.CancelAllActions();
360 LOG(DEBUG, "Canceling\n");
361 SetGoal(kIntakeGoal);
362 } else if (data.IsPressed(kVerticalTuck)) {
363 action_queue_.CancelAllActions();
364 LOG(DEBUG, "Canceling\n");
365 SetGoal(kVerticalTuckGoal);
366 } else if (data.IsPressed(kTuck)) {
367 action_queue_.CancelAllActions();
368 LOG(DEBUG, "Canceling\n");
369 SetGoal(kTuckGoal);
370 } else if (data.PosEdge(kLongShot)) {
371 action_queue_.CancelAllActions();
372 LOG(DEBUG, "Canceling\n");
373 SetGoal(kLongShotGoal);
374 } else if (data.PosEdge(kCloseShot)) {
375 action_queue_.CancelAllActions();
376 LOG(DEBUG, "Canceling\n");
377 SetGoal(kCloseShotGoal);
378 } else if (data.PosEdge(kFenderShot)) {
379 action_queue_.CancelAllActions();
380 LOG(DEBUG, "Canceling\n");
381 SetGoal(kFenderShotGoal);
382 } else if (data.PosEdge(kHumanPlayerShot)) {
383 action_queue_.CancelAllActions();
384 LOG(DEBUG, "Canceling\n");
385 SetGoal(kHumanShotGoal);
386 } else if (data.PosEdge(kUserLeft)) {
387 action_queue_.CancelAllActions();
388 LOG(DEBUG, "Canceling\n");
389 SetGoal(k254PassGoal);
390 } else if (data.PosEdge(kUserRight)) {
391 action_queue_.CancelAllActions();
392 LOG(DEBUG, "Canceling\n");
393 SetGoal(kDemoShotGoal);
394 } else if (data.PosEdge(kTrussShot)) {
395 action_queue_.CancelAllActions();
396 LOG(DEBUG, "Canceling\n");
397 SetGoal(kTrussShotGoal);
398 }
399 }
400
401 if (data.PosEdge(kFire)) {
402 action_queue_.EnqueueAction(actors::MakeShootAction());
403 } else if (data.NegEdge(kFire)) {
404 action_queue_.CancelCurrentAction();
405 }
406
407 action_queue_.Tick();
408 if (data.IsPressed(kUnload) || data.IsPressed(kReload)) {
409 action_queue_.CancelAllActions();
410 LOG(DEBUG, "Canceling\n");
411 intake_power_ = 0.0;
412 velocity_compensation_ = 0.0;
413 }
414
415 // Send out the claw and shooter goals if no actions are running.
416 if (!action_queue_.Running()) {
417 goal_angle_ += claw_goal_adjust;
418 separation_angle_ += claw_separation_adjust;
419
420 // If the action just ended, turn the intake off and stop velocity
421 // compensating.
422 if (was_running_) {
423 intake_power_ = 0.0;
424 velocity_compensation_ = 0.0;
425 }
426
Comran Morshed5323ecb2015-12-26 20:50:55 +0000427 ::frc971::control_loops::drivetrain_queue.status.FetchLatest();
Brian Silverman17f503e2015-08-02 18:17:18 -0700428 double goal_angle = goal_angle_;
Comran Morshed5323ecb2015-12-26 20:50:55 +0000429 if (::frc971::control_loops::drivetrain_queue.status.get()) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700430 goal_angle += SpeedToAngleOffset(
Comran Morshed5323ecb2015-12-26 20:50:55 +0000431 ::frc971::control_loops::drivetrain_queue.status->robot_speed);
Brian Silverman17f503e2015-08-02 18:17:18 -0700432 } else {
433 LOG_INTERVAL(no_drivetrain_status_);
434 }
435
436 if (moving_for_shot_) {
437 auto &claw_status = control_loops::claw_queue.status;
438 claw_status.FetchLatest();
439 if (claw_status.get()) {
440 if (::std::abs(claw_status->bottom - goal_angle) < 0.2) {
441 moving_for_shot_ = false;
442 separation_angle_ = shot_separation_angle_;
443 }
444 }
445 }
446
447 double separation_angle = separation_angle_;
448
449 if (data.IsPressed(kCatch)) {
450 const double kCatchSeparation = 1.0;
451 goal_angle -= kCatchSeparation / 2.0;
452 separation_angle = kCatchSeparation;
453 }
454
455 bool intaking =
456 data.IsPressed(kRollersIn) || data.IsPressed(kIntakePosition) ||
457 data.IsPressed(kIntakeOpenPosition) || data.IsPressed(kCatch);
458 if (!control_loops::claw_queue.goal.MakeWithBuilder()
459 .bottom_angle(goal_angle)
460 .separation_angle(separation_angle)
461 .intake(intaking ? 12.0
462 : (data.IsPressed(kRollersOut) ? -12.0
463 : intake_power_))
464 .centering(intaking ? 12.0 : 0.0)
465 .Send()) {
466 LOG(WARNING, "sending claw goal failed\n");
467 }
468
469 if (!control_loops::shooter_queue.goal.MakeWithBuilder()
470 .shot_power(shot_power_)
471 .shot_requested(data.IsPressed(kFire))
472 .unload_requested(data.IsPressed(kUnload))
473 .load_requested(data.IsPressed(kReload))
474 .Send()) {
475 LOG(WARNING, "sending shooter goal failed\n");
476 }
477 }
478 was_running_ = action_queue_.Running();
479 }
480
481 double SpeedToAngleOffset(double speed) {
Brian Silvermanb601d892015-12-20 18:24:38 -0500482 const ::y2014::constants::Values &values = ::y2014::constants::GetValues();
Brian Silverman17f503e2015-08-02 18:17:18 -0700483 // scale speed to a [0.0-1.0] on something close to the max
484 // TODO(austin): Change the scale factor for different shots.
485 return (speed / values.drivetrain_max_speed) * velocity_compensation_;
486 }
487
488 private:
489 void StartAuto() {
490 LOG(INFO, "Starting auto mode\n");
491 ::frc971::autonomous::autonomous.MakeWithBuilder().run_auto(true).Send();
492 }
493
494 void StopAuto() {
495 LOG(INFO, "Stopping auto mode\n");
496 ::frc971::autonomous::autonomous.MakeWithBuilder().run_auto(false).Send();
497 }
498
499 bool is_high_gear_;
500 double shot_power_;
501 double goal_angle_;
502 double separation_angle_, shot_separation_angle_;
503 double velocity_compensation_;
Adam Snaidera3271fe2016-10-26 21:03:38 -0700504 // Distance, angle, and filtered goal for closed loop driving.
Adam Snaider418bd822016-11-26 14:49:23 -0800505 double distance_;
506 double angle_;
507 double filtered_goal_distance_;
Brian Silverman17f503e2015-08-02 18:17:18 -0700508 double intake_power_;
509 bool was_running_;
510 bool moving_for_shot_ = false;
511
512 bool auto_running_ = false;
Brian Silvermanb601d892015-12-20 18:24:38 -0500513
Brian Silverman17f503e2015-08-02 18:17:18 -0700514 ::aos::common::actions::ActionQueue action_queue_;
515
516 ::aos::util::SimpleLogInterval no_drivetrain_status_ =
Austin Schuh61bdc602016-12-04 19:10:10 -0800517 ::aos::util::SimpleLogInterval(::std::chrono::milliseconds(200), WARNING,
Brian Silverman17f503e2015-08-02 18:17:18 -0700518 "no drivetrain status");
519};
520
521} // namespace joysticks
522} // namespace input
Brian Silvermanb601d892015-12-20 18:24:38 -0500523} // namespace y2014
Brian Silverman17f503e2015-08-02 18:17:18 -0700524
525int main() {
Brian Silverman5090c432016-01-02 14:44:26 -0800526 ::aos::Init(-1);
Austin Schuh3e45c752019-02-02 12:19:11 -0800527 ::aos::ShmEventLoop event_loop;
528 ::y2014::input::joysticks::Reader reader(&event_loop);
Brian Silverman17f503e2015-08-02 18:17:18 -0700529 reader.Run();
530 ::aos::Cleanup();
531}