Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 1 | #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" |
Austin Schuh | 06cbbf1 | 2014-02-22 02:07:31 -0800 | [diff] [blame] | 8 | #include "aos/common/input/driver_station_data.h" |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 9 | #include "aos/common/logging/logging.h" |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 10 | #include "aos/common/util/log_interval.h" |
| 11 | #include "aos/common/time.h" |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 12 | |
| 13 | #include "frc971/control_loops/drivetrain/drivetrain.q.h" |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 14 | #include "frc971/constants.h" |
Brian Silverman | 6bf0d3c | 2014-03-08 12:52:54 -0800 | [diff] [blame] | 15 | #include "frc971/queues/other_sensors.q.h" |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 16 | #include "frc971/autonomous/auto.q.h" |
Brian Silverman | fac5c29 | 2014-02-17 15:26:57 -0800 | [diff] [blame] | 17 | #include "frc971/control_loops/claw/claw.q.h" |
| 18 | #include "frc971/control_loops/shooter/shooter.q.h" |
Ben Fredrickson | aa45045 | 2014-03-01 09:41:18 +0000 | [diff] [blame] | 19 | #include "frc971/actions/shoot_action.q.h" |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 20 | #include "frc971/actions/action_client.h" |
| 21 | #include "frc971/actions/catch_action.q.h" |
| 22 | #include "frc971/actions/shoot_action.h" |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 23 | |
| 24 | using ::frc971::control_loops::drivetrain; |
Brian Silverman | 6bf0d3c | 2014-03-08 12:52:54 -0800 | [diff] [blame] | 25 | using ::frc971::sensors::gyro_reading; |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 26 | |
| 27 | using ::aos::input::driver_station::ButtonLocation; |
| 28 | using ::aos::input::driver_station::JoystickAxis; |
| 29 | using ::aos::input::driver_station::ControlBit; |
| 30 | |
| 31 | namespace frc971 { |
| 32 | namespace input { |
| 33 | namespace joysticks { |
| 34 | |
| 35 | const ButtonLocation kDriveControlLoopEnable1(1, 7), |
| 36 | kDriveControlLoopEnable2(1, 11); |
| 37 | const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2); |
| 38 | const ButtonLocation kShiftHigh(2, 1), kShiftLow(2, 3); |
| 39 | const ButtonLocation kQuickTurn(1, 5); |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 40 | |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 41 | const ButtonLocation kCatch(3, 10); |
| 42 | |
| 43 | const ButtonLocation kFire(3, 9); |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 44 | const ButtonLocation kUnload(1, 4); |
| 45 | const ButtonLocation kReload(1, 2); |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 46 | |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 47 | const ButtonLocation kRollersOut(3, 8); |
| 48 | const ButtonLocation kRollersIn(3, 3); |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 49 | |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 50 | const ButtonLocation kTuck(3, 4); |
| 51 | const ButtonLocation kIntakePosition(3, 5); |
| 52 | const ButtonLocation kIntakeOpenPosition(3, 11); |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 53 | const ButtonLocation kVerticalTuck(2, 6); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 54 | const JoystickAxis kFlipRobot(3, 3); |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 55 | |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 56 | const ButtonLocation kLongShot(3, 7); |
| 57 | const ButtonLocation kMediumShot(3, 6); |
| 58 | const ButtonLocation kShortShot(3, 2); |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 59 | const ButtonLocation kTrussShot(2, 11); |
| 60 | const ButtonLocation kHumanPlayerShot(3, 1); |
| 61 | |
| 62 | const ButtonLocation kUserLeft(2, 7); |
| 63 | const ButtonLocation kUserRight(2, 10); |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 64 | |
Brian Silverman | 18f6e64 | 2014-03-13 18:52:47 -0700 | [diff] [blame] | 65 | const JoystickAxis kAdjustClawGoal(3, 2); |
| 66 | const JoystickAxis kAdjustClawSeparation(3, 1); |
| 67 | |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 68 | struct ClawGoal { |
| 69 | double angle; |
| 70 | double separation; |
| 71 | }; |
| 72 | |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 73 | struct ShotGoal { |
| 74 | ClawGoal claw; |
| 75 | double shot_power; |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 76 | double velocity_compensation; |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 77 | double intake_power; |
| 78 | }; |
| 79 | |
Brian Silverman | 545f2ad | 2014-03-14 12:31:42 -0700 | [diff] [blame] | 80 | const double kIntakePower = 4.0; |
Brian Silverman | 255b5c1 | 2014-04-25 09:21:40 -0500 | [diff] [blame] | 81 | // In case we have to quickly adjust it. |
Brian Silverman | b3cf0ef | 2014-03-22 12:45:55 -0700 | [diff] [blame] | 82 | const double kGrabSeparation = 0; |
Brian Silverman | 545f2ad | 2014-03-14 12:31:42 -0700 | [diff] [blame] | 83 | const double kShootSeparation = 0.11 + kGrabSeparation; |
| 84 | |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 85 | const ClawGoal kTuckGoal = {-2.273474, -0.749484}; |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 86 | const ClawGoal kVerticalTuckGoal = {0, kGrabSeparation}; |
Brian Silverman | 63ec750 | 2014-03-30 18:09:10 -0700 | [diff] [blame] | 87 | const ClawGoal kIntakeGoal = {-2.24, kGrabSeparation}; |
| 88 | const ClawGoal kIntakeOpenGoal = {-2.0, 1.1}; |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 89 | |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 90 | // TODO(austin): Tune these by hand... |
| 91 | const ClawGoal kFlippedTuckGoal = {2.733474, -0.75}; |
Brian Silverman | 545f2ad | 2014-03-14 12:31:42 -0700 | [diff] [blame] | 92 | const ClawGoal kFlippedIntakeGoal = {2.0, kGrabSeparation}; |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 93 | const ClawGoal kFlippedIntakeOpenGoal = {0.95, 1.0}; |
| 94 | |
Brian Silverman | 255b5c1 | 2014-04-25 09:21:40 -0500 | [diff] [blame] | 95 | // 34" between near edge of colored line and rear edge of bumper. |
| 96 | // Only works running? |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 97 | const ShotGoal kLongShotGoal = { |
Brian Silverman | 55d7f57 | 2014-04-17 14:33:54 -0700 | [diff] [blame] | 98 | {-1.08, kShootSeparation}, 145, 0.04, kIntakePower}; |
Brian Silverman | 255b5c1 | 2014-04-25 09:21:40 -0500 | [diff] [blame] | 99 | // old 34" {-1.06, kShootSeparation}, 140, 0.04, kIntakePower}; |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 100 | const ShotGoal kFlippedLongShotGoal = { |
Brian Silverman | 55d7f57 | 2014-04-17 14:33:54 -0700 | [diff] [blame] | 101 | {0.96, kShootSeparation}, 145, 0.09, kIntakePower}; |
Brian Silverman | 255b5c1 | 2014-04-25 09:21:40 -0500 | [diff] [blame] | 102 | // old 34" {0.96, kShootSeparation}, 140, 0.09, kIntakePower}; |
Brian Silverman | 0e7c03e | 2014-03-23 17:06:24 -0700 | [diff] [blame] | 103 | |
Brian Silverman | 255b5c1 | 2014-04-25 09:21:40 -0500 | [diff] [blame] | 104 | // 78" between near edge of colored line and rear edge of bumper. |
| 105 | // TODO(brians): kCloseShot |
Brian Silverman | 0e7c03e | 2014-03-23 17:06:24 -0700 | [diff] [blame] | 106 | const ShotGoal kMediumShotGoal = { |
| 107 | {-0.95, kShootSeparation}, 105, 0.2, kIntakePower}; |
| 108 | // 3/4" plunger {-0.90, kShootSeparation}, 105, 0.2, kIntakePower}; |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 109 | const ShotGoal kFlippedMediumShotGoal = { |
Brian Silverman | 255b5c1 | 2014-04-25 09:21:40 -0500 | [diff] [blame] | 110 | {0.865, kShootSeparation}, 120, 0.2, kIntakePower}; |
Brian Silverman | 0e7c03e | 2014-03-23 17:06:24 -0700 | [diff] [blame] | 111 | // 3/4" plunger {0.80, kShootSeparation}, 105, 0.2, kIntakePower}; |
| 112 | |
Brian Silverman | 255b5c1 | 2014-04-25 09:21:40 -0500 | [diff] [blame] | 113 | // Shot from the fender. |
| 114 | // TODO(brians): kFenderShot |
Brian Silverman | 0e7c03e | 2014-03-23 17:06:24 -0700 | [diff] [blame] | 115 | const ShotGoal kShortShotGoal = { |
Brian Silverman | 55d7f57 | 2014-04-17 14:33:54 -0700 | [diff] [blame] | 116 | {-0.68, kShootSeparation}, 115.0, 0.4, kIntakePower}; |
| 117 | const ShotGoal kFlippedShortShotGoal = { |
Brian Silverman | 255b5c1 | 2014-04-25 09:21:40 -0500 | [diff] [blame] | 118 | {0.63, kShootSeparation}, 115.0, 0.4, kIntakePower}; |
Brian Silverman | 0e7c03e | 2014-03-23 17:06:24 -0700 | [diff] [blame] | 119 | |
Brian Silverman | 63ec750 | 2014-03-30 18:09:10 -0700 | [diff] [blame] | 120 | const ShotGoal kHumanShotGoal = { |
| 121 | {-0.90, kShootSeparation}, 140, 0.04, kIntakePower}; |
Brian Silverman | 73c4839 | 2014-04-05 07:07:41 -0700 | [diff] [blame] | 122 | const ShotGoal kFlippedHumanShotGoal = { |
| 123 | {0.90, kShootSeparation}, 140, 0, kIntakePower}; |
Brian Silverman | 0e7c03e | 2014-03-23 17:06:24 -0700 | [diff] [blame] | 124 | const ShotGoal kTrussShotGoal = { |
Brian Silverman | 8d5dda4 | 2014-04-06 15:59:49 -0700 | [diff] [blame] | 125 | {-0.68, kShootSeparation}, 83.0, 0.4, kIntakePower}; |
Brian Silverman | 73c4839 | 2014-04-05 07:07:41 -0700 | [diff] [blame] | 126 | const ShotGoal kFlippedTrussShotGoal = { |
Brian Silverman | 8d5dda4 | 2014-04-06 15:59:49 -0700 | [diff] [blame] | 127 | {0.68, kShootSeparation}, 92.0, 0.4, kIntakePower}; |
| 128 | |
| 129 | const ClawGoal k254PassGoal = {-1.95, kGrabSeparation}; |
| 130 | const ClawGoal kFlipped254PassGoal = {1.96, kGrabSeparation}; |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 131 | |
| 132 | // Makes a new ShootAction action. |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 133 | ::std::unique_ptr<TypedAction< ::frc971::actions::CatchActionGroup>> |
| 134 | MakeCatchAction() { |
| 135 | return ::std::unique_ptr<TypedAction< ::frc971::actions::CatchActionGroup>>( |
| 136 | new TypedAction< ::frc971::actions::CatchActionGroup>( |
| 137 | &::frc971::actions::catch_action)); |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | // A queue which queues Actions and cancels them. |
| 141 | class ActionQueue { |
| 142 | public: |
| 143 | // Queues up an action for sending. |
| 144 | void QueueAction(::std::unique_ptr<Action> action) { |
| 145 | if (current_action_) { |
Austin Schuh | c95c2b7 | 2014-03-02 11:56:49 -0800 | [diff] [blame] | 146 | LOG(INFO, "Queueing action, canceling prior\n"); |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 147 | current_action_->Cancel(); |
| 148 | next_action_ = ::std::move(action); |
| 149 | } else { |
Austin Schuh | c95c2b7 | 2014-03-02 11:56:49 -0800 | [diff] [blame] | 150 | LOG(INFO, "Queueing action\n"); |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 151 | current_action_ = ::std::move(action); |
| 152 | current_action_->Start(); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | // Cancels the current action, and runs the next one when the current one has |
| 157 | // finished. |
| 158 | void CancelCurrentAction() { |
Austin Schuh | c95c2b7 | 2014-03-02 11:56:49 -0800 | [diff] [blame] | 159 | LOG(INFO, "Canceling current action\n"); |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 160 | if (current_action_) { |
| 161 | current_action_->Cancel(); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | // Cancels all running actions. |
| 166 | void CancelAllActions() { |
Brian Silverman | 101b964 | 2014-03-08 12:45:16 -0800 | [diff] [blame] | 167 | LOG(DEBUG, "Cancelling all actions\n"); |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 168 | if (current_action_) { |
| 169 | current_action_->Cancel(); |
| 170 | } |
| 171 | next_action_.reset(); |
| 172 | } |
| 173 | |
| 174 | // Runs the next action when the current one is finished running. |
| 175 | void Tick() { |
| 176 | if (current_action_) { |
| 177 | if (!current_action_->Running()) { |
Austin Schuh | c95c2b7 | 2014-03-02 11:56:49 -0800 | [diff] [blame] | 178 | LOG(INFO, "Action is done.\n"); |
| 179 | current_action_ = ::std::move(next_action_); |
| 180 | if (current_action_) { |
| 181 | LOG(INFO, "Running next action\n"); |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 182 | current_action_->Start(); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | // Returns true if any action is running or could be running. |
| 189 | // For a one cycle faster response, call Tick before running this. |
Brian Silverman | 2c1e034 | 2014-04-11 16:15:01 -0700 | [diff] [blame] | 190 | bool Running() { return static_cast<bool>(current_action_); } |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 191 | |
| 192 | private: |
| 193 | ::std::unique_ptr<Action> current_action_; |
| 194 | ::std::unique_ptr<Action> next_action_; |
| 195 | }; |
| 196 | |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 197 | |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 198 | class Reader : public ::aos::input::JoystickInput { |
| 199 | public: |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 200 | Reader() |
Brian Silverman | e3a277a | 2014-04-13 14:56:57 -0700 | [diff] [blame] | 201 | : is_high_gear_(false), |
Austin Schuh | 9cb836e | 2014-02-23 19:25:55 -0800 | [diff] [blame] | 202 | shot_power_(80.0), |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 203 | goal_angle_(0.0), |
Brian Silverman | 545f2ad | 2014-03-14 12:31:42 -0700 | [diff] [blame] | 204 | separation_angle_(kGrabSeparation), |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 205 | velocity_compensation_(0.0), |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 206 | intake_power_(0.0), |
| 207 | was_running_(false) {} |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 208 | |
| 209 | virtual void RunIteration(const ::aos::input::driver_station::Data &data) { |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 210 | if (data.GetControlBit(ControlBit::kAutonomous)) { |
| 211 | if (data.PosEdge(ControlBit::kEnabled)){ |
| 212 | LOG(INFO, "Starting auto mode\n"); |
| 213 | ::frc971::autonomous::autonomous.MakeWithBuilder() |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 214 | .run_auto(true) |
| 215 | .Send(); |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 216 | } else if (data.NegEdge(ControlBit::kEnabled)) { |
| 217 | LOG(INFO, "Stopping auto mode\n"); |
| 218 | ::frc971::autonomous::autonomous.MakeWithBuilder() |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 219 | .run_auto(false) |
| 220 | .Send(); |
Brian Silverman | 2c764f0 | 2014-04-25 09:21:21 -0500 | [diff] [blame] | 221 | } else if (!data.GetControlBit(ControlBit::kEnabled)) { |
| 222 | { |
| 223 | auto goal = drivetrain.goal.MakeMessage(); |
| 224 | goal->Zero(); |
| 225 | goal->control_loop_driving = false; |
| 226 | goal->left_goal = goal->right_goal = 0; |
| 227 | goal->left_velocity_goal = goal->right_velocity_goal = 0; |
| 228 | if (!goal.Send()) { |
| 229 | LOG(WARNING, "sending 0 drivetrain goal failed\n"); |
| 230 | } |
| 231 | } |
| 232 | { |
| 233 | // TODO(brians): Make sure this doesn't make it unbrake and not move |
| 234 | // or something weird. |
| 235 | auto goal = control_loops::shooter_queue_group.goal.MakeMessage(); |
| 236 | goal->Zero(); |
| 237 | if (!goal.Send()) { |
| 238 | LOG(WARNING, "sending 0 shooter goal failed\n"); |
| 239 | } |
| 240 | } |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 241 | } |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 242 | } else { |
| 243 | HandleTeleop(data); |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 244 | } |
| 245 | } |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 246 | |
| 247 | void HandleDrivetrain(const ::aos::input::driver_station::Data &data) { |
| 248 | bool is_control_loop_driving = false; |
| 249 | double left_goal = 0.0; |
| 250 | double right_goal = 0.0; |
| 251 | const double wheel = -data.GetAxis(kSteeringWheel); |
| 252 | const double throttle = -data.GetAxis(kDriveThrottle); |
| 253 | const double kThrottleGain = 1.0 / 2.5; |
| 254 | if (false && (data.IsPressed(kDriveControlLoopEnable1) || |
| 255 | data.IsPressed(kDriveControlLoopEnable2))) { |
| 256 | // TODO(austin): Static sucks! |
| 257 | static double distance = 0.0; |
| 258 | static double angle = 0.0; |
| 259 | static double filtered_goal_distance = 0.0; |
| 260 | if (data.PosEdge(kDriveControlLoopEnable1) || |
| 261 | data.PosEdge(kDriveControlLoopEnable2)) { |
Brian Silverman | 6bf0d3c | 2014-03-08 12:52:54 -0800 | [diff] [blame] | 262 | if (drivetrain.position.FetchLatest() && gyro_reading.FetchLatest()) { |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 263 | distance = (drivetrain.position->left_encoder + |
| 264 | drivetrain.position->right_encoder) / |
| 265 | 2.0 - |
| 266 | throttle * kThrottleGain / 2.0; |
Brian Silverman | 6bf0d3c | 2014-03-08 12:52:54 -0800 | [diff] [blame] | 267 | angle = gyro_reading->angle; |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 268 | filtered_goal_distance = distance; |
| 269 | } |
| 270 | } |
| 271 | is_control_loop_driving = true; |
| 272 | |
| 273 | // const double gyro_angle = Gyro.View().angle; |
| 274 | const double goal_theta = angle - wheel * 0.27; |
| 275 | const double goal_distance = distance + throttle * kThrottleGain; |
| 276 | const double robot_width = 22.0 / 100.0 * 2.54; |
| 277 | const double kMaxVelocity = 0.6; |
| 278 | if (goal_distance > kMaxVelocity * 0.02 + filtered_goal_distance) { |
| 279 | filtered_goal_distance += kMaxVelocity * 0.02; |
| 280 | } else if (goal_distance < |
| 281 | -kMaxVelocity * 0.02 + filtered_goal_distance) { |
| 282 | filtered_goal_distance -= kMaxVelocity * 0.02; |
| 283 | } else { |
| 284 | filtered_goal_distance = goal_distance; |
| 285 | } |
| 286 | left_goal = filtered_goal_distance - robot_width * goal_theta / 2.0; |
| 287 | right_goal = filtered_goal_distance + robot_width * goal_theta / 2.0; |
| 288 | is_high_gear_ = false; |
| 289 | |
| 290 | LOG(DEBUG, "Left goal %f Right goal %f\n", left_goal, right_goal); |
| 291 | } |
| 292 | if (!drivetrain.goal.MakeWithBuilder() |
| 293 | .steering(wheel) |
| 294 | .throttle(throttle) |
| 295 | .highgear(is_high_gear_) |
| 296 | .quickturn(data.IsPressed(kQuickTurn)) |
| 297 | .control_loop_driving(is_control_loop_driving) |
| 298 | .left_goal(left_goal) |
| 299 | .right_goal(right_goal) |
Brian Silverman | 2c764f0 | 2014-04-25 09:21:21 -0500 | [diff] [blame] | 300 | .left_velocity_goal(0) |
| 301 | .right_velocity_goal(0) |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 302 | .Send()) { |
| 303 | LOG(WARNING, "sending stick values failed\n"); |
| 304 | } |
| 305 | if (data.PosEdge(kShiftHigh)) { |
| 306 | is_high_gear_ = false; |
| 307 | } |
| 308 | if (data.PosEdge(kShiftLow)) { |
| 309 | is_high_gear_ = true; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | void SetGoal(ClawGoal goal) { |
| 314 | goal_angle_ = goal.angle; |
| 315 | separation_angle_ = goal.separation; |
Brian | 7e29439 | 2014-03-31 12:39:13 -0700 | [diff] [blame] | 316 | moving_for_shot_ = false; |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 317 | velocity_compensation_ = 0.0; |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 318 | intake_power_ = 0.0; |
| 319 | } |
| 320 | |
| 321 | void SetGoal(ShotGoal goal) { |
| 322 | goal_angle_ = goal.claw.angle; |
Brian | 7e29439 | 2014-03-31 12:39:13 -0700 | [diff] [blame] | 323 | shot_separation_angle_ = goal.claw.separation; |
| 324 | separation_angle_ = kGrabSeparation; |
| 325 | moving_for_shot_ = true; |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 326 | shot_power_ = goal.shot_power; |
| 327 | velocity_compensation_ = goal.velocity_compensation; |
| 328 | intake_power_ = goal.intake_power; |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | void HandleTeleop(const ::aos::input::driver_station::Data &data) { |
| 332 | HandleDrivetrain(data); |
Austin Schuh | c95c2b7 | 2014-03-02 11:56:49 -0800 | [diff] [blame] | 333 | if (!data.GetControlBit(ControlBit::kEnabled)) { |
| 334 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 335 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | c95c2b7 | 2014-03-02 11:56:49 -0800 | [diff] [blame] | 336 | } |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 337 | if (data.IsPressed(kRollersIn) || data.IsPressed(kRollersOut)) { |
| 338 | intake_power_ = 0.0; |
Brian Silverman | 545f2ad | 2014-03-14 12:31:42 -0700 | [diff] [blame] | 339 | separation_angle_ = kGrabSeparation; |
Brian | 7e29439 | 2014-03-31 12:39:13 -0700 | [diff] [blame] | 340 | moving_for_shot_ = false; |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 341 | } |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 342 | |
Brian Silverman | 18f6e64 | 2014-03-13 18:52:47 -0700 | [diff] [blame] | 343 | static const double kAdjustClawGoalDeadband = 0.08; |
| 344 | double claw_goal_adjust = data.GetAxis(kAdjustClawGoal); |
| 345 | if (::std::abs(claw_goal_adjust) < kAdjustClawGoalDeadband) { |
| 346 | claw_goal_adjust = 0; |
| 347 | } else { |
| 348 | claw_goal_adjust = (claw_goal_adjust - |
| 349 | ((claw_goal_adjust < 0) ? -kAdjustClawGoalDeadband |
| 350 | : kAdjustClawGoalDeadband)) * |
| 351 | 0.035; |
| 352 | } |
| 353 | double claw_separation_adjust = data.GetAxis(kAdjustClawSeparation); |
| 354 | if (::std::abs(claw_separation_adjust) < kAdjustClawGoalDeadband) { |
| 355 | claw_separation_adjust = 0; |
| 356 | } else { |
| 357 | claw_separation_adjust = |
| 358 | (claw_separation_adjust - |
| 359 | ((claw_separation_adjust < 0) ? -kAdjustClawGoalDeadband |
| 360 | : kAdjustClawGoalDeadband)) * |
| 361 | -0.035; |
| 362 | } |
| 363 | |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 364 | if (data.GetAxis(kFlipRobot) > 0.9) { |
Brian Silverman | 18f6e64 | 2014-03-13 18:52:47 -0700 | [diff] [blame] | 365 | claw_goal_adjust += claw_separation_adjust; |
| 366 | claw_goal_adjust *= -1; |
| 367 | |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 368 | if (data.IsPressed(kIntakeOpenPosition)) { |
| 369 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 370 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 371 | SetGoal(kFlippedIntakeOpenGoal); |
| 372 | } else if (data.IsPressed(kIntakePosition)) { |
| 373 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 374 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 375 | SetGoal(kFlippedIntakeGoal); |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 376 | } else if (data.IsPressed(kVerticalTuck)) { |
| 377 | action_queue_.CancelAllActions(); |
| 378 | LOG(DEBUG, "Canceling\n"); |
| 379 | SetGoal(kVerticalTuckGoal); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 380 | } else if (data.IsPressed(kTuck)) { |
| 381 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 382 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 383 | SetGoal(kFlippedTuckGoal); |
| 384 | } else if (data.PosEdge(kLongShot)) { |
| 385 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 386 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 387 | SetGoal(kFlippedLongShotGoal); |
| 388 | } else if (data.PosEdge(kMediumShot)) { |
| 389 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 390 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 391 | SetGoal(kFlippedMediumShotGoal); |
| 392 | } else if (data.PosEdge(kShortShot)) { |
| 393 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 394 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 395 | SetGoal(kFlippedShortShotGoal); |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 396 | } else if (data.PosEdge(kHumanPlayerShot)) { |
| 397 | action_queue_.CancelAllActions(); |
| 398 | LOG(DEBUG, "Canceling\n"); |
Brian Silverman | 73c4839 | 2014-04-05 07:07:41 -0700 | [diff] [blame] | 399 | SetGoal(kFlippedHumanShotGoal); |
Brian Silverman | 8d5dda4 | 2014-04-06 15:59:49 -0700 | [diff] [blame] | 400 | } else if (data.PosEdge(kUserLeft)) { |
| 401 | action_queue_.CancelAllActions(); |
| 402 | LOG(DEBUG, "Canceling\n"); |
| 403 | SetGoal(kFlipped254PassGoal); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 404 | } else if (data.PosEdge(kTrussShot)) { |
| 405 | action_queue_.CancelAllActions(); |
| 406 | LOG(DEBUG, "Canceling\n"); |
Brian Silverman | 73c4839 | 2014-04-05 07:07:41 -0700 | [diff] [blame] | 407 | SetGoal(kFlippedTrussShotGoal); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 408 | } |
| 409 | } else { |
| 410 | if (data.IsPressed(kIntakeOpenPosition)) { |
| 411 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 412 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 413 | SetGoal(kIntakeOpenGoal); |
| 414 | } else if (data.IsPressed(kIntakePosition)) { |
| 415 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 416 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 417 | SetGoal(kIntakeGoal); |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 418 | } else if (data.IsPressed(kVerticalTuck)) { |
| 419 | action_queue_.CancelAllActions(); |
| 420 | LOG(DEBUG, "Canceling\n"); |
| 421 | SetGoal(kVerticalTuckGoal); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 422 | } else if (data.IsPressed(kTuck)) { |
| 423 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 424 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 425 | SetGoal(kTuckGoal); |
| 426 | } else if (data.PosEdge(kLongShot)) { |
| 427 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 428 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 429 | SetGoal(kLongShotGoal); |
| 430 | } else if (data.PosEdge(kMediumShot)) { |
| 431 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 432 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 433 | SetGoal(kMediumShotGoal); |
| 434 | } else if (data.PosEdge(kShortShot)) { |
| 435 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 436 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 437 | SetGoal(kShortShotGoal); |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 438 | } else if (data.PosEdge(kHumanPlayerShot)) { |
| 439 | action_queue_.CancelAllActions(); |
| 440 | LOG(DEBUG, "Canceling\n"); |
| 441 | SetGoal(kHumanShotGoal); |
Brian Silverman | 8d5dda4 | 2014-04-06 15:59:49 -0700 | [diff] [blame] | 442 | } else if (data.PosEdge(kUserLeft)) { |
| 443 | action_queue_.CancelAllActions(); |
| 444 | LOG(DEBUG, "Canceling\n"); |
| 445 | SetGoal(k254PassGoal); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 446 | } else if (data.PosEdge(kTrussShot)) { |
| 447 | action_queue_.CancelAllActions(); |
| 448 | LOG(DEBUG, "Canceling\n"); |
| 449 | SetGoal(kTrussShotGoal); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 450 | } |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 451 | } |
| 452 | |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 453 | /* |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 454 | if (data.PosEdge(kCatch)) { |
| 455 | auto catch_action = MakeCatchAction(); |
| 456 | catch_action->GetGoal()->catch_angle = goal_angle_; |
| 457 | action_queue_.QueueAction(::std::move(catch_action)); |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 458 | } |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 459 | */ |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 460 | |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 461 | if (data.PosEdge(kFire)) { |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 462 | action_queue_.QueueAction(actions::MakeShootAction()); |
Brian Silverman | 9f863a0 | 2014-03-29 17:42:36 -0700 | [diff] [blame] | 463 | } else if (data.NegEdge(kFire)) { |
| 464 | action_queue_.CancelCurrentAction(); |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 465 | } |
| 466 | |
| 467 | action_queue_.Tick(); |
Austin Schuh | c95c2b7 | 2014-03-02 11:56:49 -0800 | [diff] [blame] | 468 | if (data.IsPressed(kUnload) || data.IsPressed(kReload)) { |
| 469 | action_queue_.CancelAllActions(); |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 470 | LOG(DEBUG, "Canceling\n"); |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 471 | intake_power_ = 0.0; |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 472 | velocity_compensation_ = 0.0; |
Austin Schuh | c95c2b7 | 2014-03-02 11:56:49 -0800 | [diff] [blame] | 473 | } |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 474 | |
| 475 | // Send out the claw and shooter goals if no actions are running. |
| 476 | if (!action_queue_.Running()) { |
Brian Silverman | 18f6e64 | 2014-03-13 18:52:47 -0700 | [diff] [blame] | 477 | goal_angle_ += claw_goal_adjust; |
| 478 | separation_angle_ += claw_separation_adjust; |
| 479 | |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 480 | // If the action just ended, turn the intake off and stop velocity |
| 481 | // compensating. |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 482 | if (was_running_) { |
| 483 | intake_power_ = 0.0; |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 484 | velocity_compensation_ = 0.0; |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | control_loops::drivetrain.status.FetchLatest(); |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 488 | double goal_angle = goal_angle_; |
| 489 | if (control_loops::drivetrain.status.get()) { |
| 490 | goal_angle += |
| 491 | SpeedToAngleOffset(control_loops::drivetrain.status->robot_speed); |
| 492 | } else { |
| 493 | LOG_INTERVAL(no_drivetrain_status_); |
| 494 | } |
Brian | 7e29439 | 2014-03-31 12:39:13 -0700 | [diff] [blame] | 495 | |
| 496 | if (moving_for_shot_) { |
| 497 | auto &claw_status = control_loops::claw_queue_group.status; |
| 498 | claw_status.FetchLatest(); |
| 499 | if (claw_status.get()) { |
Brian | 6faa782 | 2014-03-31 18:00:28 -0700 | [diff] [blame] | 500 | if (::std::abs(claw_status->bottom - goal_angle) < 0.2) { |
Brian | 7e29439 | 2014-03-31 12:39:13 -0700 | [diff] [blame] | 501 | moving_for_shot_ = false; |
| 502 | separation_angle_ = shot_separation_angle_; |
| 503 | } |
| 504 | } |
| 505 | } |
| 506 | |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 507 | double separation_angle = separation_angle_; |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 508 | |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 509 | if (data.IsPressed(kCatch)) { |
| 510 | const double kCatchSeparation = 1.0; |
| 511 | goal_angle -= kCatchSeparation / 2.0; |
| 512 | separation_angle = kCatchSeparation; |
| 513 | } |
| 514 | |
| 515 | bool intaking = |
| 516 | data.IsPressed(kRollersIn) || data.IsPressed(kIntakePosition) || |
| 517 | data.IsPressed(kIntakeOpenPosition) || data.IsPressed(kCatch); |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 518 | if (!control_loops::claw_queue_group.goal.MakeWithBuilder() |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 519 | .bottom_angle(goal_angle) |
Austin Schuh | ade6d08 | 2014-03-09 00:53:06 -0800 | [diff] [blame] | 520 | .separation_angle(separation_angle) |
Austin Schuh | 80ff2e1 | 2014-03-08 12:06:19 -0800 | [diff] [blame] | 521 | .intake(intaking ? 12.0 |
| 522 | : (data.IsPressed(kRollersOut) ? -12.0 |
| 523 | : intake_power_)) |
| 524 | .centering(intaking ? 12.0 : 0.0) |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 525 | .Send()) { |
| 526 | LOG(WARNING, "sending claw goal failed\n"); |
| 527 | } |
| 528 | |
| 529 | if (!control_loops::shooter_queue_group.goal.MakeWithBuilder() |
| 530 | .shot_power(shot_power_) |
| 531 | .shot_requested(data.IsPressed(kFire)) |
| 532 | .unload_requested(data.IsPressed(kUnload)) |
| 533 | .load_requested(data.IsPressed(kReload)) |
| 534 | .Send()) { |
| 535 | LOG(WARNING, "sending shooter goal failed\n"); |
| 536 | } |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 537 | } |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 538 | was_running_ = action_queue_.Running(); |
| 539 | } |
| 540 | |
| 541 | double SpeedToAngleOffset(double speed) { |
| 542 | const frc971::constants::Values &values = frc971::constants::GetValues(); |
| 543 | // scale speed to a [0.0-1.0] on something close to the max |
| 544 | // TODO(austin): Change the scale factor for different shots. |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 545 | return (speed / values.drivetrain_max_speed) * velocity_compensation_; |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 546 | } |
| 547 | |
Austin Schuh | 01c652b | 2014-02-21 23:13:42 -0800 | [diff] [blame] | 548 | private: |
Austin Schuh | 58d2368 | 2014-02-23 01:39:50 -0800 | [diff] [blame] | 549 | bool is_high_gear_; |
| 550 | double shot_power_; |
| 551 | double goal_angle_; |
Brian | 7e29439 | 2014-03-31 12:39:13 -0700 | [diff] [blame] | 552 | double separation_angle_, shot_separation_angle_; |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 553 | double velocity_compensation_; |
Austin Schuh | 5d8c5e7 | 2014-03-07 20:24:34 -0800 | [diff] [blame] | 554 | double intake_power_; |
| 555 | bool was_running_; |
Brian | 7e29439 | 2014-03-31 12:39:13 -0700 | [diff] [blame] | 556 | bool moving_for_shot_ = false; |
Austin Schuh | b7dfabc | 2014-03-01 18:57:42 -0800 | [diff] [blame] | 557 | |
| 558 | ActionQueue action_queue_; |
Brian Silverman | a379f00 | 2014-03-22 19:34:53 -0700 | [diff] [blame] | 559 | |
| 560 | ::aos::util::SimpleLogInterval no_drivetrain_status_ = |
| 561 | ::aos::util::SimpleLogInterval(::aos::time::Time::InSeconds(0.2), WARNING, |
| 562 | "no drivetrain status"); |
Brian Silverman | 756f9ff | 2014-01-17 23:40:23 -0800 | [diff] [blame] | 563 | }; |
| 564 | |
| 565 | } // namespace joysticks |
| 566 | } // namespace input |
| 567 | } // namespace frc971 |
| 568 | |
| 569 | int main() { |
| 570 | ::aos::Init(); |
| 571 | ::frc971::input::joysticks::Reader reader; |
| 572 | reader.Run(); |
| 573 | ::aos::Cleanup(); |
| 574 | } |