Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [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/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 Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 15 | #include "y2016/control_loops/shooter/shooter.q.h" |
| 16 | #include "y2016/control_loops/superstructure/superstructure.q.h" |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 17 | #include "y2016/control_loops/superstructure/superstructure.h" |
Comran Morshed | aa0573c | 2016-03-05 19:05:54 +0000 | [diff] [blame] | 18 | #include "y2016/queues/ball_detector.q.h" |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 19 | |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 20 | #include "y2016/constants.h" |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 21 | #include "frc971/queues/gyro.q.h" |
| 22 | #include "frc971/autonomous/auto.q.h" |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 23 | |
| 24 | using ::frc971::control_loops::drivetrain_queue; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 25 | using ::y2016::control_loops::shooter::shooter_queue; |
| 26 | using ::y2016::control_loops::superstructure_queue; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 27 | |
| 28 | using ::aos::input::driver_station::ButtonLocation; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 29 | using ::aos::input::driver_station::ControlBit; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 30 | using ::aos::input::driver_station::JoystickAxis; |
| 31 | using ::aos::input::driver_station::POVLocation; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 32 | |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 33 | namespace y2016 { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 34 | namespace input { |
| 35 | namespace joysticks { |
| 36 | |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 37 | namespace { |
| 38 | |
| 39 | constexpr double kMaxIntakeAngleBeforeArmInterference = control_loops:: |
| 40 | superstructure::CollisionAvoidance::kMaxIntakeAngleBeforeArmInterference; |
| 41 | |
| 42 | } // namespace |
| 43 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 44 | const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2); |
Campbell Crowley | 5b27f02 | 2016-02-20 16:55:35 -0800 | [diff] [blame] | 45 | const ButtonLocation kShiftHigh(2, 3), kShiftHigh2(2, 2), kShiftLow(2, 1); |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 46 | const ButtonLocation kQuickTurn(1, 5); |
| 47 | |
Austin Schuh | 781cdcc | 2016-03-12 13:03:12 -0800 | [diff] [blame] | 48 | const ButtonLocation kTurn1(1, 7); |
| 49 | const ButtonLocation kTurn2(1, 11); |
| 50 | |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 51 | // Buttons on the lexan driver station to get things running on bring-up day. |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 52 | const ButtonLocation kIntakeDown(3, 11); |
| 53 | const POVLocation kFrontLong(3, 180); |
| 54 | const POVLocation kBackLong(3, 0); |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 55 | const POVLocation kBackFender(3, 90); |
| 56 | const POVLocation kFrontFender(3, 270); |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 57 | const ButtonLocation kTest3(3, 7); |
| 58 | const ButtonLocation kIntakeIn(3, 12); |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 59 | const ButtonLocation kTest5(3, 8); |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 60 | const ButtonLocation kFire(3, 3); |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 61 | const ButtonLocation kTest7(3, 5); |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 62 | const ButtonLocation kIntakeOut(3, 9); |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 63 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 64 | class Reader : public ::aos::input::JoystickInput { |
| 65 | public: |
| 66 | Reader() |
| 67 | : is_high_gear_(false), |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 68 | intake_goal_(0.0), |
| 69 | shoulder_goal_(M_PI / 2.0), |
| 70 | wrist_goal_(0.0) {} |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 71 | |
| 72 | void RunIteration(const ::aos::input::driver_station::Data &data) override { |
| 73 | bool last_auto_running = auto_running_; |
| 74 | auto_running_ = data.GetControlBit(ControlBit::kAutonomous) && |
| 75 | data.GetControlBit(ControlBit::kEnabled); |
| 76 | if (auto_running_ != last_auto_running) { |
| 77 | if (auto_running_) { |
| 78 | StartAuto(); |
| 79 | } else { |
| 80 | StopAuto(); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | if (!data.GetControlBit(ControlBit::kAutonomous)) { |
| 85 | HandleDrivetrain(data); |
| 86 | HandleTeleop(data); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void HandleDrivetrain(const ::aos::input::driver_station::Data &data) { |
| 91 | bool is_control_loop_driving = false; |
Austin Schuh | 781cdcc | 2016-03-12 13:03:12 -0800 | [diff] [blame] | 92 | static double left_goal = 0.0; |
| 93 | static double right_goal = 0.0; |
| 94 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 95 | const double wheel = -data.GetAxis(kSteeringWheel); |
| 96 | const double throttle = -data.GetAxis(kDriveThrottle); |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 97 | |
Austin Schuh | 781cdcc | 2016-03-12 13:03:12 -0800 | [diff] [blame] | 98 | if (data.PosEdge(kTurn1) || data.PosEdge(kTurn2)) { |
| 99 | drivetrain_queue.status.FetchLatest(); |
| 100 | if (drivetrain_queue.status.get()) { |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 101 | left_goal = drivetrain_queue.status->estimated_left_position; |
| 102 | right_goal = drivetrain_queue.status->estimated_right_position; |
Austin Schuh | 781cdcc | 2016-03-12 13:03:12 -0800 | [diff] [blame] | 103 | } |
| 104 | } |
| 105 | if (data.IsPressed(kTurn1) || data.IsPressed(kTurn2)) { |
| 106 | is_control_loop_driving = true; |
| 107 | } |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 108 | if (!drivetrain_queue.goal.MakeWithBuilder() |
| 109 | .steering(wheel) |
| 110 | .throttle(throttle) |
| 111 | .highgear(is_high_gear_) |
| 112 | .quickturn(data.IsPressed(kQuickTurn)) |
| 113 | .control_loop_driving(is_control_loop_driving) |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 114 | .left_goal(left_goal - wheel * 0.5 + throttle * 0.3) |
| 115 | .right_goal(right_goal + wheel * 0.5 + throttle * 0.3) |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 116 | .left_velocity_goal(0) |
| 117 | .right_velocity_goal(0) |
| 118 | .Send()) { |
| 119 | LOG(WARNING, "sending stick values failed\n"); |
| 120 | } |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 121 | |
Campbell Crowley | 5b27f02 | 2016-02-20 16:55:35 -0800 | [diff] [blame] | 122 | if (data.PosEdge(kShiftLow)) { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 123 | is_high_gear_ = false; |
| 124 | } |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 125 | |
Campbell Crowley | 5b27f02 | 2016-02-20 16:55:35 -0800 | [diff] [blame] | 126 | if (data.PosEdge(kShiftHigh) || data.PosEdge(kShiftHigh2)) { |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 127 | is_high_gear_ = true; |
| 128 | } |
| 129 | } |
| 130 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 131 | void HandleTeleop(const ::aos::input::driver_station::Data &data) { |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 132 | // Default the intake to up. |
| 133 | intake_goal_ = constants::Values::kIntakeRange.upper - 0.04; |
| 134 | |
| 135 | bool force_lights_on = false; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 136 | if (!data.GetControlBit(ControlBit::kEnabled)) { |
| 137 | action_queue_.CancelAllActions(); |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 138 | LOG(DEBUG, "Canceling\n"); |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 139 | } |
| 140 | |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 141 | if (data.PosEdge(ControlBit::kEnabled)) { |
| 142 | // If we got enabled, wait for everything to zero. |
| 143 | LOG(INFO, "Waiting for zero.\n"); |
| 144 | waiting_for_zero_ = true; |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 145 | is_high_gear_ = true; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | superstructure_queue.status.FetchLatest(); |
| 149 | if (!superstructure_queue.status.get()) { |
| 150 | LOG(ERROR, "Got no superstructure status packet.\n"); |
| 151 | } |
| 152 | |
| 153 | if (superstructure_queue.status.get() && |
| 154 | superstructure_queue.status->zeroed) { |
| 155 | if (waiting_for_zero_) { |
| 156 | LOG(INFO, "Zeroed! Starting teleop mode.\n"); |
| 157 | waiting_for_zero_ = false; |
| 158 | } |
| 159 | } else { |
| 160 | waiting_for_zero_ = true; |
| 161 | } |
| 162 | |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 163 | if (data.IsPressed(kFrontLong)) { |
| 164 | // Forwards shot |
Austin Schuh | 5a6db4d | 2016-02-28 22:02:42 -0800 | [diff] [blame] | 165 | shoulder_goal_ = M_PI / 2.0 - 0.2; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 166 | wrist_goal_ = M_PI + 0.42; |
| 167 | shooter_velocity_ = 640.0; |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 168 | intake_goal_ = kMaxIntakeAngleBeforeArmInterference; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 169 | } else if (data.IsPressed(kBackLong)) { |
| 170 | // Backwards shot |
| 171 | shoulder_goal_ = M_PI / 2.0 - 0.2; |
| 172 | wrist_goal_ = -0.59; |
| 173 | shooter_velocity_ = 640.0; |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 174 | intake_goal_ = kMaxIntakeAngleBeforeArmInterference; |
| 175 | } else if (data.IsPressed(kBackFender)) { |
| 176 | // Fender shot back |
| 177 | shoulder_goal_ = 0.65; |
| 178 | wrist_goal_ = -1.0; |
| 179 | shooter_velocity_ = 550.0; |
| 180 | intake_goal_ = kMaxIntakeAngleBeforeArmInterference; |
| 181 | } else if (data.IsPressed(kFrontFender)) { |
| 182 | // Fender shot back |
| 183 | shoulder_goal_ = 1.45; |
| 184 | wrist_goal_ = 2.5 + 1.7; |
| 185 | shooter_velocity_ = 550.0; |
| 186 | intake_goal_ = kMaxIntakeAngleBeforeArmInterference; |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 187 | } else { |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 188 | wrist_goal_ = 0.0; |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 189 | shoulder_goal_ = -0.010; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 190 | shooter_velocity_ = 0.0; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 191 | } |
| 192 | |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 193 | if (data.IsPressed(kTest3)) { |
| 194 | wrist_goal_ = 0.0; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 195 | } |
| 196 | |
Comran Morshed | aa0573c | 2016-03-05 19:05:54 +0000 | [diff] [blame] | 197 | bool ball_detected = false; |
| 198 | ::y2016::sensors::ball_detector.FetchLatest(); |
| 199 | if (::y2016::sensors::ball_detector.get()) { |
| 200 | ball_detected = ::y2016::sensors::ball_detector->voltage > 2.5; |
| 201 | } |
| 202 | if (data.PosEdge(kIntakeIn)) { |
| 203 | saw_ball_when_started_intaking_ = ball_detected; |
| 204 | } |
| 205 | |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 206 | if (data.IsPressed(kIntakeIn)) { |
| 207 | is_intaking_ = (!ball_detected || saw_ball_when_started_intaking_); |
| 208 | if (ball_detected) { |
| 209 | force_lights_on = true; |
| 210 | } |
| 211 | } else { |
| 212 | is_intaking_ = false; |
| 213 | } |
| 214 | |
| 215 | if (data.IsPressed(kIntakeDown)) { |
| 216 | if (is_intaking_) { |
| 217 | intake_goal_ = 0.1; |
| 218 | } else { |
| 219 | intake_goal_ = -0.05; |
| 220 | } |
| 221 | } |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 222 | |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 223 | if (data.IsPressed(kFire) && shooter_velocity_ != 0.0) { |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 224 | fire_ = true; |
| 225 | } else { |
| 226 | fire_ = false; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | if (data.PosEdge(kTest7)) { |
| 230 | } |
| 231 | |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 232 | is_outtaking_ = data.IsPressed(kIntakeOut); |
Austin Schuh | 5a6db4d | 2016-02-28 22:02:42 -0800 | [diff] [blame] | 233 | |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 234 | if (!waiting_for_zero_) { |
| 235 | if (!action_queue_.Running()) { |
| 236 | auto new_superstructure_goal = superstructure_queue.goal.MakeMessage(); |
| 237 | new_superstructure_goal->angle_intake = intake_goal_; |
| 238 | new_superstructure_goal->angle_shoulder = shoulder_goal_; |
| 239 | new_superstructure_goal->angle_wrist = wrist_goal_; |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 240 | |
| 241 | new_superstructure_goal->max_angular_velocity_intake = 7.0; |
| 242 | new_superstructure_goal->max_angular_velocity_shoulder = 4.0; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 243 | new_superstructure_goal->max_angular_velocity_wrist = 10.0; |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 244 | new_superstructure_goal->max_angular_acceleration_intake = 40.0; |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 245 | new_superstructure_goal->max_angular_acceleration_shoulder = 10.0; |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 246 | new_superstructure_goal->max_angular_acceleration_wrist = 25.0; |
| 247 | |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 248 | // Granny mode |
Austin Schuh | 4ea06c1 | 2016-03-12 17:54:31 -0800 | [diff] [blame] | 249 | /* |
Austin Schuh | 3f0b119 | 2016-03-12 13:03:56 -0800 | [diff] [blame] | 250 | new_superstructure_goal->max_angular_velocity_intake = 0.2; |
| 251 | new_superstructure_goal->max_angular_velocity_shoulder = 0.2; |
| 252 | new_superstructure_goal->max_angular_velocity_wrist = 0.2; |
| 253 | new_superstructure_goal->max_angular_acceleration_intake = 1.0; |
| 254 | new_superstructure_goal->max_angular_acceleration_shoulder = 1.0; |
| 255 | new_superstructure_goal->max_angular_acceleration_wrist = 1.0; |
| 256 | */ |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 257 | if (is_intaking_) { |
| 258 | new_superstructure_goal->voltage_top_rollers = 12.0; |
Austin Schuh | 5a6db4d | 2016-02-28 22:02:42 -0800 | [diff] [blame] | 259 | new_superstructure_goal->voltage_bottom_rollers = 12.0; |
| 260 | } else if (is_outtaking_) { |
| 261 | new_superstructure_goal->voltage_top_rollers = -12.0; |
| 262 | new_superstructure_goal->voltage_bottom_rollers = -7.0; |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 263 | } else { |
| 264 | new_superstructure_goal->voltage_top_rollers = 0.0; |
| 265 | new_superstructure_goal->voltage_bottom_rollers = 0.0; |
| 266 | } |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 267 | |
| 268 | if (!new_superstructure_goal.Send()) { |
| 269 | LOG(ERROR, "Sending superstructure goal failed.\n"); |
| 270 | } else { |
| 271 | LOG(DEBUG, "sending goals: intake: %f, shoulder: %f, wrist: %f\n", |
| 272 | intake_goal_, shoulder_goal_, wrist_goal_); |
| 273 | } |
| 274 | |
| 275 | if (!shooter_queue.goal.MakeWithBuilder() |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 276 | .angular_velocity(shooter_velocity_) |
Austin Schuh | 5a6db4d | 2016-02-28 22:02:42 -0800 | [diff] [blame] | 277 | .clamp_open(is_intaking_ || is_outtaking_) |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 278 | .push_to_shooter(fire_) |
Austin Schuh | 45d07f6 | 2016-03-13 15:33:31 -0700 | [diff] [blame^] | 279 | .force_lights_on(force_lights_on) |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 280 | .Send()) { |
| 281 | LOG(ERROR, "Sending shooter goal failed.\n"); |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 286 | was_running_ = action_queue_.Running(); |
| 287 | } |
| 288 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 289 | private: |
| 290 | void StartAuto() { |
| 291 | LOG(INFO, "Starting auto mode\n"); |
| 292 | ::frc971::autonomous::autonomous.MakeWithBuilder().run_auto(true).Send(); |
| 293 | } |
| 294 | |
| 295 | void StopAuto() { |
| 296 | LOG(INFO, "Stopping auto mode\n"); |
| 297 | ::frc971::autonomous::autonomous.MakeWithBuilder().run_auto(false).Send(); |
| 298 | } |
| 299 | |
| 300 | bool is_high_gear_; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 301 | // Whatever these are set to are our default goals to send out after zeroing. |
| 302 | double intake_goal_; |
| 303 | double shoulder_goal_; |
| 304 | double wrist_goal_; |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 305 | double shooter_velocity_ = 0.0; |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 306 | |
| 307 | bool was_running_ = false; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 308 | bool auto_running_ = false; |
| 309 | |
Comran Morshed | 200dd4b | 2016-02-16 17:54:58 +0000 | [diff] [blame] | 310 | // If we're waiting for the subsystems to zero. |
| 311 | bool waiting_for_zero_ = true; |
| 312 | |
Comran Morshed | aa0573c | 2016-03-05 19:05:54 +0000 | [diff] [blame] | 313 | // If true, the ball was present when the intaking button was pressed. |
| 314 | bool saw_ball_when_started_intaking_ = false; |
| 315 | |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 316 | bool is_intaking_ = false; |
Austin Schuh | 5a6db4d | 2016-02-28 22:02:42 -0800 | [diff] [blame] | 317 | bool is_outtaking_ = false; |
Austin Schuh | de802e9 | 2016-02-27 14:49:03 -0800 | [diff] [blame] | 318 | bool fire_ = false; |
| 319 | |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 320 | ::aos::common::actions::ActionQueue action_queue_; |
| 321 | |
| 322 | ::aos::util::SimpleLogInterval no_drivetrain_status_ = |
| 323 | ::aos::util::SimpleLogInterval(::aos::time::Time::InSeconds(0.2), WARNING, |
| 324 | "no drivetrain status"); |
| 325 | }; |
| 326 | |
| 327 | } // namespace joysticks |
| 328 | } // namespace input |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 329 | } // namespace y2016 |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 330 | |
| 331 | int main() { |
| 332 | ::aos::Init(-1); |
Comran Morshed | 6c6a0a9 | 2016-01-17 12:45:16 +0000 | [diff] [blame] | 333 | ::y2016::input::joysticks::Reader reader; |
Comran Morshed | 9a9948c | 2016-01-16 15:58:04 +0000 | [diff] [blame] | 334 | reader.Run(); |
| 335 | ::aos::Cleanup(); |
| 336 | } |