blob: 23bc188a9d63aba174945e39687fd00846d91bb3 [file] [log] [blame]
Sabina Davis91b23602019-01-21 00:06:01 -08001#include <math.h>
2#include <stdio.h>
3#include <string.h>
4#include <unistd.h>
Tyler Chatow4fedeea2019-03-10 15:33:36 -07005#include <chrono>
Sabina Davis91b23602019-01-21 00:06:01 -08006
7#include "aos/actions/actions.h"
8#include "aos/init.h"
9#include "aos/input/action_joystick_input.h"
10#include "aos/input/driver_station_data.h"
11#include "aos/input/drivetrain_input.h"
12#include "aos/input/joystick_input.h"
13#include "aos/logging/logging.h"
14#include "aos/logging/logging.h"
Tyler Chatowe0241452019-03-08 21:07:50 -080015#include "aos/network/team_number.h"
Sabina Davis91b23602019-01-21 00:06:01 -080016#include "aos/util/log_interval.h"
Tyler Chatowe0241452019-03-08 21:07:50 -080017#include "aos/vision/events/udp.h"
18#include "external/com_google_protobuf/src/google/protobuf/stubs/stringprintf.h"
Sabina Davis91b23602019-01-21 00:06:01 -080019#include "frc971/autonomous/auto.q.h"
20#include "frc971/autonomous/base_autonomous_actor.h"
21#include "frc971/control_loops/drivetrain/drivetrain.q.h"
James Kuszmauld8deb682019-03-10 10:38:42 -070022#include "frc971/control_loops/drivetrain/localizer.q.h"
Sabina Davis91b23602019-01-21 00:06:01 -080023
24#include "y2019/control_loops/drivetrain/drivetrain_base.h"
25#include "y2019/control_loops/superstructure/superstructure.q.h"
Sabina Davisc6329342019-03-01 20:44:42 -080026#include "y2019/status_light.q.h"
Tyler Chatowe0241452019-03-08 21:07:50 -080027#include "y2019/vision.pb.h"
Sabina Davis91b23602019-01-21 00:06:01 -080028
29using ::y2019::control_loops::superstructure::superstructure_queue;
James Kuszmauld8deb682019-03-10 10:38:42 -070030using ::frc971::control_loops::drivetrain::localizer_control;
Sabina Davis91b23602019-01-21 00:06:01 -080031using ::aos::input::driver_station::ButtonLocation;
32using ::aos::input::driver_station::ControlBit;
33using ::aos::input::driver_station::JoystickAxis;
34using ::aos::input::driver_station::POVLocation;
Tyler Chatowe0241452019-03-08 21:07:50 -080035using ::aos::events::ProtoTXUdpSocket;
Sabina Davis91b23602019-01-21 00:06:01 -080036
Austin Schuhaab7e162019-03-13 22:44:58 -070037namespace chrono = ::std::chrono;
38
Sabina Davis91b23602019-01-21 00:06:01 -080039namespace y2019 {
40namespace input {
41namespace joysticks {
42
Tyler Chatowe0241452019-03-08 21:07:50 -080043using google::protobuf::StringPrintf;
44
Austin Schuh1a17e132019-02-17 15:05:06 -080045const ButtonLocation kSuctionBall(3, 13);
46const ButtonLocation kSuctionHatch(3, 12);
47const ButtonLocation kDeployStilt(3, 8);
Sabina Davis069cbca2019-03-08 23:35:18 -080048const ButtonLocation kHalfStilt(3, 6);
Austin Schuh1a17e132019-02-17 15:05:06 -080049const ButtonLocation kFallOver(3, 9);
Austin Schuh2cf16b82019-02-15 23:23:22 -080050
Tyler Chatow7bcb52f2019-02-24 00:16:54 -080051struct ElevatorWristPosition {
52 double elevator;
53 double wrist;
54};
Sabina Davis91b23602019-01-21 00:06:01 -080055
Tyler Chatow7bcb52f2019-02-24 00:16:54 -080056const ButtonLocation kRocketForwardLower(5, 1);
57const ButtonLocation kRocketForwardMiddle(5, 2);
58const ButtonLocation kRocketForwardUpper(5, 4);
59const ButtonLocation kCargoForward(5, 3);
60
61const POVLocation kRocketBackwardUnpressed(5, -1);
62const POVLocation kRocketBackwardLower(5, 180);
63const POVLocation kRocketBackwardMiddle(5, 90);
64const POVLocation kRocketBackwardUpper(5, 0);
65const POVLocation kCargoBackward(5, 270);
66
67const ButtonLocation kPanelSwitch(5, 7);
68const ButtonLocation kCargoSwitch(5, 8);
69
70const ButtonLocation kBallHPIntakeForward(5, 6);
71const ButtonLocation kBallHPIntakeBackward(5, 5);
72const JoystickAxis kBallOutake(5, 3);
73const JoystickAxis kBallIntake(5, 4);
74
75const ButtonLocation kPanelHPIntakeForward(5, 6);
76const ButtonLocation kPanelHPIntakeBackward(5, 5);
77
78const ButtonLocation kRelease(2, 4);
James Kuszmauld8deb682019-03-10 10:38:42 -070079const ButtonLocation kResetLocalizer(4, 3);
Tyler Chatow7bcb52f2019-02-24 00:16:54 -080080
Tyler Chatow07c906b2019-03-09 21:29:06 -080081const ButtonLocation kAutoPanel(3, 10);
82const ButtonLocation kAutoPanelIntermediate(4, 6);
83
84const ElevatorWristPosition kAutoPanelPos{0.0, -M_PI / 2.0};
85const ElevatorWristPosition kAutoPanelIntermediatePos{0.34, -M_PI / 2.0};
86
Tyler Chatow7bcb52f2019-02-24 00:16:54 -080087const ElevatorWristPosition kStowPos{0.36, 0.0};
88
89const ElevatorWristPosition kPanelHPIntakeForwrdPos{0.04, M_PI / 2.0};
Sabina Davise6fe6c52019-03-03 15:48:51 -080090const ElevatorWristPosition kPanelHPIntakeBackwardPos{0.05, -M_PI / 2.0};
Tyler Chatow7bcb52f2019-02-24 00:16:54 -080091
92const ElevatorWristPosition kPanelForwardLowerPos{0.0, M_PI / 2.0};
93const ElevatorWristPosition kPanelBackwardLowerPos{0.0, -M_PI / 2.0};
94
Sabina Davise48004f2019-03-02 23:15:24 -080095const ElevatorWristPosition kPanelForwardMiddlePos{0.75, M_PI / 2.0};
96const ElevatorWristPosition kPanelBackwardMiddlePos{0.78, -M_PI / 2.0};
Tyler Chatow7bcb52f2019-02-24 00:16:54 -080097
Sabina Davise48004f2019-03-02 23:15:24 -080098const ElevatorWristPosition kPanelForwardUpperPos{1.51, M_PI / 2.0};
99const ElevatorWristPosition kPanelBackwardUpperPos{1.50, -M_PI / 2.0};
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800100
Sabina Davise6fe6c52019-03-03 15:48:51 -0800101const ElevatorWristPosition kPanelCargoForwardPos{0.0, M_PI / 2.0};
102const ElevatorWristPosition kPanelCargoBackwardPos{0.0, -M_PI / 2.0};
103
104const ElevatorWristPosition kBallForwardLowerPos{0.46, M_PI / 2.0};
105const ElevatorWristPosition kBallBackwardLowerPos{0.15, -M_PI / 2.0};
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800106
Sabina Davise48004f2019-03-02 23:15:24 -0800107const ElevatorWristPosition kBallForwardMiddlePos{1.16, 1.546};
108const ElevatorWristPosition kBallBackwardMiddlePos{0.876021, -1.546};
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800109
Sabina Davise48004f2019-03-02 23:15:24 -0800110const ElevatorWristPosition kBallForwardUpperPos{1.50, 0.961};
111const ElevatorWristPosition kBallBackwardUpperPos{1.41, -1.217};
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800112
Sabina Davise48004f2019-03-02 23:15:24 -0800113const ElevatorWristPosition kBallCargoForwardPos{0.699044, 1.353};
114const ElevatorWristPosition kBallCargoBackwardPos{0.828265, -1.999};
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800115
Sabina Davise6fe6c52019-03-03 15:48:51 -0800116const ElevatorWristPosition kBallHPIntakeForwardPos{0.55, 1.097};
117const ElevatorWristPosition kBallHPIntakeBackwardPos{0.89, -2.018};
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800118
119const ElevatorWristPosition kBallIntakePos{0.29, 2.14};
Austin Schuh2cf16b82019-02-15 23:23:22 -0800120
Sabina Davis91b23602019-01-21 00:06:01 -0800121class Reader : public ::aos::input::ActionJoystickInput {
122 public:
123 Reader(::aos::EventLoop *event_loop)
124 : ::aos::input::ActionJoystickInput(
125 event_loop,
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800126 ::y2019::control_loops::drivetrain::GetDrivetrainConfig()) {
Austin Schuh30cc40a2019-03-12 21:02:13 -0700127 // Set teleop to immediately resume after auto ends for sandstorm mode.
128 set_run_teleop_in_auto(true);
129
Tyler Chatowe0241452019-03-08 21:07:50 -0800130 const uint16_t team = ::aos::network::GetTeamNumber();
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800131 superstructure_queue.goal.FetchLatest();
132 if (superstructure_queue.goal.get()) {
Sabina Davisc6329342019-03-01 20:44:42 -0800133 grab_piece_ = superstructure_queue.goal->suction.grab_piece;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800134 }
Tyler Chatowe0241452019-03-08 21:07:50 -0800135 video_tx_.reset(new ProtoTXUdpSocket<VisionControl>(
136 StringPrintf("10.%d.%d.179", team / 100, team % 100), 5000));
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800137 }
Sabina Davis91b23602019-01-21 00:06:01 -0800138
Austin Schuha78857f2019-03-13 22:43:41 -0700139 void AutoEnded() override {
140 LOG(INFO, "Auto ended, assuming disc and have piece\n");
141 grab_piece_ = true;
142 switch_ball_ = false;
143 }
144
145 void HandleTeleop(const ::aos::input::driver_station::Data &data) override {
Austin Schuhaab7e162019-03-13 22:44:58 -0700146 ::aos::monotonic_clock::time_point monotonic_now =
147 ::aos::monotonic_clock::now();
Sabina Davis91b23602019-01-21 00:06:01 -0800148 superstructure_queue.position.FetchLatest();
149 superstructure_queue.status.FetchLatest();
150 if (!superstructure_queue.status.get() ||
151 !superstructure_queue.position.get()) {
152 LOG(ERROR, "Got no superstructure status packet.\n");
153 return;
154 }
155
Austin Schuhaab7e162019-03-13 22:44:58 -0700156 if (!superstructure_queue.status->has_piece) {
157 last_not_has_piece_ = monotonic_now;
158 }
159
Sabina Davis91b23602019-01-21 00:06:01 -0800160 auto new_superstructure_goal = superstructure_queue.goal.MakeMessage();
161
James Kuszmauld8deb682019-03-10 10:38:42 -0700162 if (data.PosEdge(kResetLocalizer)) {
163 auto localizer_resetter = localizer_control.MakeMessage();
164 localizer_resetter->x = 0.4;
165 localizer_resetter->y = 3.4;
166 localizer_resetter->theta = 0.0;
167 if (!localizer_resetter.Send()) {
168 LOG(ERROR, "Failed to reset localizer.\n");
169 }
170 }
171
Austin Schuh1a17e132019-02-17 15:05:06 -0800172 if (data.IsPressed(kSuctionBall)) {
Sabina Davisc6329342019-03-01 20:44:42 -0800173 grab_piece_ = true;
Austin Schuh1a17e132019-02-17 15:05:06 -0800174 } else if (data.IsPressed(kSuctionHatch)) {
Sabina Davisc6329342019-03-01 20:44:42 -0800175 grab_piece_ = true;
Austin Schuh1a17e132019-02-17 15:05:06 -0800176 } else if (data.IsPressed(kRelease) ||
177 !superstructure_queue.status->has_piece) {
Sabina Davisc6329342019-03-01 20:44:42 -0800178 grab_piece_ = false;
Austin Schuh1a17e132019-02-17 15:05:06 -0800179 }
Sabina Davis91b23602019-01-21 00:06:01 -0800180
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800181 if (data.IsPressed(kRocketBackwardUnpressed)) {
182 elevator_wrist_pos_ = kStowPos;
183 }
184 new_superstructure_goal->intake.unsafe_goal = -1.2;
185 new_superstructure_goal->roller_voltage = 0.0;
186
187 const bool kDoBallIntake = data.GetAxis(kBallIntake) > 0.9;
188 const bool kDoBallOutake = data.GetAxis(kBallOutake) > 0.9;
189
190 if (data.IsPressed(kPanelSwitch)) {
191 switch_ball_ = false;
192 } else if (data.IsPressed(kCargoSwitch)) {
193 switch_ball_ = true;
194 }
195
Sabina Davis91b23602019-01-21 00:06:01 -0800196 // TODO(sabina): max height please?
Austin Schuh77ac3212019-02-19 16:50:14 -0800197 if (data.IsPressed(kFallOver)) {
Austin Schuh1a17e132019-02-17 15:05:06 -0800198 new_superstructure_goal->stilts.unsafe_goal = 0.71;
Michael Schuh587dcb52019-02-28 21:31:03 -0800199 new_superstructure_goal->stilts.profile_params.max_velocity = 0.65;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800200 new_superstructure_goal->stilts.profile_params.max_acceleration = 2.0;
Austin Schuh77ac3212019-02-19 16:50:14 -0800201 } else if (data.IsPressed(kDeployStilt)) {
202 new_superstructure_goal->stilts.unsafe_goal = 0.50;
Michael Schuh587dcb52019-02-28 21:31:03 -0800203 new_superstructure_goal->stilts.profile_params.max_velocity = 0.65;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800204 if (stilts_was_above_) {
205 new_superstructure_goal->stilts.profile_params.max_acceleration = 0.75;
206 } else {
207 new_superstructure_goal->stilts.profile_params.max_acceleration = 2.0;
208 }
Sabina Davis069cbca2019-03-08 23:35:18 -0800209 } else if (data.IsPressed(kHalfStilt)) {
210 new_superstructure_goal->stilts.unsafe_goal = 0.345;
211 new_superstructure_goal->stilts.profile_params.max_velocity = 0.65;
212 new_superstructure_goal->stilts.profile_params.max_acceleration = 0.75;
Sabina Davis91b23602019-01-21 00:06:01 -0800213 } else {
Sabina Davisbfdeb362019-03-09 16:20:01 -0800214 new_superstructure_goal->stilts.unsafe_goal = 0.005;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800215 new_superstructure_goal->stilts.profile_params.max_velocity = 0.25;
216 new_superstructure_goal->stilts.profile_params.max_acceleration = 2.0;
Sabina Davis91b23602019-01-21 00:06:01 -0800217 }
218
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800219 if (superstructure_queue.status->stilts.position > 0.65) {
220 stilts_was_above_ = true;
221 } else if (superstructure_queue.status->stilts.position < 0.1) {
222 stilts_was_above_ = false;
Austin Schuh2cf16b82019-02-15 23:23:22 -0800223 }
224
Tyler Chatow07c906b2019-03-09 21:29:06 -0800225 if (data.IsPressed(kAutoPanel)) {
226 elevator_wrist_pos_ = kAutoPanelPos;
227 } else if (data.IsPressed(kAutoPanelIntermediate)) {
228 elevator_wrist_pos_ = kAutoPanelIntermediatePos;
229 }
230
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800231 if (switch_ball_) {
232 if (superstructure_queue.status->has_piece) {
233 new_superstructure_goal->wrist.profile_params.max_acceleration = 20;
Austin Schuh1a17e132019-02-17 15:05:06 -0800234 }
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800235
236 // Go to intake position and apply vacuum
237 if (data.IsPressed(kBallHPIntakeForward)) {
Sabina Davisc6329342019-03-01 20:44:42 -0800238 grab_piece_ = true;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800239 elevator_wrist_pos_ = kBallHPIntakeForwardPos;
240 } else if (data.IsPressed(kBallHPIntakeBackward)) {
Sabina Davisc6329342019-03-01 20:44:42 -0800241 grab_piece_ = true;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800242 elevator_wrist_pos_ = kBallHPIntakeBackwardPos;
243 }
244
245 // Go to elevator/wrist position. Overrides intake position if pressed so
246 // we can re-grab the ball.
247 if (data.IsPressed(kRocketForwardLower)) {
248 elevator_wrist_pos_ = kBallForwardLowerPos;
249 } else if (data.IsPressed(kRocketBackwardLower)) {
250 elevator_wrist_pos_ = kBallBackwardLowerPos;
251 } else if (data.IsPressed(kRocketForwardMiddle)) {
252 elevator_wrist_pos_ = kBallForwardMiddlePos;
253 } else if (data.IsPressed(kRocketBackwardMiddle)) {
254 elevator_wrist_pos_ = kBallBackwardMiddlePos;
255 } else if (data.IsPressed(kRocketForwardUpper)) {
256 elevator_wrist_pos_ = kBallForwardUpperPos;
257 } else if (data.IsPressed(kRocketBackwardUpper)) {
258 elevator_wrist_pos_ = kBallBackwardUpperPos;
259 } else if (data.IsPressed(kCargoForward)) {
260 elevator_wrist_pos_ = kBallCargoForwardPos;
261 } else if (data.IsPressed(kCargoBackward)) {
262 elevator_wrist_pos_ = kBallCargoBackwardPos;
263 }
Austin Schuh1a17e132019-02-17 15:05:06 -0800264 } else {
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800265 if (data.IsPressed(kPanelHPIntakeForward)) {
Sabina Davisc6329342019-03-01 20:44:42 -0800266 grab_piece_ = true;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800267 elevator_wrist_pos_ = kPanelHPIntakeForwrdPos;
268 } else if (data.IsPressed(kPanelHPIntakeBackward)) {
Sabina Davisc6329342019-03-01 20:44:42 -0800269 grab_piece_ = true;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800270 elevator_wrist_pos_ = kPanelHPIntakeBackwardPos;
271 }
272
273 // Go to elevator/wrist position. Overrides intake position if pressed so
274 // we can re-grab the panel.
275 if (data.IsPressed(kRocketForwardLower)) {
276 elevator_wrist_pos_ = kPanelForwardLowerPos;
277 } else if (data.IsPressed(kRocketBackwardLower)) {
278 elevator_wrist_pos_ = kPanelBackwardLowerPos;
279 } else if (data.IsPressed(kRocketForwardMiddle)) {
280 elevator_wrist_pos_ = kPanelForwardMiddlePos;
281 } else if (data.IsPressed(kRocketBackwardMiddle)) {
282 elevator_wrist_pos_ = kPanelBackwardMiddlePos;
283 } else if (data.IsPressed(kRocketForwardUpper)) {
284 elevator_wrist_pos_ = kPanelForwardUpperPos;
285 } else if (data.IsPressed(kRocketBackwardUpper)) {
286 elevator_wrist_pos_ = kPanelBackwardUpperPos;
Sabina Davise6fe6c52019-03-03 15:48:51 -0800287 } else if (data.IsPressed(kCargoForward)) {
288 elevator_wrist_pos_ = kPanelCargoForwardPos;
289 } else if (data.IsPressed(kCargoBackward)) {
290 elevator_wrist_pos_ = kPanelCargoBackwardPos;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800291 }
Austin Schuh1a17e132019-02-17 15:05:06 -0800292 }
293
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800294 if (switch_ball_) {
295 if (kDoBallOutake ||
Austin Schuhaab7e162019-03-13 22:44:58 -0700296 (kDoBallIntake &&
297 monotonic_now < last_not_has_piece_ + chrono::milliseconds(100))) {
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800298 new_superstructure_goal->intake.unsafe_goal = 0.959327;
299 }
Austin Schuh23a51632019-02-19 16:50:36 -0800300
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800301 if (kDoBallIntake && !superstructure_queue.status->has_piece) {
302 elevator_wrist_pos_ = kBallIntakePos;
303 new_superstructure_goal->roller_voltage = 9.0;
Sabina Davisc6329342019-03-01 20:44:42 -0800304 grab_piece_ = true;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800305 } else {
306 if (kDoBallOutake) {
307 new_superstructure_goal->roller_voltage = -6.0;
308 } else {
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800309 new_superstructure_goal->roller_voltage = 0.0;
310 }
311 }
Austin Schuh23a51632019-02-19 16:50:36 -0800312 }
Austin Schuh1a17e132019-02-17 15:05:06 -0800313
314 if (data.IsPressed(kRelease)) {
Sabina Davisc6329342019-03-01 20:44:42 -0800315 grab_piece_ = false;
Austin Schuh1a17e132019-02-17 15:05:06 -0800316 }
317
Sabina Davisc6329342019-03-01 20:44:42 -0800318 if (switch_ball_) {
319 new_superstructure_goal->suction.gamepiece_mode = 0;
320 } else {
321 new_superstructure_goal->suction.gamepiece_mode = 1;
322 }
323
Tyler Chatowe0241452019-03-08 21:07:50 -0800324 vision_control_.set_flip_image(elevator_wrist_pos_.wrist < 0);
325
Sabina Davisc6329342019-03-01 20:44:42 -0800326 new_superstructure_goal->suction.grab_piece = grab_piece_;
Sabina Davis91b23602019-01-21 00:06:01 -0800327
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800328 new_superstructure_goal->elevator.unsafe_goal =
329 elevator_wrist_pos_.elevator;
330 new_superstructure_goal->wrist.unsafe_goal = elevator_wrist_pos_.wrist;
Sabina Davis91b23602019-01-21 00:06:01 -0800331
332 LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal);
333 if (!new_superstructure_goal.Send()) {
334 LOG(ERROR, "Sending superstructure goal failed.\n");
335 }
Tyler Chatowe0241452019-03-08 21:07:50 -0800336
Austin Schuhaab7e162019-03-13 22:44:58 -0700337 if (monotonic_now >
338 last_vision_control_ + ::std::chrono::milliseconds(50)) {
Tyler Chatow4fedeea2019-03-10 15:33:36 -0700339 video_tx_->Send(vision_control_);
Austin Schuhaab7e162019-03-13 22:44:58 -0700340 last_vision_control_ = monotonic_now;
Tyler Chatow4fedeea2019-03-10 15:33:36 -0700341 }
Sabina Davis91b23602019-01-21 00:06:01 -0800342 }
343
344 private:
345 // Current goals here.
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800346 ElevatorWristPosition elevator_wrist_pos_ = kStowPos;
Sabina Davisc6329342019-03-01 20:44:42 -0800347 bool grab_piece_ = false;
Tyler Chatow7bcb52f2019-02-24 00:16:54 -0800348
349 bool switch_ball_ = false;
350 bool stilts_was_above_ = false;
Tyler Chatowe0241452019-03-08 21:07:50 -0800351
352 VisionControl vision_control_;
353 ::std::unique_ptr<ProtoTXUdpSocket<VisionControl>> video_tx_;
Tyler Chatow4fedeea2019-03-10 15:33:36 -0700354 ::aos::monotonic_clock::time_point last_vision_control_ =
355 ::aos::monotonic_clock::time_point::min();
Austin Schuhaab7e162019-03-13 22:44:58 -0700356
357 // Time at which we last did not have a game piece.
358 ::aos::monotonic_clock::time_point last_not_has_piece_ =
359 ::aos::monotonic_clock::time_point::min();
Sabina Davis91b23602019-01-21 00:06:01 -0800360};
361
362} // namespace joysticks
363} // namespace input
364} // namespace y2019
365
366int main() {
367 ::aos::Init(-1);
368 ::aos::ShmEventLoop event_loop;
369 ::y2019::input::joysticks::Reader reader(&event_loop);
370 reader.Run();
371 ::aos::Cleanup();
372}