blob: 3226d0600ffdaa2c98629e25d33aff78b83a6ccb [file] [log] [blame]
Comran Morshed9a9948c2016-01-16 15:58:04 +00001#include <stdio.h>
2#include <string.h>
3#include <unistd.h>
4#include <math.h>
5
6#include "aos/linux_code/init.h"
7#include "aos/input/joystick_input.h"
8#include "aos/common/input/driver_station_data.h"
9#include "aos/common/logging/logging.h"
10#include "aos/common/util/log_interval.h"
11#include "aos/common/time.h"
12#include "aos/common/actions/actions.h"
13
14#include "frc971/control_loops/drivetrain/drivetrain.q.h"
Comran Morshed200dd4b2016-02-16 17:54:58 +000015#include "y2016/control_loops/shooter/shooter.q.h"
16#include "y2016/control_loops/superstructure/superstructure.q.h"
Austin Schuh45d07f62016-03-13 15:33:31 -070017#include "y2016/control_loops/superstructure/superstructure.h"
Comran Morshedaa0573c2016-03-05 19:05:54 +000018#include "y2016/queues/ball_detector.q.h"
Austin Schuhadd6d792016-03-19 01:20:01 -070019#include "y2016/vision/vision.q.h"
Comran Morshed200dd4b2016-02-16 17:54:58 +000020
Comran Morshed6c6a0a92016-01-17 12:45:16 +000021#include "y2016/constants.h"
Comran Morshed9a9948c2016-01-16 15:58:04 +000022#include "frc971/queues/gyro.q.h"
23#include "frc971/autonomous/auto.q.h"
Comran Morshede68e3732016-03-12 14:12:11 +000024#include "y2016/actors/autonomous_actor.h"
Austin Schuh18799112016-03-16 22:09:54 -070025#include "y2016/actors/vision_align_actor.h"
Austin Schuhd52df772016-03-19 15:38:41 -070026#include "y2016/control_loops/drivetrain/drivetrain_base.h"
Comran Morshed9a9948c2016-01-16 15:58:04 +000027
28using ::frc971::control_loops::drivetrain_queue;
Comran Morshed200dd4b2016-02-16 17:54:58 +000029using ::y2016::control_loops::shooter::shooter_queue;
30using ::y2016::control_loops::superstructure_queue;
Comran Morshed9a9948c2016-01-16 15:58:04 +000031
32using ::aos::input::driver_station::ButtonLocation;
Comran Morshed9a9948c2016-01-16 15:58:04 +000033using ::aos::input::driver_station::ControlBit;
Austin Schuh4ea06c12016-03-12 17:54:31 -080034using ::aos::input::driver_station::JoystickAxis;
35using ::aos::input::driver_station::POVLocation;
Comran Morshed9a9948c2016-01-16 15:58:04 +000036
Comran Morshed6c6a0a92016-01-17 12:45:16 +000037namespace y2016 {
Comran Morshed9a9948c2016-01-16 15:58:04 +000038namespace input {
39namespace joysticks {
40
Austin Schuh45d07f62016-03-13 15:33:31 -070041namespace {
42
43constexpr double kMaxIntakeAngleBeforeArmInterference = control_loops::
44 superstructure::CollisionAvoidance::kMaxIntakeAngleBeforeArmInterference;
45
46} // namespace
47
Comran Morshed9a9948c2016-01-16 15:58:04 +000048const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
Campbell Crowley5b27f022016-02-20 16:55:35 -080049const ButtonLocation kShiftHigh(2, 3), kShiftHigh2(2, 2), kShiftLow(2, 1);
Comran Morshed9a9948c2016-01-16 15:58:04 +000050const ButtonLocation kQuickTurn(1, 5);
51
Austin Schuh781cdcc2016-03-12 13:03:12 -080052const ButtonLocation kTurn1(1, 7);
53const ButtonLocation kTurn2(1, 11);
54
Comran Morshed200dd4b2016-02-16 17:54:58 +000055// Buttons on the lexan driver station to get things running on bring-up day.
Austin Schuh4ea06c12016-03-12 17:54:31 -080056const ButtonLocation kIntakeDown(3, 11);
57const POVLocation kFrontLong(3, 180);
58const POVLocation kBackLong(3, 0);
Austin Schuh45d07f62016-03-13 15:33:31 -070059const POVLocation kBackFender(3, 90);
60const POVLocation kFrontFender(3, 270);
Austin Schuh4ea06c12016-03-12 17:54:31 -080061const ButtonLocation kIntakeIn(3, 12);
Austin Schuh4ea06c12016-03-12 17:54:31 -080062const ButtonLocation kFire(3, 3);
Austin Schuh4ea06c12016-03-12 17:54:31 -080063const ButtonLocation kIntakeOut(3, 9);
Austin Schuh843412b2016-03-20 16:48:46 -070064const ButtonLocation kPortcullis(3, 7);
65const ButtonLocation kChevalDeFrise(3, 8);
Comran Morshed200dd4b2016-02-16 17:54:58 +000066
Austin Schuhadd6d792016-03-19 01:20:01 -070067const ButtonLocation kVisionAlign(3, 4);
Austin Schuh18799112016-03-16 22:09:54 -070068
Comran Morshed9a9948c2016-01-16 15:58:04 +000069class Reader : public ::aos::input::JoystickInput {
70 public:
71 Reader()
Austin Schuh94596dd2016-03-13 21:41:26 -070072 : is_high_gear_(true),
Comran Morshed200dd4b2016-02-16 17:54:58 +000073 intake_goal_(0.0),
74 shoulder_goal_(M_PI / 2.0),
Austin Schuhd52df772016-03-19 15:38:41 -070075 wrist_goal_(0.0),
76 dt_config_(control_loops::drivetrain::GetDrivetrainConfig()) {}
Comran Morshed9a9948c2016-01-16 15:58:04 +000077
78 void RunIteration(const ::aos::input::driver_station::Data &data) override {
79 bool last_auto_running = auto_running_;
80 auto_running_ = data.GetControlBit(ControlBit::kAutonomous) &&
81 data.GetControlBit(ControlBit::kEnabled);
82 if (auto_running_ != last_auto_running) {
83 if (auto_running_) {
84 StartAuto();
85 } else {
86 StopAuto();
87 }
88 }
89
Austin Schuh94596dd2016-03-13 21:41:26 -070090 if (!data.GetControlBit(ControlBit::kEnabled)) {
91 // If we are not enabled, reset the waiting for zero bit.
92 LOG(DEBUG, "Waiting for zero.\n");
93 waiting_for_zero_ = true;
94 is_high_gear_ = true;
95 }
96
Austin Schuhadd6d792016-03-19 01:20:01 -070097 vision_valid_ = false;
98
99 ::y2016::vision::vision_status.FetchLatest();
100
101 if (::y2016::vision::vision_status.get()) {
102 vision_valid_ = (::y2016::vision::vision_status->left_image_valid &&
103 ::y2016::vision::vision_status->right_image_valid);
Austin Schuhd52df772016-03-19 15:38:41 -0700104 last_angle_ = ::y2016::vision::vision_status->horizontal_angle;
Austin Schuhadd6d792016-03-19 01:20:01 -0700105 }
106
Austin Schuh94596dd2016-03-13 21:41:26 -0700107 if (!auto_running_) {
Comran Morshed9a9948c2016-01-16 15:58:04 +0000108 HandleDrivetrain(data);
109 HandleTeleop(data);
110 }
Austin Schuh81d71db2016-03-15 20:56:24 -0700111
112 // Process any pending actions.
113 action_queue_.Tick();
114 was_running_ = action_queue_.Running();
Comran Morshed9a9948c2016-01-16 15:58:04 +0000115 }
116
117 void HandleDrivetrain(const ::aos::input::driver_station::Data &data) {
118 bool is_control_loop_driving = false;
Austin Schuh781cdcc2016-03-12 13:03:12 -0800119 static double left_goal = 0.0;
120 static double right_goal = 0.0;
121
Comran Morshed9a9948c2016-01-16 15:58:04 +0000122 const double wheel = -data.GetAxis(kSteeringWheel);
123 const double throttle = -data.GetAxis(kDriveThrottle);
Comran Morshed9a9948c2016-01-16 15:58:04 +0000124
Austin Schuhadd6d792016-03-19 01:20:01 -0700125 if (data.IsPressed(kVisionAlign) && vision_valid_ &&
126 !vision_action_running_) {
Austin Schuh18799112016-03-16 22:09:54 -0700127 actors::VisionAlignActionParams params;
128 action_queue_.EnqueueAction(actors::MakeVisionAlignAction(params));
Austin Schuhadd6d792016-03-19 01:20:01 -0700129 vision_action_running_ = true;
Austin Schuh18799112016-03-16 22:09:54 -0700130 }
131
132 if (data.NegEdge(kVisionAlign)) {
133 action_queue_.CancelAllActions();
134 }
Austin Schuhadd6d792016-03-19 01:20:01 -0700135 if (!data.IsPressed(kVisionAlign)) {
136 vision_action_running_ = false;
137 }
Austin Schuh18799112016-03-16 22:09:54 -0700138
139 // Don't do any normal drivetrain stuff if vision is in charge.
140 if (was_running_) {
141 return;
142 }
143
Austin Schuh781cdcc2016-03-12 13:03:12 -0800144 if (data.PosEdge(kTurn1) || data.PosEdge(kTurn2)) {
145 drivetrain_queue.status.FetchLatest();
146 if (drivetrain_queue.status.get()) {
Austin Schuh45d07f62016-03-13 15:33:31 -0700147 left_goal = drivetrain_queue.status->estimated_left_position;
148 right_goal = drivetrain_queue.status->estimated_right_position;
Austin Schuh781cdcc2016-03-12 13:03:12 -0800149 }
150 }
151 if (data.IsPressed(kTurn1) || data.IsPressed(kTurn2)) {
152 is_control_loop_driving = true;
153 }
Comran Morshed9a9948c2016-01-16 15:58:04 +0000154 if (!drivetrain_queue.goal.MakeWithBuilder()
155 .steering(wheel)
156 .throttle(throttle)
157 .highgear(is_high_gear_)
158 .quickturn(data.IsPressed(kQuickTurn))
159 .control_loop_driving(is_control_loop_driving)
Austin Schuh45d07f62016-03-13 15:33:31 -0700160 .left_goal(left_goal - wheel * 0.5 + throttle * 0.3)
161 .right_goal(right_goal + wheel * 0.5 + throttle * 0.3)
Comran Morshed9a9948c2016-01-16 15:58:04 +0000162 .left_velocity_goal(0)
163 .right_velocity_goal(0)
164 .Send()) {
165 LOG(WARNING, "sending stick values failed\n");
166 }
Comran Morshed6c6a0a92016-01-17 12:45:16 +0000167
Campbell Crowley5b27f022016-02-20 16:55:35 -0800168 if (data.PosEdge(kShiftLow)) {
Comran Morshed9a9948c2016-01-16 15:58:04 +0000169 is_high_gear_ = false;
170 }
Comran Morshed6c6a0a92016-01-17 12:45:16 +0000171
Campbell Crowley5b27f022016-02-20 16:55:35 -0800172 if (data.PosEdge(kShiftHigh) || data.PosEdge(kShiftHigh2)) {
Comran Morshed9a9948c2016-01-16 15:58:04 +0000173 is_high_gear_ = true;
174 }
175 }
176
Comran Morshed9a9948c2016-01-16 15:58:04 +0000177 void HandleTeleop(const ::aos::input::driver_station::Data &data) {
Austin Schuh45d07f62016-03-13 15:33:31 -0700178 // Default the intake to up.
179 intake_goal_ = constants::Values::kIntakeRange.upper - 0.04;
180
181 bool force_lights_on = false;
Comran Morshed9a9948c2016-01-16 15:58:04 +0000182 if (!data.GetControlBit(ControlBit::kEnabled)) {
183 action_queue_.CancelAllActions();
Comran Morshed6c6a0a92016-01-17 12:45:16 +0000184 LOG(DEBUG, "Canceling\n");
Comran Morshed9a9948c2016-01-16 15:58:04 +0000185 }
186
Comran Morshed200dd4b2016-02-16 17:54:58 +0000187 superstructure_queue.status.FetchLatest();
188 if (!superstructure_queue.status.get()) {
189 LOG(ERROR, "Got no superstructure status packet.\n");
190 }
191
192 if (superstructure_queue.status.get() &&
193 superstructure_queue.status->zeroed) {
194 if (waiting_for_zero_) {
Austin Schuh94596dd2016-03-13 21:41:26 -0700195 LOG(DEBUG, "Zeroed! Starting teleop mode.\n");
Comran Morshed200dd4b2016-02-16 17:54:58 +0000196 waiting_for_zero_ = false;
197 }
198 } else {
199 waiting_for_zero_ = true;
200 }
201
Austin Schuhadd6d792016-03-19 01:20:01 -0700202 double intake_when_shooting = kMaxIntakeAngleBeforeArmInterference;
203 bool use_slow_profile = false;
204 if (vision_action_running_) {
205 use_slow_profile = true;
206 if (vision_valid_) {
207 intake_when_shooting -= 0.5;
208 }
209 }
210
Austin Schuh4ea06c12016-03-12 17:54:31 -0800211 if (data.IsPressed(kFrontLong)) {
212 // Forwards shot
Austin Schuh5a6db4d2016-02-28 22:02:42 -0800213 shoulder_goal_ = M_PI / 2.0 - 0.2;
Austin Schuhd52df772016-03-19 15:38:41 -0700214 wrist_goal_ = M_PI + 0.45;
Austin Schuh4ea06c12016-03-12 17:54:31 -0800215 shooter_velocity_ = 640.0;
Austin Schuhadd6d792016-03-19 01:20:01 -0700216 intake_goal_ = intake_when_shooting;
Austin Schuh4ea06c12016-03-12 17:54:31 -0800217 } else if (data.IsPressed(kBackLong)) {
218 // Backwards shot
219 shoulder_goal_ = M_PI / 2.0 - 0.2;
220 wrist_goal_ = -0.59;
221 shooter_velocity_ = 640.0;
Austin Schuhadd6d792016-03-19 01:20:01 -0700222 intake_goal_ = intake_when_shooting;
Austin Schuh45d07f62016-03-13 15:33:31 -0700223 } else if (data.IsPressed(kBackFender)) {
224 // Fender shot back
225 shoulder_goal_ = 0.65;
226 wrist_goal_ = -1.0;
227 shooter_velocity_ = 550.0;
Austin Schuhadd6d792016-03-19 01:20:01 -0700228 intake_goal_ = intake_when_shooting;
Austin Schuh45d07f62016-03-13 15:33:31 -0700229 } else if (data.IsPressed(kFrontFender)) {
230 // Fender shot back
231 shoulder_goal_ = 1.45;
232 wrist_goal_ = 2.5 + 1.7;
233 shooter_velocity_ = 550.0;
Austin Schuhadd6d792016-03-19 01:20:01 -0700234 intake_goal_ = intake_when_shooting;
Austin Schuhde802e92016-02-27 14:49:03 -0800235 } else {
Austin Schuh4ea06c12016-03-12 17:54:31 -0800236 wrist_goal_ = 0.0;
Austin Schuh3f0b1192016-03-12 13:03:56 -0800237 shoulder_goal_ = -0.010;
Austin Schuh4ea06c12016-03-12 17:54:31 -0800238 shooter_velocity_ = 0.0;
Comran Morshed200dd4b2016-02-16 17:54:58 +0000239 }
240
Comran Morshedaa0573c2016-03-05 19:05:54 +0000241 bool ball_detected = false;
242 ::y2016::sensors::ball_detector.FetchLatest();
243 if (::y2016::sensors::ball_detector.get()) {
244 ball_detected = ::y2016::sensors::ball_detector->voltage > 2.5;
245 }
246 if (data.PosEdge(kIntakeIn)) {
247 saw_ball_when_started_intaking_ = ball_detected;
248 }
249
Austin Schuh45d07f62016-03-13 15:33:31 -0700250 if (data.IsPressed(kIntakeIn)) {
251 is_intaking_ = (!ball_detected || saw_ball_when_started_intaking_);
252 if (ball_detected) {
253 force_lights_on = true;
254 }
255 } else {
256 is_intaking_ = false;
257 }
258
Austin Schuhd52df772016-03-19 15:38:41 -0700259 fire_ = false;
Austin Schuh4ea06c12016-03-12 17:54:31 -0800260 if (data.IsPressed(kFire) && shooter_velocity_ != 0.0) {
Austin Schuhd52df772016-03-19 15:38:41 -0700261 if (data.IsPressed(kVisionAlign)) {
262 // Make sure that we are lined up.
263 drivetrain_queue.status.FetchLatest();
264 drivetrain_queue.goal.FetchLatest();
265 if (drivetrain_queue.status.get() && drivetrain_queue.goal.get()) {
266 const double left_goal = drivetrain_queue.goal->left_goal;
267 const double right_goal = drivetrain_queue.goal->right_goal;
268 const double left_current =
269 drivetrain_queue.status->estimated_left_position;
270 const double right_current =
271 drivetrain_queue.status->estimated_right_position;
272 const double left_velocity =
273 drivetrain_queue.status->estimated_left_velocity;
274 const double right_velocity =
275 drivetrain_queue.status->estimated_right_velocity;
276 if (vision_action_running_ && ::std::abs(last_angle_) < 0.02 &&
277 ::std::abs((left_goal - right_goal) -
278 (left_current - right_current)) /
279 dt_config_.robot_radius / 2.0 <
280 0.02 &&
281 ::std::abs(left_velocity - right_velocity) < 0.01) {
282 ++ready_to_fire_;
283 } else {
284 ready_to_fire_ = 0;
285 }
286 if (ready_to_fire_ > 10) {
287 fire_ = true;
288 }
289 }
290 } else {
291 fire_ = true;
292 }
Comran Morshed200dd4b2016-02-16 17:54:58 +0000293 }
294
Austin Schuh4ea06c12016-03-12 17:54:31 -0800295 is_outtaking_ = data.IsPressed(kIntakeOut);
Austin Schuh5a6db4d2016-02-28 22:02:42 -0800296
Austin Schuhd52df772016-03-19 15:38:41 -0700297 if (is_intaking_ || is_outtaking_) {
298 recently_intaking_accumulator_ = 20;
299 }
300
301 if (data.IsPressed(kIntakeDown)) {
302 if (recently_intaking_accumulator_) {
303 intake_goal_ = 0.1;
304 } else {
305 intake_goal_ = -0.05;
306 }
307 }
308
309 if (recently_intaking_accumulator_ > 0) {
310 --recently_intaking_accumulator_;
311 }
312
Austin Schuh843412b2016-03-20 16:48:46 -0700313 if (data.IsPressed(kPortcullis)) {
314 traverse_unlatched_ = true;
315 traverse_down_ = true;
316 } else if (data.IsPressed(kChevalDeFrise)) {
317 traverse_unlatched_ = false;
318 traverse_down_ = true;
319 } else {
320 traverse_unlatched_ = true;
321 traverse_down_ = false;
322 }
323
Comran Morshed200dd4b2016-02-16 17:54:58 +0000324 if (!waiting_for_zero_) {
Austin Schuhadd6d792016-03-19 01:20:01 -0700325 auto new_superstructure_goal = superstructure_queue.goal.MakeMessage();
326 new_superstructure_goal->angle_intake = intake_goal_;
327 new_superstructure_goal->angle_shoulder = shoulder_goal_;
328 new_superstructure_goal->angle_wrist = wrist_goal_;
Austin Schuh3f0b1192016-03-12 13:03:56 -0800329
Austin Schuhadd6d792016-03-19 01:20:01 -0700330 new_superstructure_goal->max_angular_velocity_intake = 7.0;
331 new_superstructure_goal->max_angular_velocity_shoulder = 4.0;
332 new_superstructure_goal->max_angular_velocity_wrist = 10.0;
333 if (use_slow_profile) {
334 new_superstructure_goal->max_angular_acceleration_intake = 10.0;
335 } else {
Austin Schuh3f0b1192016-03-12 13:03:56 -0800336 new_superstructure_goal->max_angular_acceleration_intake = 40.0;
Austin Schuhadd6d792016-03-19 01:20:01 -0700337 }
338 new_superstructure_goal->max_angular_acceleration_shoulder = 10.0;
339 new_superstructure_goal->max_angular_acceleration_wrist = 25.0;
Austin Schuh3f0b1192016-03-12 13:03:56 -0800340
Austin Schuhadd6d792016-03-19 01:20:01 -0700341 // Granny mode
342 /*
343 new_superstructure_goal->max_angular_velocity_intake = 0.2;
344 new_superstructure_goal->max_angular_velocity_shoulder = 0.2;
345 new_superstructure_goal->max_angular_velocity_wrist = 0.2;
346 new_superstructure_goal->max_angular_acceleration_intake = 1.0;
347 new_superstructure_goal->max_angular_acceleration_shoulder = 1.0;
348 new_superstructure_goal->max_angular_acceleration_wrist = 1.0;
349 */
350 if (is_intaking_) {
351 new_superstructure_goal->voltage_top_rollers = 12.0;
352 new_superstructure_goal->voltage_bottom_rollers = 12.0;
353 } else if (is_outtaking_) {
354 new_superstructure_goal->voltage_top_rollers = -12.0;
355 new_superstructure_goal->voltage_bottom_rollers = -7.0;
356 } else {
357 new_superstructure_goal->voltage_top_rollers = 0.0;
358 new_superstructure_goal->voltage_bottom_rollers = 0.0;
359 }
Comran Morshed200dd4b2016-02-16 17:54:58 +0000360
Austin Schuh843412b2016-03-20 16:48:46 -0700361 new_superstructure_goal->traverse_unlatched = traverse_unlatched_;
362 new_superstructure_goal->traverse_down = traverse_down_;
363
Austin Schuhadd6d792016-03-19 01:20:01 -0700364 if (!new_superstructure_goal.Send()) {
365 LOG(ERROR, "Sending superstructure goal failed.\n");
366 } else {
367 LOG(DEBUG, "sending goals: intake: %f, shoulder: %f, wrist: %f\n",
368 intake_goal_, shoulder_goal_, wrist_goal_);
369 }
Comran Morshed200dd4b2016-02-16 17:54:58 +0000370
Austin Schuhadd6d792016-03-19 01:20:01 -0700371 if (!shooter_queue.goal.MakeWithBuilder()
372 .angular_velocity(shooter_velocity_)
373 .clamp_open(is_intaking_ || is_outtaking_)
374 .push_to_shooter(fire_)
375 .force_lights_on(force_lights_on)
376 .Send()) {
377 LOG(ERROR, "Sending shooter goal failed.\n");
Comran Morshed200dd4b2016-02-16 17:54:58 +0000378 }
379 }
Comran Morshed9a9948c2016-01-16 15:58:04 +0000380 }
381
Comran Morshed9a9948c2016-01-16 15:58:04 +0000382 private:
383 void StartAuto() {
384 LOG(INFO, "Starting auto mode\n");
Comran Morshede68e3732016-03-12 14:12:11 +0000385
386 actors::AutonomousActionParams params;
387 params.mode = 0;
388 action_queue_.EnqueueAction(actors::MakeAutonomousAction(params));
Comran Morshed9a9948c2016-01-16 15:58:04 +0000389 }
390
391 void StopAuto() {
392 LOG(INFO, "Stopping auto mode\n");
Comran Morshede68e3732016-03-12 14:12:11 +0000393 action_queue_.CancelAllActions();
Comran Morshed9a9948c2016-01-16 15:58:04 +0000394 }
395
396 bool is_high_gear_;
Comran Morshed200dd4b2016-02-16 17:54:58 +0000397 // Whatever these are set to are our default goals to send out after zeroing.
398 double intake_goal_;
399 double shoulder_goal_;
400 double wrist_goal_;
Austin Schuhde802e92016-02-27 14:49:03 -0800401 double shooter_velocity_ = 0.0;
Comran Morshed200dd4b2016-02-16 17:54:58 +0000402
403 bool was_running_ = false;
Comran Morshed9a9948c2016-01-16 15:58:04 +0000404 bool auto_running_ = false;
405
Austin Schuh843412b2016-03-20 16:48:46 -0700406 bool traverse_unlatched_ = false;
407 bool traverse_down_ = false;
408
Comran Morshed200dd4b2016-02-16 17:54:58 +0000409 // If we're waiting for the subsystems to zero.
410 bool waiting_for_zero_ = true;
411
Comran Morshedaa0573c2016-03-05 19:05:54 +0000412 // If true, the ball was present when the intaking button was pressed.
413 bool saw_ball_when_started_intaking_ = false;
414
Austin Schuhde802e92016-02-27 14:49:03 -0800415 bool is_intaking_ = false;
Austin Schuh5a6db4d2016-02-28 22:02:42 -0800416 bool is_outtaking_ = false;
Austin Schuhde802e92016-02-27 14:49:03 -0800417 bool fire_ = false;
418
Austin Schuhadd6d792016-03-19 01:20:01 -0700419 bool vision_action_running_ = false;
420 bool vision_valid_ = false;
421
Austin Schuhd52df772016-03-19 15:38:41 -0700422 int recently_intaking_accumulator_ = 0;
423 double last_angle_ = 100;
424
425 int ready_to_fire_ = 0;
426
Comran Morshed9a9948c2016-01-16 15:58:04 +0000427 ::aos::common::actions::ActionQueue action_queue_;
428
Austin Schuhd52df772016-03-19 15:38:41 -0700429 const ::frc971::control_loops::drivetrain::DrivetrainConfig dt_config_;
430
Comran Morshed9a9948c2016-01-16 15:58:04 +0000431 ::aos::util::SimpleLogInterval no_drivetrain_status_ =
432 ::aos::util::SimpleLogInterval(::aos::time::Time::InSeconds(0.2), WARNING,
433 "no drivetrain status");
434};
435
436} // namespace joysticks
437} // namespace input
Comran Morshed6c6a0a92016-01-17 12:45:16 +0000438} // namespace y2016
Comran Morshed9a9948c2016-01-16 15:58:04 +0000439
440int main() {
441 ::aos::Init(-1);
Comran Morshed6c6a0a92016-01-17 12:45:16 +0000442 ::y2016::input::joysticks::Reader reader;
Comran Morshed9a9948c2016-01-16 15:58:04 +0000443 reader.Run();
444 ::aos::Cleanup();
445}