implement an autonomous which grabs two cans

Change-Id: I7b0d262b986a8f0397df90f5702b3f4d8d1334b9
diff --git a/frc971/wpilib/wpilib_interface.cc b/frc971/wpilib/wpilib_interface.cc
index 8f41300..25da16a 100644
--- a/frc971/wpilib/wpilib_interface.cc
+++ b/frc971/wpilib/wpilib_interface.cc
@@ -398,6 +398,14 @@
     claw_pinchers_ = ::std::move(s);
   }
 
+  void set_grabber_latch_release(::std::unique_ptr<BufferedSolenoid> s) {
+    grabber_latch_release_ = ::std::move(s);
+  }
+
+  void set_grabber_fold_up(::std::unique_ptr<BufferedSolenoid> s) {
+    grabber_fold_up_ = ::std::move(s);
+  }
+
   void operator()() {
     ::aos::SetCurrentThreadName("Solenoids");
     ::aos::SetCurrentThreadRealtimePriority(30);
@@ -424,6 +432,12 @@
         }
       }
 
+      ::aos::joystick_state.FetchLatest();
+      grabber_latch_release_->Set(::aos::joystick_state.get() != nullptr &&
+                                  ::aos::joystick_state->autonomous);
+      grabber_fold_up_->Set(::aos::joystick_state.get() != nullptr &&
+                            ::aos::joystick_state->joysticks[1].buttons & 1);
+
       {
         PneumaticsToLog to_log;
         {
@@ -452,6 +466,8 @@
   ::std::unique_ptr<BufferedSolenoid> fridge_grabbers_bottom_front_;
   ::std::unique_ptr<BufferedSolenoid> fridge_grabbers_bottom_back_;
   ::std::unique_ptr<BufferedSolenoid> claw_pinchers_;
+  ::std::unique_ptr<BufferedSolenoid> grabber_latch_release_;
+  ::std::unique_ptr<BufferedSolenoid> grabber_fold_up_;
   ::std::unique_ptr<DigitalSource> pressure_switch_;
   ::std::unique_ptr<Relay> compressor_relay_;
 
@@ -665,6 +681,8 @@
     solenoid_writer.set_fridge_grabbers_bottom_front(pcm->MakeSolenoid(2));
     solenoid_writer.set_fridge_grabbers_bottom_back(pcm->MakeSolenoid(1));
     solenoid_writer.set_claw_pinchers(pcm->MakeSolenoid(4));
+    solenoid_writer.set_grabber_latch_release(pcm->MakeSolenoid(7));
+    solenoid_writer.set_grabber_fold_up(pcm->MakeSolenoid(5));
 
     solenoid_writer.set_pressure_switch(make_unique<DigitalInput>(9));
     solenoid_writer.set_compressor_relay(make_unique<Relay>(0));