blob: 6e1aaa5a9d3051582af51c286bac2046355f7f4a [file] [log] [blame]
Neil Balchacfca5b2018-01-28 14:04:08 -08001#include <math.h>
2#include <stdio.h>
3#include <string.h>
4#include <unistd.h>
Austin Schuh8d5fff42018-05-30 20:44:12 -07005#include <mutex>
Austin Schuha8de4a62018-09-03 18:04:28 -07006#include <google/protobuf/stubs/stringprintf.h>
Neil Balchacfca5b2018-01-28 14:04:08 -08007
John Park33858a32018-09-28 23:05:48 -07008#include "aos/actions/actions.h"
9#include "aos/input/driver_station_data.h"
10#include "aos/logging/logging.h"
11#include "aos/network/team_number.h"
12#include "aos/stl_mutex/stl_mutex.h"
13#include "aos/time/time.h"
14#include "aos/util/log_interval.h"
Neil Balchacfca5b2018-01-28 14:04:08 -080015#include "aos/input/drivetrain_input.h"
Austin Schuha250b2d2019-05-27 16:14:02 -070016#include "aos/input/action_joystick_input.h"
John Park398c74a2018-10-20 21:17:39 -070017#include "aos/init.h"
Austin Schuh8d5fff42018-05-30 20:44:12 -070018#include "aos/vision/events/udp.h"
Austin Schuha3c148e2018-03-09 21:04:05 -080019#include "frc971/autonomous/auto.q.h"
20#include "frc971/autonomous/base_autonomous_actor.h"
Neil Balchacfca5b2018-01-28 14:04:08 -080021#include "frc971/control_loops/drivetrain/drivetrain.q.h"
22#include "y2018/control_loops/drivetrain/drivetrain_base.h"
Austin Schuhab15c4d2018-03-09 21:21:03 -080023#include "y2018/control_loops/superstructure/arm/generated_graph.h"
Neil Balch07fee582018-01-27 15:46:49 -080024#include "y2018/control_loops/superstructure/superstructure.q.h"
Austin Schuh8d5fff42018-05-30 20:44:12 -070025#include "y2018/vision.pb.h"
Neil Balchacfca5b2018-01-28 14:04:08 -080026
Austin Schuh8d5fff42018-05-30 20:44:12 -070027using ::aos::monotonic_clock;
Neil Balchacfca5b2018-01-28 14:04:08 -080028using ::frc971::control_loops::drivetrain_queue;
Neil Balch07fee582018-01-27 15:46:49 -080029using ::y2018::control_loops::superstructure_queue;
Austin Schuh8d5fff42018-05-30 20:44:12 -070030using ::aos::events::ProtoTXUdpSocket;
31using ::aos::events::RXUdpSocket;
Neil Balchacfca5b2018-01-28 14:04:08 -080032using ::aos::input::driver_station::ButtonLocation;
33using ::aos::input::driver_station::ControlBit;
34using ::aos::input::driver_station::JoystickAxis;
35using ::aos::input::driver_station::POVLocation;
36using ::aos::input::DrivetrainInputReader;
37
Austin Schuh60cdb3e2018-04-06 21:52:32 -070038using ::y2018::control_loops::superstructure::arm::FrontPoints;
39using ::y2018::control_loops::superstructure::arm::BackPoints;
40
Neil Balchacfca5b2018-01-28 14:04:08 -080041namespace y2018 {
42namespace input {
43namespace joysticks {
44
Austin Schuhab15c4d2018-03-09 21:21:03 -080045namespace arm = ::y2018::control_loops::superstructure::arm;
Austin Schuha8de4a62018-09-03 18:04:28 -070046using google::protobuf::StringPrintf;
Neil Balch07fee582018-01-27 15:46:49 -080047
Sabina Davis833ccf62018-04-06 20:52:31 -070048const ButtonLocation kIntakeClosed(3, 2);
49const ButtonLocation kDuck(3, 9);
50const ButtonLocation kSmallBox(3, 1);
Austin Schuh47d74942018-03-04 01:15:59 -080051
Sabina Davis833ccf62018-04-06 20:52:31 -070052const ButtonLocation kIntakeIn(3, 4);
53const ButtonLocation kIntakeOut(3, 3);
Neil Balch07fee582018-01-27 15:46:49 -080054
Austin Schuha8de4a62018-09-03 18:04:28 -070055const ButtonLocation kArmBackHighBox(4, 11);
56const ButtonLocation kArmBackExtraHighBox(4, 1);
57const ButtonLocation kArmBackMiddle2Box(4, 9);
58const ButtonLocation kArmBackMiddle1Box(4, 7);
59const ButtonLocation kArmBackLowBox(4, 5);
60const ButtonLocation kArmBackSwitch(3, 7);
Austin Schuhab15c4d2018-03-09 21:21:03 -080061
Austin Schuha8de4a62018-09-03 18:04:28 -070062const ButtonLocation kArmFrontHighBox(4, 12);
63const ButtonLocation kArmFrontExtraHighBox(3, 14);
64const ButtonLocation kArmFrontMiddle2Box(4, 10);
65const ButtonLocation kArmFrontMiddle1Box(4, 8);
66const ButtonLocation kArmFrontLowBox(4, 6);
67const ButtonLocation kArmFrontSwitch(3, 10);
Austin Schuhab15c4d2018-03-09 21:21:03 -080068
Sabina Davis833ccf62018-04-06 20:52:31 -070069const ButtonLocation kArmAboveHang(3, 15);
70const ButtonLocation kArmBelowHang(3, 16);
Austin Schuh17e484e2018-03-11 01:11:36 -080071
Austin Schuhd76546a2018-07-08 16:05:14 -070072const ButtonLocation kEmergencyUp(3, 5);
73const ButtonLocation kEmergencyDown(3, 6);
74
Sabina Davis833ccf62018-04-06 20:52:31 -070075const ButtonLocation kWinch(4, 2);
Austin Schuh17e484e2018-03-11 01:11:36 -080076
Sabina Davis833ccf62018-04-06 20:52:31 -070077const ButtonLocation kArmNeutral(3, 8);
78const ButtonLocation kArmUp(3, 11);
Austin Schuhab15c4d2018-03-09 21:21:03 -080079
Sabina Davis833ccf62018-04-06 20:52:31 -070080const ButtonLocation kArmStepUp(3, 13);
81const ButtonLocation kArmStepDown(3, 12);
Austin Schuhab15c4d2018-03-09 21:21:03 -080082
Sabina Davis833ccf62018-04-06 20:52:31 -070083const ButtonLocation kArmPickupBoxFromIntake(4, 3);
84
85const ButtonLocation kClawOpen(4, 4);
Neil Balchba9cbba2018-04-06 22:26:38 -070086const ButtonLocation kDriverClawOpen(2, 4);
Neil Balch07fee582018-01-27 15:46:49 -080087
Austin Schuha250b2d2019-05-27 16:14:02 -070088class Reader : public ::aos::input::ActionJoystickInput {
Neil Balchacfca5b2018-01-28 14:04:08 -080089 public:
Austin Schuh3e45c752019-02-02 12:19:11 -080090 Reader(::aos::EventLoop *event_loop)
Austin Schuha250b2d2019-05-27 16:14:02 -070091 : ::aos::input::ActionJoystickInput(
92 event_loop,
93 ::y2018::control_loops::drivetrain::GetDrivetrainConfig(),
94 ::aos::network::GetTeamNumber() == 971
95 ? DrivetrainInputReader::InputType::kPistol
96 : DrivetrainInputReader::InputType::kSteeringWheel,
97 {}) {
Austin Schuha8de4a62018-09-03 18:04:28 -070098 const uint16_t team = ::aos::network::GetTeamNumber();
99
Austin Schuha8de4a62018-09-03 18:04:28 -0700100 video_tx_.reset(new ProtoTXUdpSocket<VisionControl>(
101 StringPrintf("10.%d.%d.179", team / 100, team % 100), 5000));
Neil Balchacfca5b2018-01-28 14:04:08 -0800102 }
103
Austin Schuha250b2d2019-05-27 16:14:02 -0700104 void HandleTeleop(const ::aos::input::driver_station::Data &data) override {
Austin Schuhab15c4d2018-03-09 21:21:03 -0800105 superstructure_queue.position.FetchLatest();
Neil Balch07fee582018-01-27 15:46:49 -0800106 superstructure_queue.status.FetchLatest();
Austin Schuhab15c4d2018-03-09 21:21:03 -0800107 if (!superstructure_queue.status.get() ||
108 !superstructure_queue.position.get()) {
Neil Balch07fee582018-01-27 15:46:49 -0800109 LOG(ERROR, "Got no superstructure status packet.\n");
110 return;
111 }
112
Neil Balch07fee582018-01-27 15:46:49 -0800113 auto new_superstructure_goal = superstructure_queue.goal.MakeMessage();
114
Sabina Davisfdd7a112018-02-04 16:16:23 -0800115 new_superstructure_goal->intake.left_intake_angle = intake_goal_;
116 new_superstructure_goal->intake.right_intake_angle = intake_goal_;
Neil Balch07fee582018-01-27 15:46:49 -0800117
Austin Schuh8d5fff42018-05-30 20:44:12 -0700118 if (data.PosEdge(kIntakeIn) || data.PosEdge(kSmallBox) ||
119 data.PosEdge(kIntakeClosed)) {
120 vision_control_.set_high_video(false);
121 }
122
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700123 if (data.IsPressed(kIntakeIn)) {
Neil Balch07fee582018-01-27 15:46:49 -0800124 // Turn on the rollers.
Neil Balchba9cbba2018-04-06 22:26:38 -0700125 new_superstructure_goal->intake.roller_voltage = 8.0;
Neil Balch07fee582018-01-27 15:46:49 -0800126 } else if (data.IsPressed(kIntakeOut)) {
127 // Turn off the rollers.
Austin Schuh17dd0892018-03-02 20:06:31 -0800128 new_superstructure_goal->intake.roller_voltage = -12.0;
Neil Balch07fee582018-01-27 15:46:49 -0800129 } else {
130 // We don't want the rollers on.
131 new_superstructure_goal->intake.roller_voltage = 0.0;
132 }
133
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700134 if (data.IsPressed(kSmallBox)) {
135 // Deploy the intake.
136 if (superstructure_queue.position->box_back_beambreak_triggered) {
137 intake_goal_ = 0.30;
138 } else {
139 if (new_superstructure_goal->intake.roller_voltage > 0.1 &&
140 superstructure_queue.position->box_distance < 0.15) {
141 intake_goal_ = 0.18;
142 } else {
143 intake_goal_ = -0.60;
144 }
145 }
146 } else if (data.IsPressed(kIntakeClosed)) {
147 // Deploy the intake.
148 if (superstructure_queue.position->box_back_beambreak_triggered) {
149 intake_goal_ = 0.30;
150 } else {
151 if (new_superstructure_goal->intake.roller_voltage > 0.1) {
Neil Balchba9cbba2018-04-06 22:26:38 -0700152 if (superstructure_queue.position->box_distance < 0.10) {
153 new_superstructure_goal->intake.roller_voltage -= 3.0;
154 intake_goal_ = 0.22;
155 } else if (superstructure_queue.position->box_distance < 0.17) {
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700156 intake_goal_ = 0.13;
157 } else if (superstructure_queue.position->box_distance < 0.25) {
Neil Balchba9cbba2018-04-06 22:26:38 -0700158 intake_goal_ = 0.05;
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700159 } else {
Neil Balchba9cbba2018-04-06 22:26:38 -0700160 intake_goal_ = -0.10;
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700161 }
Austin Schuha250b2d2019-05-27 16:14:02 -0700162 if (robot_velocity() < -0.1 &&
Austin Schuhcf96d322018-04-07 15:52:31 -0700163 superstructure_queue.position->box_distance > 0.15) {
164 intake_goal_ += 0.10;
165 }
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700166 } else {
167 intake_goal_ = -0.60;
168 }
169 }
170 } else {
171 // Bring in the intake.
Austin Schuhcf96d322018-04-07 15:52:31 -0700172 intake_goal_ = -3.20;
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700173 }
174
Neil Balchba9cbba2018-04-06 22:26:38 -0700175 if (new_superstructure_goal->intake.roller_voltage > 0.1 &&
176 intake_goal_ > 0.0) {
177 if (superstructure_queue.position->box_distance < 0.10) {
178 new_superstructure_goal->intake.roller_voltage -= 3.0;
179 }
180 new_superstructure_goal->intake.roller_voltage += 3.0;
181 }
182
Austin Schuhb874fd32018-03-05 00:27:10 -0800183 // If we are disabled, stay at the node closest to where we start. This
184 // should remove long motions when enabled.
Neil Balchba9cbba2018-04-06 22:26:38 -0700185 if (!data.GetControlBit(ControlBit::kEnabled) || never_disabled_) {
Austin Schuhb874fd32018-03-05 00:27:10 -0800186 arm_goal_position_ = superstructure_queue.status->arm.current_node;
Neil Balchba9cbba2018-04-06 22:26:38 -0700187 never_disabled_ = false;
Austin Schuhb874fd32018-03-05 00:27:10 -0800188 }
189
Austin Schuhab15c4d2018-03-09 21:21:03 -0800190 bool grab_box = false;
191 if (data.IsPressed(kArmPickupBoxFromIntake)) {
Austin Schuhab15c4d2018-03-09 21:21:03 -0800192 grab_box = true;
Neil Balchba9cbba2018-04-06 22:26:38 -0700193 }
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700194 const bool near_goal =
195 superstructure_queue.status->arm.current_node == arm_goal_position_ &&
196 superstructure_queue.status->arm.path_distance_to_go < 1e-3;
Austin Schuh822a1e52018-04-06 22:50:21 -0700197 if (data.IsPressed(kArmStepDown) && near_goal) {
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700198 uint32_t *front_point = ::std::find(
199 front_points_.begin(), front_points_.end(), arm_goal_position_);
200 uint32_t *back_point = ::std::find(
201 back_points_.begin(), back_points_.end(), arm_goal_position_);
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700202 if (front_point != front_points_.end()) {
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700203 ++front_point;
204 if (front_point != front_points_.end()) {
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700205 arm_goal_position_ = *front_point;
206 }
207 } else if (back_point != back_points_.end()) {
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700208 ++back_point;
209 if (back_point != back_points_.end()) {
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700210 arm_goal_position_ = *back_point;
211 }
212 }
Austin Schuh822a1e52018-04-06 22:50:21 -0700213 } else if (data.IsPressed(kArmStepUp) && near_goal) {
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700214 const uint32_t *front_point = ::std::find(
215 front_points_.begin(), front_points_.end(), arm_goal_position_);
216 const uint32_t *back_point = ::std::find(
217 back_points_.begin(), back_points_.end(), arm_goal_position_);
218 if (front_point != front_points_.end()) {
219 if (front_point != front_points_.begin()) {
220 --front_point;
221 arm_goal_position_ = *front_point;
222 }
223 } else if (back_point != back_points_.end()) {
224 if (back_point != back_points_.begin()) {
225 --back_point;
226 arm_goal_position_ = *back_point;
227 }
228 }
229 } else if (data.PosEdge(kArmPickupBoxFromIntake)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700230 vision_control_.set_high_video(false);
Neil Balchba9cbba2018-04-06 22:26:38 -0700231 arm_goal_position_ = arm::NeutralIndex();
232 } else if (data.IsPressed(kDuck)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700233 vision_control_.set_high_video(false);
Neil Balchba9cbba2018-04-06 22:26:38 -0700234 arm_goal_position_ = arm::DuckIndex();
Austin Schuhab15c4d2018-03-09 21:21:03 -0800235 } else if (data.IsPressed(kArmNeutral)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700236 vision_control_.set_high_video(false);
Austin Schuhab15c4d2018-03-09 21:21:03 -0800237 arm_goal_position_ = arm::NeutralIndex();
238 } else if (data.IsPressed(kArmUp)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700239 vision_control_.set_high_video(true);
Austin Schuhab15c4d2018-03-09 21:21:03 -0800240 arm_goal_position_ = arm::UpIndex();
241 } else if (data.IsPressed(kArmFrontSwitch)) {
242 arm_goal_position_ = arm::FrontSwitchIndex();
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700243 } else if (data.IsPressed(kArmFrontExtraHighBox)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700244 vision_control_.set_high_video(true);
Austin Schuhab15c4d2018-03-09 21:21:03 -0800245 arm_goal_position_ = arm::FrontHighBoxIndex();
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700246 } else if (data.IsPressed(kArmFrontHighBox)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700247 vision_control_.set_high_video(true);
Austin Schuhab15c4d2018-03-09 21:21:03 -0800248 arm_goal_position_ = arm::FrontMiddle2BoxIndex();
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700249 } else if (data.IsPressed(kArmFrontMiddle2Box)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700250 vision_control_.set_high_video(true);
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700251 arm_goal_position_ = arm::FrontMiddle3BoxIndex();
Austin Schuhab15c4d2018-03-09 21:21:03 -0800252 } else if (data.IsPressed(kArmFrontMiddle1Box)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700253 vision_control_.set_high_video(true);
Austin Schuhab15c4d2018-03-09 21:21:03 -0800254 arm_goal_position_ = arm::FrontMiddle1BoxIndex();
255 } else if (data.IsPressed(kArmFrontLowBox)) {
Austin Schuh8d5fff42018-05-30 20:44:12 -0700256 vision_control_.set_high_video(true);
Austin Schuhab15c4d2018-03-09 21:21:03 -0800257 arm_goal_position_ = arm::FrontLowBoxIndex();
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700258 } else if (data.IsPressed(kArmBackExtraHighBox)) {
Austin Schuhab15c4d2018-03-09 21:21:03 -0800259 arm_goal_position_ = arm::BackHighBoxIndex();
Austin Schuh83cdd8a2018-03-21 20:49:02 -0700260 } else if (data.IsPressed(kArmBackHighBox) ||
261 data.IsPressed(kArmBackMiddle2Box)) {
Austin Schuhab15c4d2018-03-09 21:21:03 -0800262 arm_goal_position_ = arm::BackMiddle2BoxIndex();
263 } else if (data.IsPressed(kArmBackMiddle1Box)) {
264 arm_goal_position_ = arm::BackMiddle1BoxIndex();
265 } else if (data.IsPressed(kArmBackLowBox)) {
266 arm_goal_position_ = arm::BackLowBoxIndex();
267 } else if (data.IsPressed(kArmBackSwitch)) {
268 arm_goal_position_ = arm::BackSwitchIndex();
Austin Schuh17e484e2018-03-11 01:11:36 -0800269 } else if (data.IsPressed(kArmAboveHang)) {
270 if (data.IsPressed(kIntakeIn)) {
271 arm_goal_position_ = arm::SelfHangIndex();
272 } else if (data.IsPressed(kIntakeOut)) {
273 arm_goal_position_ = arm::PartnerHangIndex();
274 } else {
275 arm_goal_position_ = arm::AboveHangIndex();
276 }
277 } else if (data.IsPressed(kArmBelowHang)) {
278 arm_goal_position_ = arm::BelowHangIndex();
Neil Balch07fee582018-01-27 15:46:49 -0800279 }
280
Austin Schuhd76546a2018-07-08 16:05:14 -0700281 if (data.IsPressed(kEmergencyDown)) {
282 arm_goal_position_ = arm::NeutralIndex();
283 new_superstructure_goal->trajectory_override = true;
284 } else if (data.IsPressed(kEmergencyUp)) {
285 arm_goal_position_ = arm::UpIndex();
286 new_superstructure_goal->trajectory_override = true;
287 } else {
288 new_superstructure_goal->trajectory_override = false;
289 }
290
Austin Schuh17e484e2018-03-11 01:11:36 -0800291 new_superstructure_goal->deploy_fork =
292 data.IsPressed(kArmAboveHang) && data.IsPressed(kClawOpen);
293
294 if (new_superstructure_goal->deploy_fork) {
295 intake_goal_ = -2.0;
296 }
297
298 if (data.IsPressed(kWinch)) {
Neil Balchba9cbba2018-04-06 22:26:38 -0700299 LOG(INFO, "Winching\n");
Austin Schuh17e484e2018-03-11 01:11:36 -0800300 new_superstructure_goal->voltage_winch = 12.0;
301 } else {
302 new_superstructure_goal->voltage_winch = 0.0;
303 }
304
305 new_superstructure_goal->hook_release = data.IsPressed(kArmBelowHang);
306
Austin Schuhcb091712018-02-21 20:01:55 -0800307 new_superstructure_goal->arm_goal_position = arm_goal_position_;
Austin Schuhd76546a2018-07-08 16:05:14 -0700308 if (data.IsPressed(kArmFrontSwitch) || data.IsPressed(kArmBackSwitch)) {
309 new_superstructure_goal->open_threshold = 0.35;
310 } else {
311 new_superstructure_goal->open_threshold = 0.0;
312 }
Austin Schuhcb091712018-02-21 20:01:55 -0800313
Neil Balchba9cbba2018-04-06 22:26:38 -0700314 if ((data.IsPressed(kClawOpen) && data.IsPressed(kDriverClawOpen)) ||
Austin Schuhd76546a2018-07-08 16:05:14 -0700315 data.PosEdge(kArmPickupBoxFromIntake) ||
316 (data.IsPressed(kClawOpen) &&
317 (data.IsPressed(kArmFrontSwitch) || data.IsPressed(kArmBackSwitch)))) {
Neil Balch07fee582018-01-27 15:46:49 -0800318 new_superstructure_goal->open_claw = true;
Austin Schuhab15c4d2018-03-09 21:21:03 -0800319 } else {
Neil Balch07fee582018-01-27 15:46:49 -0800320 new_superstructure_goal->open_claw = false;
321 }
322
Austin Schuhab15c4d2018-03-09 21:21:03 -0800323 new_superstructure_goal->grab_box = grab_box;
Neil Balch07fee582018-01-27 15:46:49 -0800324
325 LOG_STRUCT(DEBUG, "sending goal", *new_superstructure_goal);
326 if (!new_superstructure_goal.Send()) {
327 LOG(ERROR, "Sending superstructure goal failed.\n");
328 }
Austin Schuh8d5fff42018-05-30 20:44:12 -0700329
Austin Schuha8de4a62018-09-03 18:04:28 -0700330 video_tx_->Send(vision_control_);
Neil Balchacfca5b2018-01-28 14:04:08 -0800331 }
332
333 private:
Austin Schuha250b2d2019-05-27 16:14:02 -0700334 uint32_t GetAutonomousMode() override {
Austin Schuh3e45c752019-02-02 12:19:11 -0800335 // Low bit is switch, high bit is scale. 1 means left, 0 means right.
Austin Schuha250b2d2019-05-27 16:14:02 -0700336 return mode();
Neil Balchacfca5b2018-01-28 14:04:08 -0800337 }
338
Neil Balch07fee582018-01-27 15:46:49 -0800339 // Current goals to send to the robot.
Austin Schuh17e484e2018-03-11 01:11:36 -0800340 double intake_goal_ = 0.0;
Neil Balch07fee582018-01-27 15:46:49 -0800341
Neil Balchba9cbba2018-04-06 22:26:38 -0700342 bool never_disabled_ = true;
Neil Balchacfca5b2018-01-28 14:04:08 -0800343
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700344 uint32_t arm_goal_position_ = 0;
Austin Schuh8d5fff42018-05-30 20:44:12 -0700345 VisionControl vision_control_;
Austin Schuh60cdb3e2018-04-06 21:52:32 -0700346
347 decltype(FrontPoints()) front_points_ = FrontPoints();
348 decltype(BackPoints()) back_points_ = BackPoints();
Austin Schuhcb091712018-02-21 20:01:55 -0800349
Austin Schuha8de4a62018-09-03 18:04:28 -0700350 ::std::unique_ptr<ProtoTXUdpSocket<VisionControl>> video_tx_;
Neil Balchacfca5b2018-01-28 14:04:08 -0800351};
352
353} // namespace joysticks
354} // namespace input
355} // namespace y2018
356
357int main() {
358 ::aos::Init(-1);
Austin Schuh3e45c752019-02-02 12:19:11 -0800359 ::aos::ShmEventLoop event_loop;
360 ::y2018::input::joysticks::Reader reader(&event_loop);
Neil Balchacfca5b2018-01-28 14:04:08 -0800361 reader.Run();
362 ::aos::Cleanup();
363}