Modify some constants for third robot.

- Fix drivetrain_translate.
- Fix crio build.sh.
- Add some snazzy new regexes (as per Brian's suggestion), to
aos/build/build.sh, in order to shorten one of the conditionals.
- Get rid of some old, useless files.
diff --git a/aos/atom_code/input/JoystickInput.cpp b/aos/atom_code/input/JoystickInput.cpp
deleted file mode 100644
index 2c3b3b9..0000000
--- a/aos/atom_code/input/JoystickInput.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "aos/atom_code/input/JoystickInput.h"
-
-#include "aos/common/Configuration.h"
-#include "aos/common/network/ReceiveSocket.h"
-#include "aos/common/messages/RobotState.q.h"
-
-namespace aos {
-
-void JoystickInput::SetupButtons() {
-  for (int i = 0; i < 4; ++i) {
-    old_buttons[i] = buttons[i];
-  }
-  buttons[0] = control_data_.stick0Buttons;
-  buttons[1] = control_data_.stick1Buttons;
-  buttons[2] = control_data_.stick2Buttons;
-  buttons[3] = control_data_.stick3Buttons;
-
-  // Put the ENABLED, AUTONOMOUS, and FMS_ATTACHED values into unused bits in
-  // the values for joystick 0 so that PosEdge and NegEdge can be used with
-  // them.
-  // Windows only supports 12 buttons, so we know there will never be any more.
-  // Not using MASK because it doesn't make it any cleaner.
-  buttons[0] |= (control_data_.enabled << (ENABLED - 9)) |
-      (control_data_.autonomous << (AUTONOMOUS - 9)) |
-      (control_data_.fmsAttached << (FMS_ATTACHED - 9));
-
-  for (int j = 0; j < 4; ++j) {
-    for (int k = 1; k <= 12; ++k) {
-      if (PosEdge(j, k)) {
-        LOG(INFO, "PosEdge(%d, %d)\n", j, k);
-      }
-      if (NegEdge(j, k)) {
-        LOG(INFO, "NegEdge(%d, %d)\n", j, k);
-      }
-    }
-  }
-  if (PosEdge(0, ENABLED)) LOG(INFO, "PosEdge(ENABLED)\n");
-  if (NegEdge(0, ENABLED)) LOG(INFO, "NegEdge(ENABLED)\n");
-  if (PosEdge(0, AUTONOMOUS)) LOG(INFO, "PosEdge(AUTONOMOUS)\n");
-  if (NegEdge(0, AUTONOMOUS)) LOG(INFO, "NegEdge(AUTONOMOUS)\n");
-  if (PosEdge(0, FMS_ATTACHED)) LOG(INFO, "PosEdge(FMS_ATTACHED)\n");
-  if (NegEdge(0, FMS_ATTACHED)) LOG(INFO, "NegEdge(FMS_ATTACHED)\n");
-}
-
-void JoystickInput::Run() {
-  ReceiveSocket sock(NetworkPort::kDS);
-  while (true) {
-    if (sock.Receive(&control_data_, sizeof(control_data_)) !=
-        sizeof(control_data_)) {
-      LOG(WARNING, "socket receive failed\n");
-      continue;
-    }
-    SetupButtons();
-    if (!robot_state.MakeWithBuilder()
-        .enabled(Pressed(0, ENABLED))
-        .autonomous(Pressed(0, AUTONOMOUS))
-        .team_id(ntohs(control_data_.teamID))
-        .Send()) {
-			LOG(WARNING, "sending robot_state failed\n");
-		}
-		if (robot_state.FetchLatest()) {
-    	char state[1024];
-    	robot_state->Print(state, sizeof(state));
-    	LOG(DEBUG, "robot_state={%s}\n", state);
-		} else {
-			LOG(WARNING, "fetching robot_state failed\n");
-		}
-    RunIteration();
-  }
-}
-
-}  // namespace aos
-
diff --git a/aos/atom_code/input/JoystickInput.h b/aos/atom_code/input/JoystickInput.h
deleted file mode 100644
index 313ad0a..0000000
--- a/aos/atom_code/input/JoystickInput.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef AOS_INPUT_JOYSTICK_INPUT_H_
-#define AOS_INPUT_JOYSTICK_INPUT_H_
-
-#include "FRCComm.h"
-
-namespace aos {
-
-// Class for implementing atom code that reads the joystick values from the
-// cRIO.
-// Designed for a subclass that implements RunIteration to be instantiated and
-// Runed.
-// TODO(brians): rewrite this with OO buttons/fms state etc
-class JoystickInput {
- private:
-  uint16_t buttons[4], old_buttons[4];
-  inline uint16_t MASK(int button) {
-    return 1 << ((button > 8) ? (button - 9) : (button + 7));
-  }
-  void SetupButtons();
- protected:
-  FRCCommonControlData control_data_;
-
-  // Constants that retrieve data when used with joystick 0.
-  static const int ENABLED = 13;
-  static const int AUTONOMOUS = 14;
-  static const int FMS_ATTACHED = 15;
-  bool Pressed(int stick, int button) {
-	  return buttons[stick] & MASK(button);
-  }
-  bool PosEdge(int stick, int button) {
-	  return !(old_buttons[stick] & MASK(button)) && (buttons[stick] & MASK(button));
-  }
-  bool NegEdge(int stick, int button) {
-	  return (old_buttons[stick] & MASK(button)) && !(buttons[stick] & MASK(button));
-  }
-
-  virtual void RunIteration() = 0;
- public:
-  // Enters an infinite loop that reads values and calls RunIteration.
-  void Run();
-};
-
-} // namespace aos
-
-#endif
-
diff --git a/aos/build/build.sh b/aos/build/build.sh
index df7e2fb..e0ff434 100755
--- a/aos/build/build.sh
+++ b/aos/build/build.sh
@@ -13,7 +13,7 @@
 ACTION=$5
 
 shift 4
-shift || true # We might not have a 4th argument if ACTION is empty.
+shift || true # We might not have a 5th argument if ACTION is empty.
 
 export WIND_BASE=${WIND_BASE:-"/usr/local/powerpc-wrs-vxworks/wind_base"}
 
@@ -72,7 +72,7 @@
   fi
   ${NINJA} -C ${OUTDIR}/Default ${NINJA_ACTION} "$@"
   if [[ ${ACTION} == deploy || ${ACTION} == redeploy ]]; then
-    [ ${PLATFORM} == atom ] || [ ${PLATFORM} == bot3_atom] && \
+    [[ ${PLATFORM} =~ .*atom ]] && \
       rsync --progress -c -r \
         ${OUTDIR}/Default/outputs/* \
         driver@`${AOS}/build/get_ip fitpc`:/home/driver/robot_code/bin
diff --git a/bot3/input/gyro_sensor_receiver.cc b/bot3/input/gyro_sensor_receiver.cc
index f53f15b..625df57 100644
--- a/bot3/input/gyro_sensor_receiver.cc
+++ b/bot3/input/gyro_sensor_receiver.cc
@@ -18,34 +18,20 @@
 namespace bot3 {
 namespace {
 
+//TODO (danielp): Figure out whether the bigger gear is on the 
+// encoder or not.
 inline double drivetrain_translate(int32_t in) {
   return static_cast<double>(in) / (256.0 /*cpr*/ * 4.0 /*quad*/) *
-      (19.0 / 50.0) /*output reduction*/ * (64.0 / 24.0) /*encoder gears*/ *
-      (3.5 /*wheel diameter*/ * 2.54 / 100.0 * M_PI);
+      (44.0 / 32.0 /*encoder gears*/) * // the encoders are on the wheels.
+      (3.5 /*wheel diameter*/ * 2.54 / 100 * M_PI);
 }
 
-inline double wrist_translate(int32_t in) {
-  return static_cast<double>(in) / (256.0 /*cpr*/ * 4.0 /*quad*/) *
-      (14.0 / 50.0 * 20.0 / 84.0) /*gears*/ * (2 * M_PI);
-}
-
-inline double angle_adjust_translate(int32_t in) {
-  static const double kCableDiameter = 0.060;
-  return -static_cast<double>(in) / (256.0 /*cpr*/ * 4.0 /*quad*/) *
-      ((0.75 + kCableDiameter) / (16.61125 + kCableDiameter)) /*pulleys*/ *
-      (2 * M_PI);
-}
-
+// TODO (danielp): This needs to be modified eventually.
 inline double shooter_translate(int32_t in) {
  return static_cast<double>(in) / (32.0 /*cpr*/ * 4.0 /*quad*/) *
       (15.0 / 34.0) /*gears*/ * (2 * M_PI);
 }
 
-inline double index_translate(int32_t in) {
-  return -static_cast<double>(in) / (128.0 /*cpr*/ * 4.0 /*quad*/) *
-      (1.0) /*gears*/ * (2 * M_PI);
-}
-
 }  // namespace
 
 class GyroSensorReceiver : public USBReceiver {
diff --git a/bot3/output/atom_motor_writer.cc b/bot3/output/atom_motor_writer.cc
index 7d43b53..3d00b1b 100644
--- a/bot3/output/atom_motor_writer.cc
+++ b/bot3/output/atom_motor_writer.cc
@@ -22,21 +22,17 @@
 
   virtual void RunIteration() {
     values_.digital_module = 0;
-    values_.pressure_switch_channel = 14;
-    values_.compressor_channel = 1;
+    values_.pressure_switch_channel = 1;
+    values_.compressor_channel = 1; //spike
     values_.solenoid_module = 0;
 
     drivetrain.output.FetchLatest();
     if (drivetrain.output.IsNewerThanMS(kOutputMaxAgeMS) && kEnableDrivetrain) {
-      SetPWMOutput(2, drivetrain.output->right_voltage / 12.0, kTalonBounds);
       SetPWMOutput(3, drivetrain.output->right_voltage / 12.0, kTalonBounds);
-      SetPWMOutput(5, -drivetrain.output->left_voltage / 12.0, kTalonBounds);
-      SetPWMOutput(6, -drivetrain.output->left_voltage / 12.0, kTalonBounds);
+      SetPWMOutput(4, -drivetrain.output->left_voltage / 12.0, kTalonBounds);
     } else {
-      DisablePWMOutput(2);
       DisablePWMOutput(3);
-      DisablePWMOutput(5);
-      DisablePWMOutput(6);
+      DisablePWMOutput(4);
       if (kEnableDrivetrain) {
         LOG(WARNING, "drivetrain not new enough\n");
       }
diff --git a/frc971/constants.cpp b/frc971/constants.cpp
index 3016db5..40f4e88 100644
--- a/frc971/constants.cpp
+++ b/frc971/constants.cpp
@@ -74,6 +74,7 @@
 
 const int kCompDrivetrainGearboxPinion = 19;
 const int kPracticeDrivetrainGearboxPinion = 17;
+const int kBot3DrivetrainGearboxPinion = 15;
 
 struct Values {
   // Wrist hall effect positive and negative edges.
diff --git a/frc971/constants.h b/frc971/constants.h
index 414d10d..e530442 100644
--- a/frc971/constants.h
+++ b/frc971/constants.h
@@ -12,6 +12,7 @@
 
 const uint16_t kCompTeamNumber = 5971;
 const uint16_t kPracticeTeamNumber = 971;
+const uint16_t kBot3TeamNumber = 9971;
 
 // Sets *angle to how many radians from horizontal to the location of interest.
 bool wrist_hall_effect_start_angle(double *angle);
diff --git a/frc971/crio/build.sh b/frc971/crio/build.sh
index b3fc031..9b41ad1 100755
--- a/frc971/crio/build.sh
+++ b/frc971/crio/build.sh
@@ -1,3 +1,3 @@
 #!/bin/bash
 
-../../aos/build/build.sh crio crio.gyp no "$@"
+../../aos/build/build.sh crio crio.gyp no crio "$@"