blob: 24ac3122d48b7b918cf31e9c7dd23e9fa97a56b3 [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
Brian Silverman17f503e2015-08-02 18:17:18 -070023using ::aos::input::driver_station::ButtonLocation;
24using ::aos::input::driver_station::JoystickAxis;
25using ::aos::input::driver_station::ControlBit;
26
27#define OLD_DS 0
28
Brian Silvermanb601d892015-12-20 18:24:38 -050029namespace y2014 {
Brian Silverman17f503e2015-08-02 18:17:18 -070030namespace input {
31namespace joysticks {
32
33const ButtonLocation kDriveControlLoopEnable1(1, 7),
34 kDriveControlLoopEnable2(1, 11);
35const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
Campbell Crowley5b27f022016-02-20 16:55:35 -080036const ButtonLocation kShiftHigh(2, 3), kShiftLow(2, 1);
Brian Silverman17f503e2015-08-02 18:17:18 -070037const ButtonLocation kQuickTurn(1, 5);
38
39const ButtonLocation kCatch(3, 10);
40
41#if OLD_DS
42const ButtonLocation kFire(3, 11);
43const ButtonLocation kUnload(1, 4);
44const ButtonLocation kReload(1, 2);
45
46const ButtonLocation kRollersOut(3, 12);
47const ButtonLocation kRollersIn(3, 7);
48
49const ButtonLocation kTuck(3, 9);
50const ButtonLocation kIntakePosition(3, 8);
51const ButtonLocation kIntakeOpenPosition(3, 10);
52const ButtonLocation kVerticalTuck(3, 1);
53const JoystickAxis kFlipRobot(3, 3);
54
55const ButtonLocation kLongShot(3, 5);
56const ButtonLocation kCloseShot(3, 2);
57const ButtonLocation kFenderShot(3, 3);
58const ButtonLocation kTrussShot(2, 11);
59const ButtonLocation kHumanPlayerShot(3, 2);
60#else
61const ButtonLocation kFire(3, 9);
62const ButtonLocation kUnload(1, 4);
63const ButtonLocation kReload(1, 2);
64
65const ButtonLocation kRollersOut(3, 8);
66const ButtonLocation kRollersIn(3, 3);
67
68const ButtonLocation kTuck(3, 4);
69const ButtonLocation kIntakePosition(3, 5);
70const ButtonLocation kIntakeOpenPosition(3, 11);
71const ButtonLocation kVerticalTuck(2, 6);
72const JoystickAxis kFlipRobot(3, 3);
73
74const ButtonLocation kLongShot(3, 7);
75const ButtonLocation kCloseShot(3, 6);
76const ButtonLocation kFenderShot(3, 2);
77const ButtonLocation kTrussShot(2, 11);
78const ButtonLocation kHumanPlayerShot(3, 1);
79#endif
80
81const ButtonLocation kUserLeft(2, 7);
82const ButtonLocation kUserRight(2, 10);
83
84const JoystickAxis kAdjustClawGoal(3, 2);
85const JoystickAxis kAdjustClawSeparation(3, 1);
86
87struct ClawGoal {
88 double angle;
89 double separation;
90};
91
92struct ShotGoal {
93 ClawGoal claw;
94 double shot_power;
95 double velocity_compensation;
96 double intake_power;
97};
98
99const double kIntakePower = 4.0;
100// In case we have to quickly adjust it.
101const double kGrabSeparation = 0;
102const double kShootSeparation = 0.11 + kGrabSeparation;
103
104const ClawGoal kTuckGoal = {-2.273474, -0.749484};
105const ClawGoal kVerticalTuckGoal = {0, kGrabSeparation};
106const ClawGoal kIntakeGoal = {-2.24, kGrabSeparation};
107const ClawGoal kIntakeOpenGoal = {-2.0, 1.1};
108
109// TODO(austin): Tune these by hand...
110const ClawGoal kFlippedTuckGoal = {2.733474, -0.75};
111const ClawGoal kFlippedIntakeGoal = {2.0, kGrabSeparation};
112const ClawGoal kFlippedIntakeOpenGoal = {0.95, 1.0};
113
114// 34" between near edge of colored line and rear edge of bumper.
115// Only works running?
116const ShotGoal kLongShotGoal = {
117 {-1.08, kShootSeparation}, 145, 0.04, kIntakePower};
118// old 34" {-1.06, kShootSeparation}, 140, 0.04, kIntakePower};
119const ShotGoal kFlippedLongShotGoal = {
120 {0.96, kShootSeparation}, 145, 0.09, kIntakePower};
121// old 34" {0.96, kShootSeparation}, 140, 0.09, kIntakePower};
122
123// 78" between near edge of colored line and rear edge of bumper.
124const ShotGoal kCloseShotGoal = {
125 {-0.95, kShootSeparation}, 105, 0.2, kIntakePower};
126// 3/4" plunger {-0.90, kShootSeparation}, 105, 0.2, kIntakePower};
127const ShotGoal kFlippedMediumShotGoal = {
128 {0.865, kShootSeparation}, 120, 0.2, kIntakePower};
129// 3/4" plunger {0.80, kShootSeparation}, 105, 0.2, kIntakePower};
130
131// Shot from the fender.
132const ShotGoal kFenderShotGoal = {
133 {-0.68, kShootSeparation}, 115.0, 0.0, kIntakePower};
134const ShotGoal kFlippedShortShotGoal = {
135 {0.63, kShootSeparation}, 115.0, 0.0, kIntakePower};
136
137const ShotGoal kHumanShotGoal = {
138 {-0.90, kShootSeparation}, 140, 0.04, kIntakePower};
139const ShotGoal kFlippedHumanShotGoal = {
140 {0.90, kShootSeparation}, 140, 0, kIntakePower};
141const ShotGoal kTrussShotGoal = {
142 {-0.68, kShootSeparation}, 88.0, 0.4, kIntakePower};
143const ShotGoal kFlippedTrussShotGoal = {
144 {0.68, kShootSeparation}, 92.0, 0.4, kIntakePower};
145
146const ShotGoal kFlippedDemoShotGoal = {
147 {1.0, kShootSeparation}, 65.0, 0.0, kIntakePower};
148const ShotGoal kDemoShotGoal = {
149 {-1.0, kShootSeparation}, 50.0, 0.0, kIntakePower};
150
151const ClawGoal k254PassGoal = {-1.95, kGrabSeparation};
152const ClawGoal kFlipped254PassGoal = {1.96, kGrabSeparation};
153
Austin Schuhbfb04122019-05-22 21:16:51 -0700154class Reader : public ::aos::input::ActionJoystickInput {
Brian Silverman17f503e2015-08-02 18:17:18 -0700155 public:
Austin Schuh3e45c752019-02-02 12:19:11 -0800156 Reader(::aos::EventLoop *event_loop)
Austin Schuhbfb04122019-05-22 21:16:51 -0700157 : ::aos::input::ActionJoystickInput(
158 event_loop, control_loops::GetDrivetrainConfig(),
159 ::aos::input::DrivetrainInputReader::InputType::kSteeringWheel, {}),
Austin Schuhb2461f42019-06-29 18:17:06 -0700160 claw_status_fetcher_(
161 event_loop->MakeFetcher<::y2014::control_loops::ClawQueue::Status>(
162 ".y2014.control_loops.claw_queue.status")),
163 claw_goal_sender_(
164 event_loop->MakeSender<::y2014::control_loops::ClawQueue::Goal>(
165 ".y2014.control_loops.claw_queue.goal")),
Austin Schuh493f7af2019-06-29 18:42:12 -0700166 shooter_goal_sender_(
167 event_loop->MakeSender<::y2014::control_loops::ShooterQueue::Goal>(
168 ".y2014.control_loops.shooter_queue.goal")),
Austin Schuhbd0a40f2019-06-30 14:56:31 -0700169 drivetrain_status_fetcher_(
170 event_loop
171 ->MakeFetcher<::frc971::control_loops::DrivetrainQueue::Status>(
172 ".frc971.control_loops.drivetrain_queue.status")),
Brian Silverman17f503e2015-08-02 18:17:18 -0700173 shot_power_(80.0),
174 goal_angle_(0.0),
175 separation_angle_(kGrabSeparation),
176 velocity_compensation_(0.0),
Austin Schuh1bf8a212019-05-26 22:13:14 -0700177 intake_power_(0.0),
178 shoot_action_factory_(actors::ShootActor::MakeFactory(event_loop)) {}
Brian Silverman17f503e2015-08-02 18:17:18 -0700179
180 void SetGoal(ClawGoal goal) {
181 goal_angle_ = goal.angle;
182 separation_angle_ = goal.separation;
183 moving_for_shot_ = false;
184 velocity_compensation_ = 0.0;
185 intake_power_ = 0.0;
186 }
187
188 void SetGoal(ShotGoal goal) {
189 goal_angle_ = goal.claw.angle;
190 shot_separation_angle_ = goal.claw.separation;
191 separation_angle_ = kGrabSeparation;
192 moving_for_shot_ = true;
193 shot_power_ = goal.shot_power;
194 velocity_compensation_ = goal.velocity_compensation;
195 intake_power_ = goal.intake_power;
196 }
197
Austin Schuhbfb04122019-05-22 21:16:51 -0700198 void HandleTeleop(const ::aos::input::driver_station::Data &data) override {
Brian Silverman17f503e2015-08-02 18:17:18 -0700199 if (data.IsPressed(kRollersIn) || data.IsPressed(kRollersOut)) {
200 intake_power_ = 0.0;
201 separation_angle_ = kGrabSeparation;
202 moving_for_shot_ = false;
203 }
204
205 static const double kAdjustClawGoalDeadband = 0.08;
206 double claw_goal_adjust = data.GetAxis(kAdjustClawGoal);
207 if (OLD_DS || ::std::abs(claw_goal_adjust) < kAdjustClawGoalDeadband) {
208 claw_goal_adjust = 0;
209 } else {
210 claw_goal_adjust = (claw_goal_adjust -
211 ((claw_goal_adjust < 0) ? -kAdjustClawGoalDeadband
212 : kAdjustClawGoalDeadband)) *
213 0.035;
214 }
215 double claw_separation_adjust = data.GetAxis(kAdjustClawSeparation);
216 if (OLD_DS ||
217 ::std::abs(claw_separation_adjust) < kAdjustClawGoalDeadband) {
218 claw_separation_adjust = 0;
219 } else {
220 claw_separation_adjust =
221 (claw_separation_adjust -
222 ((claw_separation_adjust < 0) ? -kAdjustClawGoalDeadband
223 : kAdjustClawGoalDeadband)) *
224 -0.035;
225 }
226
227#if OLD_DS
228 if (data.IsPressed(kFenderShot)) {
229#else
230 if (data.GetAxis(kFlipRobot) > 0.9) {
231#endif
232 claw_goal_adjust += claw_separation_adjust;
233 claw_goal_adjust *= -1;
234
235 if (data.IsPressed(kIntakeOpenPosition)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700236 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700237 LOG(DEBUG, "Canceling\n");
238 SetGoal(kFlippedIntakeOpenGoal);
239 } else if (data.IsPressed(kIntakePosition)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700240 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700241 LOG(DEBUG, "Canceling\n");
242 SetGoal(kFlippedIntakeGoal);
243 } else if (data.IsPressed(kVerticalTuck)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700244 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700245 LOG(DEBUG, "Canceling\n");
246 SetGoal(kVerticalTuckGoal);
247 } else if (data.IsPressed(kTuck)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700248 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700249 LOG(DEBUG, "Canceling\n");
250 SetGoal(kFlippedTuckGoal);
251 } else if (data.PosEdge(kLongShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700252 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700253 LOG(DEBUG, "Canceling\n");
254 SetGoal(kFlippedLongShotGoal);
255 } else if (data.PosEdge(kCloseShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700256 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700257 LOG(DEBUG, "Canceling\n");
258 SetGoal(kFlippedMediumShotGoal);
259 } else if (data.PosEdge(kFenderShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700260 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700261 LOG(DEBUG, "Canceling\n");
262 SetGoal(kFlippedShortShotGoal);
263 } else if (data.PosEdge(kHumanPlayerShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700264 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700265 LOG(DEBUG, "Canceling\n");
266 SetGoal(kFlippedHumanShotGoal);
267 } else if (data.PosEdge(kUserLeft)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700268 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700269 LOG(DEBUG, "Canceling\n");
270 SetGoal(kFlipped254PassGoal);
271 } else if (data.PosEdge(kUserRight)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700272 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700273 LOG(DEBUG, "Canceling\n");
274 SetGoal(kFlippedDemoShotGoal);
275 } else if (data.PosEdge(kTrussShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700276 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700277 LOG(DEBUG, "Canceling\n");
278 SetGoal(kFlippedTrussShotGoal);
279 }
280 } else {
281 if (data.IsPressed(kIntakeOpenPosition)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700282 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700283 LOG(DEBUG, "Canceling\n");
284 SetGoal(kIntakeOpenGoal);
285 } else if (data.IsPressed(kIntakePosition)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700286 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700287 LOG(DEBUG, "Canceling\n");
288 SetGoal(kIntakeGoal);
289 } else if (data.IsPressed(kVerticalTuck)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700290 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700291 LOG(DEBUG, "Canceling\n");
292 SetGoal(kVerticalTuckGoal);
293 } else if (data.IsPressed(kTuck)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700294 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700295 LOG(DEBUG, "Canceling\n");
296 SetGoal(kTuckGoal);
297 } else if (data.PosEdge(kLongShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700298 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700299 LOG(DEBUG, "Canceling\n");
300 SetGoal(kLongShotGoal);
301 } else if (data.PosEdge(kCloseShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700302 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700303 LOG(DEBUG, "Canceling\n");
304 SetGoal(kCloseShotGoal);
305 } else if (data.PosEdge(kFenderShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700306 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700307 LOG(DEBUG, "Canceling\n");
308 SetGoal(kFenderShotGoal);
309 } else if (data.PosEdge(kHumanPlayerShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700310 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700311 LOG(DEBUG, "Canceling\n");
312 SetGoal(kHumanShotGoal);
313 } else if (data.PosEdge(kUserLeft)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700314 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700315 LOG(DEBUG, "Canceling\n");
316 SetGoal(k254PassGoal);
317 } else if (data.PosEdge(kUserRight)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700318 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700319 LOG(DEBUG, "Canceling\n");
320 SetGoal(kDemoShotGoal);
321 } else if (data.PosEdge(kTrussShot)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700322 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700323 LOG(DEBUG, "Canceling\n");
324 SetGoal(kTrussShotGoal);
325 }
326 }
327
328 if (data.PosEdge(kFire)) {
Austin Schuh1bf8a212019-05-26 22:13:14 -0700329 EnqueueAction(shoot_action_factory_.Make(0.0));
Brian Silverman17f503e2015-08-02 18:17:18 -0700330 } else if (data.NegEdge(kFire)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700331 CancelCurrentAction();
Brian Silverman17f503e2015-08-02 18:17:18 -0700332 }
333
Brian Silverman17f503e2015-08-02 18:17:18 -0700334 if (data.IsPressed(kUnload) || data.IsPressed(kReload)) {
Austin Schuhbfb04122019-05-22 21:16:51 -0700335 CancelAllActions();
Brian Silverman17f503e2015-08-02 18:17:18 -0700336 LOG(DEBUG, "Canceling\n");
337 intake_power_ = 0.0;
338 velocity_compensation_ = 0.0;
339 }
340
341 // Send out the claw and shooter goals if no actions are running.
Austin Schuhbfb04122019-05-22 21:16:51 -0700342 if (!ActionRunning()) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700343 goal_angle_ += claw_goal_adjust;
344 separation_angle_ += claw_separation_adjust;
345
346 // If the action just ended, turn the intake off and stop velocity
347 // compensating.
Austin Schuhbfb04122019-05-22 21:16:51 -0700348 if (was_running_action()) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700349 intake_power_ = 0.0;
350 velocity_compensation_ = 0.0;
351 }
352
Austin Schuhbd0a40f2019-06-30 14:56:31 -0700353 drivetrain_status_fetcher_.Fetch();
Brian Silverman17f503e2015-08-02 18:17:18 -0700354 double goal_angle = goal_angle_;
Austin Schuhbd0a40f2019-06-30 14:56:31 -0700355 if (drivetrain_status_fetcher_.get()) {
356 goal_angle +=
357 SpeedToAngleOffset(drivetrain_status_fetcher_->robot_speed);
Brian Silverman17f503e2015-08-02 18:17:18 -0700358 } else {
359 LOG_INTERVAL(no_drivetrain_status_);
360 }
361
362 if (moving_for_shot_) {
Austin Schuhb2461f42019-06-29 18:17:06 -0700363 claw_status_fetcher_.Fetch();
364 if (claw_status_fetcher_.get()) {
365 if (::std::abs(claw_status_fetcher_->bottom - goal_angle) < 0.2) {
Brian Silverman17f503e2015-08-02 18:17:18 -0700366 moving_for_shot_ = false;
367 separation_angle_ = shot_separation_angle_;
368 }
369 }
370 }
371
372 double separation_angle = separation_angle_;
373
374 if (data.IsPressed(kCatch)) {
375 const double kCatchSeparation = 1.0;
376 goal_angle -= kCatchSeparation / 2.0;
377 separation_angle = kCatchSeparation;
378 }
379
380 bool intaking =
381 data.IsPressed(kRollersIn) || data.IsPressed(kIntakePosition) ||
382 data.IsPressed(kIntakeOpenPosition) || data.IsPressed(kCatch);
Austin Schuhb2461f42019-06-29 18:17:06 -0700383 {
384 auto goal_message = claw_goal_sender_.MakeMessage();
385 goal_message->bottom_angle = goal_angle;
386 goal_message->separation_angle = separation_angle;
387 goal_message->intake =
388 intaking ? 12.0
389 : (data.IsPressed(kRollersOut) ? -12.0 : intake_power_);
390 goal_message->centering = intaking ? 12.0 : 0.0;
391
392 if (!goal_message.Send()) {
393 LOG(WARNING, "sending claw goal failed\n");
394 }
Brian Silverman17f503e2015-08-02 18:17:18 -0700395 }
396
Austin Schuh493f7af2019-06-29 18:42:12 -0700397 {
398 auto goal_message = shooter_goal_sender_.MakeMessage();
399 goal_message->shot_power = shot_power_;
400 goal_message->shot_requested = data.IsPressed(kFire);
401 goal_message->unload_requested = data.IsPressed(kUnload);
402 goal_message->load_requested = data.IsPressed(kReload);
403 if (!goal_message.Send()) {
404 LOG(WARNING, "sending shooter goal failed\n");
405 }
Brian Silverman17f503e2015-08-02 18:17:18 -0700406 }
407 }
Brian Silverman17f503e2015-08-02 18:17:18 -0700408 }
409
410 double SpeedToAngleOffset(double speed) {
Brian Silvermanb601d892015-12-20 18:24:38 -0500411 const ::y2014::constants::Values &values = ::y2014::constants::GetValues();
Brian Silverman17f503e2015-08-02 18:17:18 -0700412 // scale speed to a [0.0-1.0] on something close to the max
413 // TODO(austin): Change the scale factor for different shots.
414 return (speed / values.drivetrain_max_speed) * velocity_compensation_;
415 }
416
417 private:
Austin Schuhb2461f42019-06-29 18:17:06 -0700418 ::aos::Fetcher<::y2014::control_loops::ClawQueue::Status>
419 claw_status_fetcher_;
420 ::aos::Sender<::y2014::control_loops::ClawQueue::Goal> claw_goal_sender_;
Austin Schuh493f7af2019-06-29 18:42:12 -0700421 ::aos::Sender<::y2014::control_loops::ShooterQueue::Goal> shooter_goal_sender_;
Austin Schuhbd0a40f2019-06-30 14:56:31 -0700422 ::aos::Fetcher<::frc971::control_loops::DrivetrainQueue::Status>
423 drivetrain_status_fetcher_;
Austin Schuhb2461f42019-06-29 18:17:06 -0700424
Brian Silverman17f503e2015-08-02 18:17:18 -0700425 double shot_power_;
426 double goal_angle_;
427 double separation_angle_, shot_separation_angle_;
428 double velocity_compensation_;
429 double intake_power_;
Brian Silverman17f503e2015-08-02 18:17:18 -0700430 bool moving_for_shot_ = false;
431
Austin Schuh1bf8a212019-05-26 22:13:14 -0700432 actors::ShootActor::Factory shoot_action_factory_;
433
Brian Silverman17f503e2015-08-02 18:17:18 -0700434 ::aos::util::SimpleLogInterval no_drivetrain_status_ =
Austin Schuh61bdc602016-12-04 19:10:10 -0800435 ::aos::util::SimpleLogInterval(::std::chrono::milliseconds(200), WARNING,
Brian Silverman17f503e2015-08-02 18:17:18 -0700436 "no drivetrain status");
437};
438
439} // namespace joysticks
440} // namespace input
Brian Silvermanb601d892015-12-20 18:24:38 -0500441} // namespace y2014
Brian Silverman17f503e2015-08-02 18:17:18 -0700442
443int main() {
Austin Schuh9fe68f72019-08-10 19:32:03 -0700444 ::aos::InitNRT(true);
445
Austin Schuh3e45c752019-02-02 12:19:11 -0800446 ::aos::ShmEventLoop event_loop;
447 ::y2014::input::joysticks::Reader reader(&event_loop);
Austin Schuh9fe68f72019-08-10 19:32:03 -0700448
449 event_loop.Run();
450
Brian Silverman17f503e2015-08-02 18:17:18 -0700451 ::aos::Cleanup();
452}