Sabina Davis | 82b1918 | 2017-11-10 09:30:25 -0800 | [diff] [blame] | 1 | #include <math.h> |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 2 | #include <stdio.h> |
| 3 | #include <string.h> |
| 4 | #include <unistd.h> |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 5 | |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 6 | #include "aos/actions/actions.h" |
| 7 | #include "aos/input/driver_station_data.h" |
| 8 | #include "aos/logging/logging.h" |
| 9 | #include "aos/time/time.h" |
| 10 | #include "aos/util/log_interval.h" |
Sabina Davis | 92d2efa | 2017-11-04 22:35:25 -0700 | [diff] [blame] | 11 | #include "aos/input/drivetrain_input.h" |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame^] | 12 | #include "aos/input/action_joystick_input.h" |
John Park | 398c74a | 2018-10-20 21:17:39 -0700 | [diff] [blame] | 13 | #include "aos/init.h" |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 14 | #include "frc971/autonomous/auto.q.h" |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 15 | #include "frc971/autonomous/base_autonomous_actor.h" |
| 16 | #include "frc971/control_loops/drivetrain/drivetrain.q.h" |
| 17 | #include "y2017/constants.h" |
| 18 | #include "y2017/control_loops/superstructure/superstructure.q.h" |
Sabina Davis | 82b1918 | 2017-11-10 09:30:25 -0800 | [diff] [blame] | 19 | #include "y2017/control_loops/drivetrain/drivetrain_base.h" |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 20 | |
| 21 | using ::frc971::control_loops::drivetrain_queue; |
| 22 | using ::y2017::control_loops::superstructure_queue; |
| 23 | |
| 24 | using ::aos::input::driver_station::ButtonLocation; |
| 25 | using ::aos::input::driver_station::ControlBit; |
| 26 | using ::aos::input::driver_station::JoystickAxis; |
| 27 | using ::aos::input::driver_station::POVLocation; |
Sabina Davis | 92d2efa | 2017-11-04 22:35:25 -0700 | [diff] [blame] | 28 | using ::aos::input::DrivetrainInputReader; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 29 | |
| 30 | namespace y2017 { |
| 31 | namespace input { |
| 32 | namespace joysticks { |
| 33 | |
Austin Schuh | 55c8d30 | 2017-04-05 19:25:37 -0700 | [diff] [blame] | 34 | const ButtonLocation kGearSlotBack(2, 11); |
| 35 | |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 36 | const ButtonLocation kIntakeDown(3, 9); |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 37 | const POVLocation kIntakeUp(3, 90); |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 38 | const ButtonLocation kIntakeIn(3, 12); |
| 39 | const ButtonLocation kIntakeOut(3, 8); |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 40 | const ButtonLocation kFire(3, 3); |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 41 | const ButtonLocation kVisionDistanceShot(3, 7); |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 42 | const ButtonLocation kMiddleShot(3, 6); |
| 43 | const POVLocation kFarShot(3, 270); |
| 44 | |
| 45 | const ButtonLocation kVisionAlign(3, 5); |
| 46 | |
| 47 | const ButtonLocation kReverseIndexer(3, 4); |
| 48 | const ButtonLocation kExtra1(3, 11); |
| 49 | const ButtonLocation kExtra2(3, 10); |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 50 | const ButtonLocation kHang(3, 2); |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 51 | |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame^] | 52 | class Reader : public ::aos::input::ActionJoystickInput { |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 53 | public: |
Austin Schuh | 3e45c75 | 2019-02-02 12:19:11 -0800 | [diff] [blame] | 54 | Reader(::aos::EventLoop *event_loop) |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame^] | 55 | : ::aos::input::ActionJoystickInput( |
| 56 | event_loop, |
| 57 | ::y2017::control_loops::drivetrain::GetDrivetrainConfig(), |
| 58 | DrivetrainInputReader::InputType::kSteeringWheel, {}) {} |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 59 | |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 60 | enum class ShotDistance { VISION_SHOT, MIDDLE_SHOT, FAR_SHOT }; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 61 | |
Austin Schuh | 4b5f7df | 2017-04-16 20:31:12 -0700 | [diff] [blame] | 62 | ShotDistance last_shot_distance_ = ShotDistance::VISION_SHOT; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 63 | |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 64 | void HandleTeleop(const ::aos::input::driver_station::Data &data) { |
| 65 | // Default the intake to in. |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 66 | intake_goal_ = 0.07; |
Adam Snaider | e0554ef | 2017-03-11 23:02:45 -0800 | [diff] [blame] | 67 | bool lights_on = false; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 68 | bool vision_track = false; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 69 | |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 70 | superstructure_queue.status.FetchLatest(); |
| 71 | if (!superstructure_queue.status.get()) { |
| 72 | LOG(ERROR, "Got no superstructure status packet.\n"); |
| 73 | return; |
| 74 | } |
| 75 | |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 76 | if (data.IsPressed(kIntakeUp)) { |
| 77 | intake_goal_ = 0.0; |
Austin Schuh | 3ae4743 | 2017-04-16 19:15:46 -0700 | [diff] [blame] | 78 | turret_goal_ = M_PI / 3.0; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 79 | } |
Austin Schuh | 405724e | 2017-04-09 18:34:18 -0700 | [diff] [blame] | 80 | if (data.IsPressed(kIntakeDown)) { |
| 81 | intake_goal_ = 0.235; |
| 82 | // Don't go quite so far out since we have a gear mech out now. |
| 83 | if (data.IsPressed(kIntakeUp)) { |
| 84 | intake_goal_ = 0.160; |
| 85 | } |
| 86 | } |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 87 | |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 88 | if (data.IsPressed(kVisionAlign)) { |
| 89 | // Align shot using vision |
| 90 | // TODO(campbell): Add vision aligning. |
Adam Snaider | e0554ef | 2017-03-11 23:02:45 -0800 | [diff] [blame] | 91 | lights_on = true; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 92 | vision_track = true; |
| 93 | } |
| 94 | if (data.PosEdge(kMiddleShot)) { |
| 95 | turret_goal_ = -M_PI; |
| 96 | } |
| 97 | if (data.PosEdge(kFarShot)) { |
| 98 | turret_goal_ = 0.0; |
| 99 | } |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 100 | if (data.PosEdge(kVisionDistanceShot)) { |
| 101 | turret_goal_ = 0.0; |
| 102 | } |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 103 | |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 104 | if (data.IsPressed(kVisionDistanceShot)) { |
| 105 | last_shot_distance_ = ShotDistance::VISION_SHOT; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 106 | } else if (data.IsPressed(kMiddleShot)) { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 107 | last_shot_distance_ = ShotDistance::MIDDLE_SHOT; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 108 | } else if (data.IsPressed(kFarShot)) { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 109 | last_shot_distance_ = ShotDistance::FAR_SHOT; |
| 110 | } |
| 111 | |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 112 | if (data.IsPressed(kVisionAlign) || |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 113 | data.IsPressed(kMiddleShot) || data.IsPressed(kFarShot) || |
| 114 | data.IsPressed(kFire)) { |
| 115 | switch (last_shot_distance_) { |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 116 | case ShotDistance::VISION_SHOT: |
Austin Schuh | 4b5f7df | 2017-04-16 20:31:12 -0700 | [diff] [blame] | 117 | hood_goal_ = 0.10; |
| 118 | shooter_velocity_ = 300.0; |
| 119 | |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 120 | vision_distance_shot_ = true; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 121 | break; |
| 122 | case ShotDistance::MIDDLE_SHOT: |
Austin Schuh | 405724e | 2017-04-09 18:34:18 -0700 | [diff] [blame] | 123 | hood_goal_ = 0.43 - 0.00; |
Austin Schuh | 4b5f7df | 2017-04-16 20:31:12 -0700 | [diff] [blame] | 124 | shooter_velocity_ = 364.0; |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 125 | vision_distance_shot_ = false; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 126 | break; |
| 127 | case ShotDistance::FAR_SHOT: |
Austin Schuh | 4b5f7df | 2017-04-16 20:31:12 -0700 | [diff] [blame] | 128 | hood_goal_ = 0.47; |
| 129 | shooter_velocity_ = 410.0; |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 130 | vision_distance_shot_ = false; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 131 | break; |
| 132 | } |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 133 | } else { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 134 | //hood_goal_ = 0.15; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 135 | shooter_velocity_ = 0.0; |
| 136 | } |
| 137 | |
| 138 | if (data.IsPressed(kExtra1)) { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 139 | //turret_goal_ = -M_PI * 3.0 / 4.0; |
| 140 | turret_goal_ += 0.150; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 141 | } |
| 142 | if (data.IsPressed(kExtra2)) { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 143 | //turret_goal_ = M_PI * 3.0 / 4.0; |
| 144 | turret_goal_ -= 0.150; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 145 | } |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 146 | turret_goal_ = ::std::max(::std::min(turret_goal_, M_PI), -M_PI); |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 147 | |
| 148 | fire_ = data.IsPressed(kFire) && shooter_velocity_ != 0.0; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 149 | if (data.IsPressed(kVisionAlign)) { |
| 150 | fire_ = fire_ && superstructure_queue.status->turret.vision_tracking; |
| 151 | } |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 152 | |
| 153 | auto new_superstructure_goal = superstructure_queue.goal.MakeMessage(); |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 154 | if (data.IsPressed(kHang)) { |
| 155 | intake_goal_ = 0.23; |
| 156 | } |
| 157 | |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 158 | new_superstructure_goal->intake.distance = intake_goal_; |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 159 | new_superstructure_goal->intake.disable_intake = false; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 160 | new_superstructure_goal->turret.angle = turret_goal_; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 161 | new_superstructure_goal->turret.track = vision_track; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 162 | new_superstructure_goal->hood.angle = hood_goal_; |
| 163 | new_superstructure_goal->shooter.angular_velocity = shooter_velocity_; |
| 164 | |
Austin Schuh | 6a8131b | 2017-04-08 15:39:22 -0700 | [diff] [blame] | 165 | if (data.IsPressed(kIntakeUp)) { |
Austin Schuh | d6fa5e0 | 2017-04-12 20:52:17 -0700 | [diff] [blame] | 166 | new_superstructure_goal->intake.gear_servo = 0.30; |
Austin Schuh | 6a8131b | 2017-04-08 15:39:22 -0700 | [diff] [blame] | 167 | } else { |
| 168 | // Clamp the gear |
Austin Schuh | d6fa5e0 | 2017-04-12 20:52:17 -0700 | [diff] [blame] | 169 | new_superstructure_goal->intake.gear_servo = 0.66; |
Austin Schuh | 6a8131b | 2017-04-08 15:39:22 -0700 | [diff] [blame] | 170 | } |
| 171 | |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 172 | new_superstructure_goal->intake.profile_params.max_velocity = 0.50; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 173 | new_superstructure_goal->hood.profile_params.max_velocity = 5.0; |
| 174 | |
Austin Schuh | 4b5f7df | 2017-04-16 20:31:12 -0700 | [diff] [blame] | 175 | new_superstructure_goal->intake.profile_params.max_acceleration = 3.0; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 176 | if (vision_track) { |
| 177 | new_superstructure_goal->turret.profile_params.max_acceleration = 35.0; |
| 178 | new_superstructure_goal->turret.profile_params.max_velocity = 10.0; |
| 179 | } else { |
| 180 | new_superstructure_goal->turret.profile_params.max_acceleration = 15.0; |
| 181 | new_superstructure_goal->turret.profile_params.max_velocity = 6.0; |
| 182 | } |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 183 | new_superstructure_goal->hood.profile_params.max_acceleration = 25.0; |
| 184 | |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 185 | new_superstructure_goal->intake.voltage_rollers = 0.0; |
Adam Snaider | e0554ef | 2017-03-11 23:02:45 -0800 | [diff] [blame] | 186 | new_superstructure_goal->lights_on = lights_on; |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 187 | |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 188 | if (data.IsPressed(kVisionAlign) && vision_distance_shot_) { |
| 189 | new_superstructure_goal->use_vision_for_shots = true; |
| 190 | } else { |
| 191 | new_superstructure_goal->use_vision_for_shots = false; |
| 192 | } |
| 193 | |
Austin Schuh | 8e4a7ee | 2017-04-05 19:26:06 -0700 | [diff] [blame] | 194 | if (superstructure_queue.status->intake.position > |
| 195 | superstructure_queue.status->intake.unprofiled_goal_position + 0.01) { |
| 196 | intake_accumulator_ = 10; |
| 197 | } |
| 198 | if (intake_accumulator_ > 0) { |
| 199 | --intake_accumulator_; |
| 200 | if (!superstructure_queue.status->intake.estopped) { |
| 201 | new_superstructure_goal->intake.voltage_rollers = 10.0; |
| 202 | } |
| 203 | } |
| 204 | |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 205 | if (data.IsPressed(kHang)) { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 206 | new_superstructure_goal->intake.voltage_rollers = -10.0; |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 207 | new_superstructure_goal->intake.disable_intake = true; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 208 | } else if (data.IsPressed(kIntakeIn) || data.IsPressed(kFire)) { |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame^] | 209 | if (robot_velocity() > 2.0) { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 210 | new_superstructure_goal->intake.voltage_rollers = 12.0; |
| 211 | } else { |
Austin Schuh | 4b5f7df | 2017-04-16 20:31:12 -0700 | [diff] [blame] | 212 | new_superstructure_goal->intake.voltage_rollers = 11.0; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 213 | } |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 214 | } else if (data.IsPressed(kIntakeOut)) { |
| 215 | new_superstructure_goal->intake.voltage_rollers = -8.0; |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 216 | } |
| 217 | if (intake_goal_ < 0.1) { |
| 218 | new_superstructure_goal->intake.voltage_rollers = |
| 219 | ::std::min(8.0, new_superstructure_goal->intake.voltage_rollers); |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | if (data.IsPressed(kReverseIndexer)) { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 223 | new_superstructure_goal->indexer.voltage_rollers = -12.0; |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 224 | new_superstructure_goal->indexer.angular_velocity = 4.0; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 225 | new_superstructure_goal->indexer.angular_velocity = 1.0; |
Austin Schuh | 3028b1d | 2017-03-11 22:12:13 -0800 | [diff] [blame] | 226 | } else if (fire_) { |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 227 | new_superstructure_goal->indexer.voltage_rollers = 12.0; |
| 228 | switch (last_shot_distance_) { |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 229 | case ShotDistance::VISION_SHOT: |
Austin Schuh | 4b5f7df | 2017-04-16 20:31:12 -0700 | [diff] [blame] | 230 | new_superstructure_goal->indexer.angular_velocity = -1.25 * M_PI; |
Austin Schuh | d0629b1 | 2017-03-22 22:37:16 -0700 | [diff] [blame] | 231 | break; |
| 232 | case ShotDistance::MIDDLE_SHOT: |
| 233 | case ShotDistance::FAR_SHOT: |
| 234 | new_superstructure_goal->indexer.angular_velocity = -2.25 * M_PI; |
| 235 | break; |
| 236 | } |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 237 | } else { |
| 238 | new_superstructure_goal->indexer.voltage_rollers = 0.0; |
| 239 | new_superstructure_goal->indexer.angular_velocity = 0.0; |
| 240 | } |
| 241 | |
| 242 | LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal); |
| 243 | if (!new_superstructure_goal.Send()) { |
| 244 | LOG(ERROR, "Sending superstructure goal failed.\n"); |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | private: |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 249 | // Current goals to send to the robot. |
| 250 | double intake_goal_ = 0.0; |
| 251 | double turret_goal_ = 0.0; |
| 252 | double hood_goal_ = 0.3; |
| 253 | double shooter_velocity_ = 0.0; |
Austin Schuh | a250b2d | 2019-05-27 16:14:02 -0700 | [diff] [blame^] | 254 | int intake_accumulator_ = 0; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 255 | |
Parker Schuh | 208a58d | 2017-04-12 20:51:38 -0700 | [diff] [blame] | 256 | bool vision_distance_shot_ = false; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 257 | |
| 258 | bool fire_ = false; |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 259 | }; |
| 260 | |
| 261 | } // namespace joysticks |
| 262 | } // namespace input |
| 263 | } // namespace y2017 |
| 264 | |
| 265 | int main() { |
| 266 | ::aos::Init(-1); |
Austin Schuh | 3e45c75 | 2019-02-02 12:19:11 -0800 | [diff] [blame] | 267 | ::aos::ShmEventLoop event_loop; |
| 268 | ::y2017::input::joysticks::Reader reader(&event_loop); |
Campbell Crowley | 71b5f13 | 2017-02-18 13:16:08 -0800 | [diff] [blame] | 269 | reader.Run(); |
| 270 | ::aos::Cleanup(); |
| 271 | } |