blob: 462498f78e886d8a901f070bc3d96a6fb5b983ae [file] [log] [blame]
Brian Silverman20141f92015-01-05 17:39:01 -08001#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/prime/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"
Ben Fredricksond69f38b2015-01-28 20:06:15 -080012#include "aos/common/actions/actions.h"
Brian Silverman20141f92015-01-05 17:39:01 -080013
Daniel Petti61896522015-02-15 18:01:43 -080014#include "frc971/control_loops/claw/claw.q.h"
Brian Silverman20141f92015-01-05 17:39:01 -080015#include "frc971/control_loops/drivetrain/drivetrain.q.h"
Daniel Petti61896522015-02-15 18:01:43 -080016#include "frc971/control_loops/fridge/fridge.q.h"
Brian Silverman20141f92015-01-05 17:39:01 -080017#include "frc971/constants.h"
18#include "frc971/queues/gyro.q.h"
19#include "frc971/autonomous/auto.q.h"
Austin Schuhd8b2a242015-02-22 21:46:53 -080020#include "frc971/actors/pickup_actor.h"
21#include "frc971/actors/stack_actor.h"
Brian Silverman10043572015-03-21 23:43:50 -070022#include "frc971/actors/score_actor.h"
Austin Schuhf14727e2015-03-08 18:49:12 -070023#include "frc971/actors/stack_and_lift_actor.h"
24#include "frc971/actors/stack_and_hold_actor.h"
25#include "frc971/actors/held_to_lift_actor.h"
Austin Schuhd8b2a242015-02-22 21:46:53 -080026#include "frc971/actors/lift_actor.h"
Austin Schuh994d42c2015-03-01 00:02:17 -080027#include "frc971/actors/can_pickup_actor.h"
Austin Schuh700b9222015-03-01 03:03:15 -080028#include "frc971/actors/horizontal_can_pickup_actor.h"
Brian Silverman20141f92015-01-05 17:39:01 -080029
Daniel Petti61896522015-02-15 18:01:43 -080030using ::frc971::control_loops::claw_queue;
Brian Silvermanada5f2c2015-02-01 02:41:14 -050031using ::frc971::control_loops::drivetrain_queue;
Daniel Petti61896522015-02-15 18:01:43 -080032using ::frc971::control_loops::fridge_queue;
Brian Silverman20141f92015-01-05 17:39:01 -080033using ::frc971::sensors::gyro_reading;
34
35using ::aos::input::driver_station::ButtonLocation;
Austin Schuhf14727e2015-03-08 18:49:12 -070036using ::aos::input::driver_station::POVLocation;
Brian Silverman20141f92015-01-05 17:39:01 -080037using ::aos::input::driver_station::JoystickAxis;
38using ::aos::input::driver_station::ControlBit;
39
40namespace frc971 {
41namespace input {
42namespace joysticks {
43
Austin Schuhf14727e2015-03-08 18:49:12 -070044// Actions needed.
45
46// Human Player Station Intake Button
47// Claw open
48// Claw close
49// Claw down
50
51// Stack + Lift (together)
52// Place
53
54// Hold stack
55
56// Horizontal can pickup
57// Vertical can pickup
58
59// TODO(austin): Pull a lot of the constants below out up here so they can be
60// globally changed easier.
61
Ben Fredrickson9fb2ab12015-02-16 16:42:08 -080062// preset motion limits
Austin Schuh6e242ac2015-03-07 17:08:21 -080063constexpr actors::ProfileParams kArmMove{1.00, 1.0};
64constexpr actors::ProfileParams kElevatorMove{1.00, 3.2};
Ben Fredrickson9fb2ab12015-02-16 16:42:08 -080065
Brian Silverman20141f92015-01-05 17:39:01 -080066const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
67const ButtonLocation kShiftHigh(2, 1), kShiftLow(2, 3);
68const ButtonLocation kQuickTurn(1, 5);
69
Austin Schuhf14727e2015-03-08 18:49:12 -070070//const ButtonLocation kClawClosed(3, 5);
71//const ButtonLocation kFridgeClosed(3, 1);
Austin Schuhd8b2a242015-02-22 21:46:53 -080072
Daniel Petti61896522015-02-15 18:01:43 -080073
Austin Schuhf14727e2015-03-08 18:49:12 -070074const ButtonLocation kRollersIn(4, 5);
75const ButtonLocation kClawToggle(4, 1);
Ben Fredrickson9fb2ab12015-02-16 16:42:08 -080076
Brian Silverman10043572015-03-21 23:43:50 -070077const POVLocation kElevatorCanUp(4, 0);
Austin Schuhf14727e2015-03-08 18:49:12 -070078
79// POV stick 3, 180
80const POVLocation kCanPickup(4, 180);
81const ButtonLocation kToteChute(4, 6);
82const ButtonLocation kStackAndLift(4, 7);
Brian Silverman10043572015-03-21 23:43:50 -070083const ButtonLocation kStackAndHold(3, 5);
Austin Schuhf14727e2015-03-08 18:49:12 -070084
85// Pull in the 6th tote.
Brian Silverman10043572015-03-21 23:43:50 -070086//const ButtonLocation kSixthTote(4, 10);
87const ButtonLocation kCanUp(4, 10);
Austin Schuhf14727e2015-03-08 18:49:12 -070088
89const ButtonLocation kHeldToLift(4, 11);
90const ButtonLocation kPickup(4, 9);
91
92const ButtonLocation kStack(4, 2);
93
94// Move the fridge out with the stack in preparation for scoring.
Brian Silverman10043572015-03-21 23:43:50 -070095const ButtonLocation kScore(4, 8);
Austin Schuhf14727e2015-03-08 18:49:12 -070096
97// Release the stack and retract back in.
Brian Silverman10043572015-03-21 23:43:50 -070098const ButtonLocation kRetractFromScore(4, 12);
Austin Schuhf14727e2015-03-08 18:49:12 -070099
Brian Silverman10043572015-03-21 23:43:50 -0700100const POVLocation kFridgeToggle(4, 270);
Austin Schuhf14727e2015-03-08 18:49:12 -0700101const ButtonLocation kSpit(4, 3);
102
103// Set stack down in the bot.
Brian Silverman10043572015-03-21 23:43:50 -0700104const POVLocation kSetStackDownAndHold(4, 90);
Austin Schuhf14727e2015-03-08 18:49:12 -0700105
106const double kClawTotePackAngle = 0.95;
Brian Silverman10043572015-03-21 23:43:50 -0700107const double kArmRaiseLowerClearance = -0.08;
Brian Silverman20141f92015-01-05 17:39:01 -0800108
109class Reader : public ::aos::input::JoystickInput {
110 public:
Austin Schuh331e13d2015-02-15 00:16:51 -0800111 Reader() : was_running_(false) {}
Brian Silverman20141f92015-01-05 17:39:01 -0800112
113 virtual void RunIteration(const ::aos::input::driver_station::Data &data) {
Austin Schuh6182f8d2015-02-14 22:15:04 -0800114 bool last_auto_running = auto_running_;
115 auto_running_ = data.GetControlBit(ControlBit::kAutonomous) &&
Brian Silvermane1103e62015-02-15 02:03:38 -0500116 data.GetControlBit(ControlBit::kEnabled);
Austin Schuh6182f8d2015-02-14 22:15:04 -0800117 if (auto_running_ != last_auto_running) {
118 if (auto_running_) {
119 StartAuto();
120 } else {
121 StopAuto();
Brian Silverman20141f92015-01-05 17:39:01 -0800122 }
Austin Schuh6182f8d2015-02-14 22:15:04 -0800123 }
124
125 if (!data.GetControlBit(ControlBit::kAutonomous)) {
Daniel Petti61896522015-02-15 18:01:43 -0800126 HandleDrivetrain(data);
Austin Schuhf14727e2015-03-08 18:49:12 -0700127 HandleTeleop(data);
Brian Silverman20141f92015-01-05 17:39:01 -0800128 }
129 }
130
131 void HandleDrivetrain(const ::aos::input::driver_station::Data &data) {
Brian Silverman20141f92015-01-05 17:39:01 -0800132 const double wheel = -data.GetAxis(kSteeringWheel);
133 const double throttle = -data.GetAxis(kDriveThrottle);
Brian Silverman20141f92015-01-05 17:39:01 -0800134
Brian Silvermanada5f2c2015-02-01 02:41:14 -0500135 if (!drivetrain_queue.goal.MakeWithBuilder()
Brian Silverman20141f92015-01-05 17:39:01 -0800136 .steering(wheel)
137 .throttle(throttle)
Brian Silverman20141f92015-01-05 17:39:01 -0800138 .quickturn(data.IsPressed(kQuickTurn))
Austin Schuh331e13d2015-02-15 00:16:51 -0800139 .control_loop_driving(false)
Brian Silverman20141f92015-01-05 17:39:01 -0800140 .Send()) {
141 LOG(WARNING, "sending stick values failed\n");
142 }
Brian Silverman20141f92015-01-05 17:39:01 -0800143 }
144
145 void HandleTeleop(const ::aos::input::driver_station::Data &data) {
Austin Schuhf14727e2015-03-08 18:49:12 -0700146 double intake_power = 0.0;
Brian Silverman20141f92015-01-05 17:39:01 -0800147 if (!data.GetControlBit(ControlBit::kEnabled)) {
148 action_queue_.CancelAllActions();
Austin Schuh6182f8d2015-02-14 22:15:04 -0800149 LOG(DEBUG, "Canceling\n");
Brian Silverman20141f92015-01-05 17:39:01 -0800150 }
151
Austin Schuhf14727e2015-03-08 18:49:12 -0700152 if (data.IsPressed(kRollersIn)) {
153 intake_power = 10.0;
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800154 claw_goal_ = 0.0;
Austin Schuhd8b2a242015-02-22 21:46:53 -0800155 }
Austin Schuhf14727e2015-03-08 18:49:12 -0700156 if (data.IsPressed(kSpit)) {
157 intake_power = -12.0;
Austin Schuhd8b2a242015-02-22 21:46:53 -0800158 }
Austin Schuh994d42c2015-03-01 00:02:17 -0800159
Austin Schuhf14727e2015-03-08 18:49:12 -0700160 // Toggle button for the claw
161 if (data.PosEdge(kClawToggle)) {
162 claw_rollers_closed_ = !claw_rollers_closed_;
Austin Schuh994d42c2015-03-01 00:02:17 -0800163 }
164
Austin Schuhf14727e2015-03-08 18:49:12 -0700165 /*
166 if (data.IsPressed(kClawClosed)) {
167 claw_rollers_closed_ = true;
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800168 }
Austin Schuhf14727e2015-03-08 18:49:12 -0700169 */
Austin Schuh700b9222015-03-01 03:03:15 -0800170
Austin Schuhf14727e2015-03-08 18:49:12 -0700171 // Horizontal can pickup.
Austin Schuh700b9222015-03-01 03:03:15 -0800172 if (data.PosEdge(kElevatorCanUp)) {
173 actors::HorizontalCanPickupParams params;
174 params.elevator_height = 0.3;
Brian Silverman10043572015-03-21 23:43:50 -0700175 params.pickup_angle = 0.40;
176 params.suck_time = 0.08;
Austin Schuh700b9222015-03-01 03:03:15 -0800177 params.suck_power = 8.0;
178
179 params.claw_settle_time = 0.05;
180 params.claw_settle_power = 5.0;
181 params.claw_full_lift_angle = 1.35;
182 params.claw_end_angle = 0.5;
Austin Schuhf14727e2015-03-08 18:49:12 -0700183
Brian Silverman10043572015-03-21 23:43:50 -0700184 // End low so we don't drop it.
185 params.elevator_end_height = 0.3;
186 params.arm_end_angle = 0.0;
Austin Schuh700b9222015-03-01 03:03:15 -0800187 action_queue_.EnqueueAction(
188 actors::MakeHorizontalCanPickupAction(params));
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800189 fridge_closed_ = true;
190 }
Austin Schuhf14727e2015-03-08 18:49:12 -0700191
192 // -0.942503 arm, 0.374752 elevator
193 // Vertical can pickup.
194 if (data.PosEdge(kCanPickup)) {
195 actors::CanPickupParams params;
196 params.pickup_angle = -0.93;
197 params.pickup_height = 0.265;
198 params.lift_height = 0.65;
Brian Silverman10043572015-03-21 23:43:50 -0700199 // End low so the can is supported.
200 params.end_height = 0.3;
201 params.end_angle = 0.0;
Austin Schuhf14727e2015-03-08 18:49:12 -0700202 action_queue_.EnqueueAction(actors::MakeCanPickupAction(params));
203 fridge_closed_ = true;
204 }
205
206 // Tote chute pull in when button is pressed, pack when done.
207 if (data.IsPressed(kToteChute)) {
208 claw_goal_ = 0.8;
209 intake_power = 7.0;
210 }
211 if (data.NegEdge(kToteChute)) {
212 claw_goal_ = kClawTotePackAngle;
213 }
214
215 if (data.PosEdge(kStackAndLift)) {
216 actors::StackAndLiftParams params;
217 params.stack_params.claw_out_angle = 0.6;
218 params.stack_params.bottom = 0.020;
219 params.stack_params.over_box_before_place_height = 0.39;
Brian Silverman10043572015-03-21 23:43:50 -0700220 params.stack_params.arm_clearance = kArmRaiseLowerClearance;
Austin Schuhf14727e2015-03-08 18:49:12 -0700221
222 params.grab_after_stack = true;
223 params.clamp_pause_time = 0.1;
224 params.lift_params.lift_height = 0.45;
225 params.lift_params.lift_arm = 0.3;
226 params.grab_after_lift = true;
227 fridge_closed_ = true;
228
229 action_queue_.EnqueueAction(actors::MakeStackAndLiftAction(params));
230 }
231
Brian Silverman10043572015-03-21 23:43:50 -0700232 if (data.PosEdge(kStackAndHold) || data.PosEdge(kSetStackDownAndHold)) {
Austin Schuhf14727e2015-03-08 18:49:12 -0700233 actors::StackAndHoldParams params;
234 params.bottom = 0.020;
235 params.over_box_before_place_height = 0.39;
236
Brian Silverman10043572015-03-21 23:43:50 -0700237 params.arm_clearance = kArmRaiseLowerClearance;
Austin Schuhf14727e2015-03-08 18:49:12 -0700238 params.clamp_pause_time = 0.25;
Brian Silverman10043572015-03-21 23:43:50 -0700239 params.claw_clamp_angle = kClawTotePackAngle;
Austin Schuhf14727e2015-03-08 18:49:12 -0700240
241 params.hold_height = 0.68;
Brian Silverman10043572015-03-21 23:43:50 -0700242 params.claw_out_angle = 0.6;
243
244 if (data.PosEdge(kSetStackDownAndHold)) {
245 params.place_not_stack = true;
246 params.clamp_pause_time = 0.1;
247 //params.claw_clamp_angle = kClawTotePackAngle - 0.5;
248 } else {
249 params.place_not_stack = false;
250 }
Austin Schuhf14727e2015-03-08 18:49:12 -0700251
252 action_queue_.EnqueueAction(actors::MakeStackAndHoldAction(params));
253 fridge_closed_ = true;
254 }
255
256 // TODO(austin): Figure out what action needed to pull the 6th tote into the
257 // claw.
258
259 // Lower the fridge from holding the stack, grab the stack, and then lift.
260 if (data.PosEdge(kHeldToLift)) {
261 actors::HeldToLiftParams params;
Brian Silverman10043572015-03-21 23:43:50 -0700262 params.arm_clearance = kArmRaiseLowerClearance;
Austin Schuhf14727e2015-03-08 18:49:12 -0700263 params.clamp_pause_time = 0.1;
Brian Silverman10043572015-03-21 23:43:50 -0700264 params.before_lift_settle_time = 0.1;
Austin Schuhf14727e2015-03-08 18:49:12 -0700265 params.bottom_height = 0.020;
266 params.claw_out_angle = 0.6;
267 params.lift_params.lift_height = 0.45;
268 params.lift_params.lift_arm = 0.3;
269 fridge_closed_ = true;
270
271 action_queue_.EnqueueAction(actors::MakeHeldToLiftAction(params));
272 }
273
Brian Silverman10043572015-03-21 23:43:50 -0700274 // Lift the can up.
275 if (data.PosEdge(kCanUp)) {
276 actors::LiftParams params;
277 params.lift_height = 0.68;
278 params.lift_arm = 0.3;
279 fridge_closed_ = true;
280
281 action_queue_.EnqueueAction(actors::MakeLiftAction(params));
282 }
283
Austin Schuhf14727e2015-03-08 18:49:12 -0700284 // Pick up a tote from the ground and put it in the bottom of the bot.
285 if (data.PosEdge(kPickup)) {
286 actors::PickupParams params;
287 // Lift to here initially.
288 params.pickup_angle = 0.9;
289 // Start sucking here
290 params.suck_angle = 0.8;
291 // Go back down to here to finish sucking.
292 params.suck_angle_finish = 0.4;
293 // Pack the box back in here.
294 params.pickup_finish_angle = kClawTotePackAngle;
295 params.intake_time = 0.8;
296 params.intake_voltage = 7.0;
297 action_queue_.EnqueueAction(actors::MakePickupAction(params));
298 }
299
300 // Place stack on a tote in the tray, and grab it.
301 if (data.PosEdge(kStack)) {
302 actors::StackParams params;
303 params.claw_out_angle = 0.6;
304 params.bottom = 0.020;
Brian Silverman10043572015-03-21 23:43:50 -0700305 params.only_place = false;
306 params.arm_clearance = kArmRaiseLowerClearance;
Austin Schuhf14727e2015-03-08 18:49:12 -0700307 params.over_box_before_place_height = 0.39;
308 action_queue_.EnqueueAction(actors::MakeStackAction(params));
309 claw_rollers_closed_ = true;
Brian Silverman10043572015-03-21 23:43:50 -0700310 fridge_closed_ = true;
Austin Schuhf14727e2015-03-08 18:49:12 -0700311 }
312
Brian Silverman10043572015-03-21 23:43:50 -0700313 if (data.PosEdge(kScore)) {
314 actors::ScoreParams params;
315 params.place_the_stack = false;
316 action_queue_.EnqueueAction(actors::MakeScoreAction(params));
317 }
Austin Schuhf14727e2015-03-08 18:49:12 -0700318
Brian Silverman10043572015-03-21 23:43:50 -0700319 if (data.PosEdge(kRetractFromScore)) {
320 actors::ScoreParams params;
321 params.place_the_stack = true;
322 action_queue_.EnqueueAction(actors::MakeScoreAction(params));
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800323 fridge_closed_ = false;
324 }
325
Brian Silverman10043572015-03-21 23:43:50 -0700326 if (data.PosEdge(kFridgeToggle)) {
327 fridge_closed_ = !fridge_closed_;
328 }
329
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800330 if (data.PosEdge(ControlBit::kEnabled)) {
331 // If we got enabled, wait for everything to zero.
332 LOG(INFO, "Waiting for zero.\n");
333 waiting_for_zero_ = true;
334 }
335
Austin Schuh700b9222015-03-01 03:03:15 -0800336 claw_queue.status.FetchLatest();
337 fridge_queue.status.FetchLatest();
338 if (!claw_queue.status.get()) {
339 LOG(ERROR, "Got no claw status packet.\n");
340 // Not safe to continue.
341 return;
342 }
343 if (!fridge_queue.status.get()) {
344 LOG(ERROR, "Got no fridge status packet.\n");
345 return;
346 }
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800347
Austin Schuh700b9222015-03-01 03:03:15 -0800348 if (claw_queue.status->zeroed && fridge_queue.status->zeroed) {
349 if (waiting_for_zero_) {
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800350 LOG(INFO, "Zeroed! Starting teleop mode.\n");
351 waiting_for_zero_ = false;
352
353 // Set the initial goals to where we are now.
354 elevator_goal_ = fridge_queue.status->goal_height;
355 arm_goal_ = fridge_queue.status->goal_angle;
356 claw_goal_ = claw_queue.status->angle;
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800357 }
358 } else {
Austin Schuh700b9222015-03-01 03:03:15 -0800359 waiting_for_zero_ = true;
360 return;
361 }
362
363 if (!waiting_for_zero_) {
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800364 if (!action_queue_.Running()) {
365 auto new_fridge_goal = fridge_queue.goal.MakeMessage();
Austin Schuh6e242ac2015-03-07 17:08:21 -0800366 new_fridge_goal->max_velocity = elevator_params_.velocity;
367 new_fridge_goal->max_acceleration = elevator_params_.acceleration;
Austin Schuh1d44bd42015-03-15 16:40:45 -0700368 new_fridge_goal->profiling_type = 0;
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800369 new_fridge_goal->height = elevator_goal_;
Austin Schuh6e242ac2015-03-07 17:08:21 -0800370 new_fridge_goal->velocity = 0.0;
371 new_fridge_goal->max_angular_velocity = arm_params_.velocity;
372 new_fridge_goal->max_angular_acceleration = arm_params_.acceleration;
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800373 new_fridge_goal->angle = arm_goal_;
374 new_fridge_goal->angular_velocity = 0.0;
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800375 new_fridge_goal->grabbers.top_front = fridge_closed_;
376 new_fridge_goal->grabbers.top_back = fridge_closed_;
377 new_fridge_goal->grabbers.bottom_front = fridge_closed_;
378 new_fridge_goal->grabbers.bottom_back = fridge_closed_;
379
380 if (!new_fridge_goal.Send()) {
381 LOG(ERROR, "Sending fridge goal failed.\n");
382 } else {
383 LOG(DEBUG, "sending goals: elevator: %f, arm: %f\n", elevator_goal_,
384 arm_goal_);
385 }
386 if (!claw_queue.goal.MakeWithBuilder()
387 .angle(claw_goal_)
388 .rollers_closed(claw_rollers_closed_)
Brian Silverman10043572015-03-21 23:43:50 -0700389 .max_velocity(4.0)
390 .max_acceleration(6.0)
Austin Schuhf14727e2015-03-08 18:49:12 -0700391 .intake(intake_power)
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800392 .Send()) {
393 LOG(ERROR, "Sending claw goal failed.\n");
394 }
395 }
396 }
397
Austin Schuhd8b2a242015-02-22 21:46:53 -0800398 if (action_queue_.Running()) {
399 // If we are running an action, update our goals to the current goals.
400 control_loops::fridge_queue.status.FetchLatest();
401 if (control_loops::fridge_queue.status.get()) {
402 arm_goal_ = control_loops::fridge_queue.status->goal_angle;
403 elevator_goal_ = control_loops::fridge_queue.status->goal_height;
404 } else {
405 LOG(ERROR, "No fridge status!\n");
406 }
407
408 // If we are running an action, update our goals to the current goals.
409 control_loops::claw_queue.status.FetchLatest();
410 if (control_loops::claw_queue.status.get()) {
411 claw_goal_ = control_loops::claw_queue.status->goal_angle;
412 } else {
413 LOG(ERROR, "No fridge status!\n");
414 }
415 }
Brian Silverman20141f92015-01-05 17:39:01 -0800416 action_queue_.Tick();
417 was_running_ = action_queue_.Running();
418 }
419
420 private:
Austin Schuh6182f8d2015-02-14 22:15:04 -0800421 void StartAuto() {
422 LOG(INFO, "Starting auto mode\n");
423 ::frc971::autonomous::autonomous.MakeWithBuilder().run_auto(true).Send();
424 }
425
426 void StopAuto() {
427 LOG(INFO, "Stopping auto mode\n");
428 ::frc971::autonomous::autonomous.MakeWithBuilder().run_auto(false).Send();
429 }
430
Brian Silverman20141f92015-01-05 17:39:01 -0800431 bool was_running_;
Daniel Petti61896522015-02-15 18:01:43 -0800432
433 // Previous goals for systems.
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800434 double elevator_goal_ = 0.2;
Daniel Petti61896522015-02-15 18:01:43 -0800435 double arm_goal_ = 0.0;
436 double claw_goal_ = 0.0;
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800437 bool claw_rollers_closed_ = false;
438 bool fridge_closed_ = false;
Austin Schuh6e242ac2015-03-07 17:08:21 -0800439 actors::ProfileParams arm_params_ = kArmMove;
440 actors::ProfileParams elevator_params_ = kElevatorMove;
Daniel Petti61896522015-02-15 18:01:43 -0800441
442 // If we're waiting for the subsystems to zero.
Austin Schuhcde7ffe2015-02-20 22:10:41 -0800443 bool waiting_for_zero_ = true;
Daniel Petti61896522015-02-15 18:01:43 -0800444
Austin Schuh6182f8d2015-02-14 22:15:04 -0800445 bool auto_running_ = false;
446
Austin Schuh331e13d2015-02-15 00:16:51 -0800447 ::aos::common::actions::ActionQueue action_queue_;
Brian Silverman20141f92015-01-05 17:39:01 -0800448
449 ::aos::util::SimpleLogInterval no_drivetrain_status_ =
450 ::aos::util::SimpleLogInterval(::aos::time::Time::InSeconds(0.2), WARNING,
451 "no drivetrain status");
452};
453
454} // namespace joysticks
455} // namespace input
456} // namespace frc971
457
458int main() {
459 ::aos::Init();
460 ::frc971::input::joysticks::Reader reader;
461 reader.Run();
462 ::aos::Cleanup();
463}