blob: 9c32aa470442cd64c2f3c67c95d34031f27627df [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)
Brian Silverman17f503e2015-08-02 18:17:18 -0700236 .Send()) {
237 LOG(WARNING, "sending stick values failed\n");
238 }
Campbell Crowley5b27f022016-02-20 16:55:35 -0800239 if (data.PosEdge(kShiftLow)) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700240 is_high_gear_ = false;
241 }
Campbell Crowley5b27f022016-02-20 16:55:35 -0800242 if (data.PosEdge(kShiftHigh)) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700243 is_high_gear_ = true;
244 }
245 }
246
247 void SetGoal(ClawGoal goal) {
248 goal_angle_ = goal.angle;
249 separation_angle_ = goal.separation;
250 moving_for_shot_ = false;
251 velocity_compensation_ = 0.0;
252 intake_power_ = 0.0;
253 }
254
255 void SetGoal(ShotGoal goal) {
256 goal_angle_ = goal.claw.angle;
257 shot_separation_angle_ = goal.claw.separation;
258 separation_angle_ = kGrabSeparation;
259 moving_for_shot_ = true;
260 shot_power_ = goal.shot_power;
261 velocity_compensation_ = goal.velocity_compensation;
262 intake_power_ = goal.intake_power;
263 }
264
265 void HandleTeleop(const ::aos::input::driver_station::Data &data) {
266 if (!data.GetControlBit(ControlBit::kEnabled)) {
267 action_queue_.CancelAllActions();
268 LOG(DEBUG, "Canceling\n");
269 }
270 if (data.IsPressed(kRollersIn) || data.IsPressed(kRollersOut)) {
271 intake_power_ = 0.0;
272 separation_angle_ = kGrabSeparation;
273 moving_for_shot_ = false;
274 }
275
276 static const double kAdjustClawGoalDeadband = 0.08;
277 double claw_goal_adjust = data.GetAxis(kAdjustClawGoal);
278 if (OLD_DS || ::std::abs(claw_goal_adjust) < kAdjustClawGoalDeadband) {
279 claw_goal_adjust = 0;
280 } else {
281 claw_goal_adjust = (claw_goal_adjust -
282 ((claw_goal_adjust < 0) ? -kAdjustClawGoalDeadband
283 : kAdjustClawGoalDeadband)) *
284 0.035;
285 }
286 double claw_separation_adjust = data.GetAxis(kAdjustClawSeparation);
287 if (OLD_DS ||
288 ::std::abs(claw_separation_adjust) < kAdjustClawGoalDeadband) {
289 claw_separation_adjust = 0;
290 } else {
291 claw_separation_adjust =
292 (claw_separation_adjust -
293 ((claw_separation_adjust < 0) ? -kAdjustClawGoalDeadband
294 : kAdjustClawGoalDeadband)) *
295 -0.035;
296 }
297
298#if OLD_DS
299 if (data.IsPressed(kFenderShot)) {
300#else
301 if (data.GetAxis(kFlipRobot) > 0.9) {
302#endif
303 claw_goal_adjust += claw_separation_adjust;
304 claw_goal_adjust *= -1;
305
306 if (data.IsPressed(kIntakeOpenPosition)) {
307 action_queue_.CancelAllActions();
308 LOG(DEBUG, "Canceling\n");
309 SetGoal(kFlippedIntakeOpenGoal);
310 } else if (data.IsPressed(kIntakePosition)) {
311 action_queue_.CancelAllActions();
312 LOG(DEBUG, "Canceling\n");
313 SetGoal(kFlippedIntakeGoal);
314 } else if (data.IsPressed(kVerticalTuck)) {
315 action_queue_.CancelAllActions();
316 LOG(DEBUG, "Canceling\n");
317 SetGoal(kVerticalTuckGoal);
318 } else if (data.IsPressed(kTuck)) {
319 action_queue_.CancelAllActions();
320 LOG(DEBUG, "Canceling\n");
321 SetGoal(kFlippedTuckGoal);
322 } else if (data.PosEdge(kLongShot)) {
323 action_queue_.CancelAllActions();
324 LOG(DEBUG, "Canceling\n");
325 SetGoal(kFlippedLongShotGoal);
326 } else if (data.PosEdge(kCloseShot)) {
327 action_queue_.CancelAllActions();
328 LOG(DEBUG, "Canceling\n");
329 SetGoal(kFlippedMediumShotGoal);
330 } else if (data.PosEdge(kFenderShot)) {
331 action_queue_.CancelAllActions();
332 LOG(DEBUG, "Canceling\n");
333 SetGoal(kFlippedShortShotGoal);
334 } else if (data.PosEdge(kHumanPlayerShot)) {
335 action_queue_.CancelAllActions();
336 LOG(DEBUG, "Canceling\n");
337 SetGoal(kFlippedHumanShotGoal);
338 } else if (data.PosEdge(kUserLeft)) {
339 action_queue_.CancelAllActions();
340 LOG(DEBUG, "Canceling\n");
341 SetGoal(kFlipped254PassGoal);
342 } else if (data.PosEdge(kUserRight)) {
343 action_queue_.CancelAllActions();
344 LOG(DEBUG, "Canceling\n");
345 SetGoal(kFlippedDemoShotGoal);
346 } else if (data.PosEdge(kTrussShot)) {
347 action_queue_.CancelAllActions();
348 LOG(DEBUG, "Canceling\n");
349 SetGoal(kFlippedTrussShotGoal);
350 }
351 } else {
352 if (data.IsPressed(kIntakeOpenPosition)) {
353 action_queue_.CancelAllActions();
354 LOG(DEBUG, "Canceling\n");
355 SetGoal(kIntakeOpenGoal);
356 } else if (data.IsPressed(kIntakePosition)) {
357 action_queue_.CancelAllActions();
358 LOG(DEBUG, "Canceling\n");
359 SetGoal(kIntakeGoal);
360 } else if (data.IsPressed(kVerticalTuck)) {
361 action_queue_.CancelAllActions();
362 LOG(DEBUG, "Canceling\n");
363 SetGoal(kVerticalTuckGoal);
364 } else if (data.IsPressed(kTuck)) {
365 action_queue_.CancelAllActions();
366 LOG(DEBUG, "Canceling\n");
367 SetGoal(kTuckGoal);
368 } else if (data.PosEdge(kLongShot)) {
369 action_queue_.CancelAllActions();
370 LOG(DEBUG, "Canceling\n");
371 SetGoal(kLongShotGoal);
372 } else if (data.PosEdge(kCloseShot)) {
373 action_queue_.CancelAllActions();
374 LOG(DEBUG, "Canceling\n");
375 SetGoal(kCloseShotGoal);
376 } else if (data.PosEdge(kFenderShot)) {
377 action_queue_.CancelAllActions();
378 LOG(DEBUG, "Canceling\n");
379 SetGoal(kFenderShotGoal);
380 } else if (data.PosEdge(kHumanPlayerShot)) {
381 action_queue_.CancelAllActions();
382 LOG(DEBUG, "Canceling\n");
383 SetGoal(kHumanShotGoal);
384 } else if (data.PosEdge(kUserLeft)) {
385 action_queue_.CancelAllActions();
386 LOG(DEBUG, "Canceling\n");
387 SetGoal(k254PassGoal);
388 } else if (data.PosEdge(kUserRight)) {
389 action_queue_.CancelAllActions();
390 LOG(DEBUG, "Canceling\n");
391 SetGoal(kDemoShotGoal);
392 } else if (data.PosEdge(kTrussShot)) {
393 action_queue_.CancelAllActions();
394 LOG(DEBUG, "Canceling\n");
395 SetGoal(kTrussShotGoal);
396 }
397 }
398
399 if (data.PosEdge(kFire)) {
400 action_queue_.EnqueueAction(actors::MakeShootAction());
401 } else if (data.NegEdge(kFire)) {
402 action_queue_.CancelCurrentAction();
403 }
404
405 action_queue_.Tick();
406 if (data.IsPressed(kUnload) || data.IsPressed(kReload)) {
407 action_queue_.CancelAllActions();
408 LOG(DEBUG, "Canceling\n");
409 intake_power_ = 0.0;
410 velocity_compensation_ = 0.0;
411 }
412
413 // Send out the claw and shooter goals if no actions are running.
414 if (!action_queue_.Running()) {
415 goal_angle_ += claw_goal_adjust;
416 separation_angle_ += claw_separation_adjust;
417
418 // If the action just ended, turn the intake off and stop velocity
419 // compensating.
420 if (was_running_) {
421 intake_power_ = 0.0;
422 velocity_compensation_ = 0.0;
423 }
424
Comran Morshed5323ecb2015-12-26 20:50:55 +0000425 ::frc971::control_loops::drivetrain_queue.status.FetchLatest();
Brian Silverman17f503e2015-08-02 18:17:18 -0700426 double goal_angle = goal_angle_;
Comran Morshed5323ecb2015-12-26 20:50:55 +0000427 if (::frc971::control_loops::drivetrain_queue.status.get()) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700428 goal_angle += SpeedToAngleOffset(
Comran Morshed5323ecb2015-12-26 20:50:55 +0000429 ::frc971::control_loops::drivetrain_queue.status->robot_speed);
Brian Silverman17f503e2015-08-02 18:17:18 -0700430 } else {
431 LOG_INTERVAL(no_drivetrain_status_);
432 }
433
434 if (moving_for_shot_) {
435 auto &claw_status = control_loops::claw_queue.status;
436 claw_status.FetchLatest();
437 if (claw_status.get()) {
438 if (::std::abs(claw_status->bottom - goal_angle) < 0.2) {
439 moving_for_shot_ = false;
440 separation_angle_ = shot_separation_angle_;
441 }
442 }
443 }
444
445 double separation_angle = separation_angle_;
446
447 if (data.IsPressed(kCatch)) {
448 const double kCatchSeparation = 1.0;
449 goal_angle -= kCatchSeparation / 2.0;
450 separation_angle = kCatchSeparation;
451 }
452
453 bool intaking =
454 data.IsPressed(kRollersIn) || data.IsPressed(kIntakePosition) ||
455 data.IsPressed(kIntakeOpenPosition) || data.IsPressed(kCatch);
456 if (!control_loops::claw_queue.goal.MakeWithBuilder()
457 .bottom_angle(goal_angle)
458 .separation_angle(separation_angle)
459 .intake(intaking ? 12.0
460 : (data.IsPressed(kRollersOut) ? -12.0
461 : intake_power_))
462 .centering(intaking ? 12.0 : 0.0)
463 .Send()) {
464 LOG(WARNING, "sending claw goal failed\n");
465 }
466
467 if (!control_loops::shooter_queue.goal.MakeWithBuilder()
468 .shot_power(shot_power_)
469 .shot_requested(data.IsPressed(kFire))
470 .unload_requested(data.IsPressed(kUnload))
471 .load_requested(data.IsPressed(kReload))
472 .Send()) {
473 LOG(WARNING, "sending shooter goal failed\n");
474 }
475 }
476 was_running_ = action_queue_.Running();
477 }
478
479 double SpeedToAngleOffset(double speed) {
Brian Silvermanb601d892015-12-20 18:24:38 -0500480 const ::y2014::constants::Values &values = ::y2014::constants::GetValues();
Brian Silverman17f503e2015-08-02 18:17:18 -0700481 // scale speed to a [0.0-1.0] on something close to the max
482 // TODO(austin): Change the scale factor for different shots.
483 return (speed / values.drivetrain_max_speed) * velocity_compensation_;
484 }
485
486 private:
487 void StartAuto() {
488 LOG(INFO, "Starting auto mode\n");
489 ::frc971::autonomous::autonomous.MakeWithBuilder().run_auto(true).Send();
490 }
491
492 void StopAuto() {
493 LOG(INFO, "Stopping auto mode\n");
494 ::frc971::autonomous::autonomous.MakeWithBuilder().run_auto(false).Send();
495 }
496
497 bool is_high_gear_;
498 double shot_power_;
499 double goal_angle_;
500 double separation_angle_, shot_separation_angle_;
501 double velocity_compensation_;
Adam Snaidera3271fe2016-10-26 21:03:38 -0700502 // Distance, angle, and filtered goal for closed loop driving.
Adam Snaider418bd822016-11-26 14:49:23 -0800503 double distance_;
504 double angle_;
505 double filtered_goal_distance_;
Brian Silverman17f503e2015-08-02 18:17:18 -0700506 double intake_power_;
507 bool was_running_;
508 bool moving_for_shot_ = false;
509
510 bool auto_running_ = false;
Brian Silvermanb601d892015-12-20 18:24:38 -0500511
Brian Silverman17f503e2015-08-02 18:17:18 -0700512 ::aos::common::actions::ActionQueue action_queue_;
513
514 ::aos::util::SimpleLogInterval no_drivetrain_status_ =
Austin Schuh61bdc602016-12-04 19:10:10 -0800515 ::aos::util::SimpleLogInterval(::std::chrono::milliseconds(200), WARNING,
Brian Silverman17f503e2015-08-02 18:17:18 -0700516 "no drivetrain status");
517};
518
519} // namespace joysticks
520} // namespace input
Brian Silvermanb601d892015-12-20 18:24:38 -0500521} // namespace y2014
Brian Silverman17f503e2015-08-02 18:17:18 -0700522
523int main() {
Brian Silverman5090c432016-01-02 14:44:26 -0800524 ::aos::Init(-1);
Austin Schuh3e45c752019-02-02 12:19:11 -0800525 ::aos::ShmEventLoop event_loop;
526 ::y2014::input::joysticks::Reader reader(&event_loop);
Brian Silverman17f503e2015-08-02 18:17:18 -0700527 reader.Run();
528 ::aos::Cleanup();
529}