Squashed 'third_party/allwpilib_2017/' content from commit 35ac87d

Change-Id: I7bb6f5556c30d3f5a092e68de0be9c710c60c9f4
git-subtree-dir: third_party/allwpilib_2017
git-subtree-split: 35ac87d6ff8b7f061c4f18c9ea316e5dccd4888a
diff --git a/wpilibc/shared/include/Base.h b/wpilibc/shared/include/Base.h
new file mode 100644
index 0000000..8374d2a
--- /dev/null
+++ b/wpilibc/shared/include/Base.h
@@ -0,0 +1,78 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "HAL/cpp/make_unique.h"
+
+// MSVC 2013 doesn't allow "= default" on move constructors, but since we are
+// (currently) only actually using the move constructors in non-MSVC situations
+// (ie, wpilibC++Devices), we can just ignore it in MSVC.
+#if !defined(_MSC_VER)
+#define DEFAULT_MOVE_CONSTRUCTOR(ClassName) ClassName(ClassName&&) = default
+#else
+#define DEFAULT_MOVE_CONSTRUCTOR(ClassName)
+#endif
+
+#if (__cplusplus < 201103L)
+#if !defined(_MSC_VER)
+#define nullptr NULL
+#endif
+#define constexpr const
+#endif
+
+#if defined(_MSC_VER)
+#define noexcept throw()
+#endif
+
+// Provide std::decay_t when using GCC < 4.9
+#if defined(__GNUC__)
+#if __GNUC__ == 4 && __GNUC_MINOR__ < 9
+#include <type_traits>
+namespace std {
+template <class T>
+using decay_t = typename decay<T>::type;
+}
+#endif
+#endif
+
+namespace frc {
+
+// A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer
+// that is being deleted by someone else.
+template <class T>
+struct NullDeleter {
+  void operator()(T*) const noexcept {};
+};
+
+}  // namespace frc
+
+#include <atomic>
+
+namespace frc {
+
+// Use this for determining whether the default move constructor has been
+// called on a containing object. This serves the purpose of allowing us to
+// use the default move constructor of an object for moving all the data around
+// while being able to use this to, for instance, chose not to de-allocate
+// a PWM port in a destructor.
+struct HasBeenMoved {
+  HasBeenMoved(HasBeenMoved&& other) {
+    other.moved = true;
+    moved = false;
+  }
+  HasBeenMoved() = default;
+  std::atomic<bool> moved{false};
+  operator bool() const { return moved; }
+};
+
+}  // namespace frc
+
+// For backwards compatibility
+#ifndef NAMESPACED_WPILIB
+using namespace frc;  // NOLINT
+#endif
diff --git a/wpilibc/shared/include/Buttons/Button.h b/wpilibc/shared/include/Buttons/Button.h
new file mode 100644
index 0000000..12b4fce
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/Button.h
@@ -0,0 +1,36 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Buttons/Trigger.h"
+#include "Commands/Command.h"
+
+namespace frc {
+
+/**
+ * This class provides an easy way to link commands to OI inputs.
+ *
+ * It is very easy to link a button to a command.  For instance, you could
+ * link the trigger button of a joystick to a "score" command.
+ *
+ * This class represents a subclass of Trigger that is specifically aimed at
+ * buttons on an operator interface as a common use case of the more generalized
+ * Trigger objects. This is a simple wrapper around Trigger with the method
+ * names
+ * renamed to fit the Button object use.
+ */
+class Button : public Trigger {
+ public:
+  virtual void WhenPressed(Command* command);
+  virtual void WhileHeld(Command* command);
+  virtual void WhenReleased(Command* command);
+  virtual void CancelWhenPressed(Command* command);
+  virtual void ToggleWhenPressed(Command* command);
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/ButtonScheduler.h b/wpilibc/shared/include/Buttons/ButtonScheduler.h
new file mode 100644
index 0000000..45c0204
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/ButtonScheduler.h
@@ -0,0 +1,28 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+namespace frc {
+
+class Trigger;
+class Command;
+
+class ButtonScheduler {
+ public:
+  ButtonScheduler(bool last, Trigger* button, Command* orders);
+  virtual ~ButtonScheduler() = default;
+  virtual void Execute() = 0;
+  void Start();
+
+ protected:
+  bool m_pressedLast;
+  Trigger* m_button;
+  Command* m_command;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/CancelButtonScheduler.h b/wpilibc/shared/include/Buttons/CancelButtonScheduler.h
new file mode 100644
index 0000000..3dd3259
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/CancelButtonScheduler.h
@@ -0,0 +1,27 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Buttons/ButtonScheduler.h"
+
+namespace frc {
+
+class Trigger;
+class Command;
+
+class CancelButtonScheduler : public ButtonScheduler {
+ public:
+  CancelButtonScheduler(bool last, Trigger* button, Command* orders);
+  virtual ~CancelButtonScheduler() = default;
+  virtual void Execute();
+
+ private:
+  bool pressedLast;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/HeldButtonScheduler.h b/wpilibc/shared/include/Buttons/HeldButtonScheduler.h
new file mode 100644
index 0000000..7cedde3
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/HeldButtonScheduler.h
@@ -0,0 +1,24 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Buttons/ButtonScheduler.h"
+
+namespace frc {
+
+class Trigger;
+class Command;
+
+class HeldButtonScheduler : public ButtonScheduler {
+ public:
+  HeldButtonScheduler(bool last, Trigger* button, Command* orders);
+  virtual ~HeldButtonScheduler() = default;
+  virtual void Execute();
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/InternalButton.h b/wpilibc/shared/include/Buttons/InternalButton.h
new file mode 100644
index 0000000..9c2fd8f
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/InternalButton.h
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Buttons/Button.h"
+
+namespace frc {
+
+class InternalButton : public Button {
+ public:
+  InternalButton() = default;
+  explicit InternalButton(bool inverted);
+  virtual ~InternalButton() = default;
+
+  void SetInverted(bool inverted);
+  void SetPressed(bool pressed);
+
+  virtual bool Get();
+
+ private:
+  bool m_pressed = false;
+  bool m_inverted = false;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/JoystickButton.h b/wpilibc/shared/include/Buttons/JoystickButton.h
new file mode 100644
index 0000000..5f079b4
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/JoystickButton.h
@@ -0,0 +1,27 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Buttons/Button.h"
+#include "GenericHID.h"
+
+namespace frc {
+
+class JoystickButton : public Button {
+ public:
+  JoystickButton(GenericHID* joystick, int buttonNumber);
+  virtual ~JoystickButton() = default;
+
+  virtual bool Get();
+
+ private:
+  GenericHID* m_joystick;
+  int m_buttonNumber;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/NetworkButton.h b/wpilibc/shared/include/Buttons/NetworkButton.h
new file mode 100644
index 0000000..9be23b7
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/NetworkButton.h
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "Buttons/Button.h"
+
+namespace frc {
+
+class NetworkButton : public Button {
+ public:
+  NetworkButton(const std::string& tableName, const std::string& field);
+  NetworkButton(std::shared_ptr<ITable> table, const std::string& field);
+  virtual ~NetworkButton() = default;
+
+  virtual bool Get();
+
+ private:
+  std::shared_ptr<ITable> m_netTable;
+  std::string m_field;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/PressedButtonScheduler.h b/wpilibc/shared/include/Buttons/PressedButtonScheduler.h
new file mode 100644
index 0000000..15b7ec4
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/PressedButtonScheduler.h
@@ -0,0 +1,24 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Buttons/ButtonScheduler.h"
+
+namespace frc {
+
+class Trigger;
+class Command;
+
+class PressedButtonScheduler : public ButtonScheduler {
+ public:
+  PressedButtonScheduler(bool last, Trigger* button, Command* orders);
+  virtual ~PressedButtonScheduler() = default;
+  virtual void Execute();
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/ReleasedButtonScheduler.h b/wpilibc/shared/include/Buttons/ReleasedButtonScheduler.h
new file mode 100644
index 0000000..34cbd54
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/ReleasedButtonScheduler.h
@@ -0,0 +1,24 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Buttons/ButtonScheduler.h"
+
+namespace frc {
+
+class Trigger;
+class Command;
+
+class ReleasedButtonScheduler : public ButtonScheduler {
+ public:
+  ReleasedButtonScheduler(bool last, Trigger* button, Command* orders);
+  virtual ~ReleasedButtonScheduler() = default;
+  virtual void Execute();
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/ToggleButtonScheduler.h b/wpilibc/shared/include/Buttons/ToggleButtonScheduler.h
new file mode 100644
index 0000000..b7464c8
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/ToggleButtonScheduler.h
@@ -0,0 +1,27 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Buttons/ButtonScheduler.h"
+
+namespace frc {
+
+class Trigger;
+class Command;
+
+class ToggleButtonScheduler : public ButtonScheduler {
+ public:
+  ToggleButtonScheduler(bool last, Trigger* button, Command* orders);
+  virtual ~ToggleButtonScheduler() = default;
+  virtual void Execute();
+
+ private:
+  bool pressedLast;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Buttons/Trigger.h b/wpilibc/shared/include/Buttons/Trigger.h
new file mode 100644
index 0000000..8ab166c
--- /dev/null
+++ b/wpilibc/shared/include/Buttons/Trigger.h
@@ -0,0 +1,54 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "SmartDashboard/Sendable.h"
+
+namespace frc {
+
+class Command;
+
+/**
+ * This class provides an easy way to link commands to inputs.
+ *
+ * It is very easy to link a polled input to a command.  For instance, you could
+ * link the trigger button of a joystick to a "score" command or an encoder
+ * reaching
+ * a particular value.
+ *
+ * It is encouraged that teams write a subclass of Trigger if they want to have
+ * something unusual (for instance, if they want to react to the user holding
+ * a button while the robot is reading a certain sensor input).  For this, they
+ * only have to write the {@link Trigger#Get()} method to get the full
+ * functionality
+ * of the Trigger class.
+ */
+class Trigger : public Sendable {
+ public:
+  Trigger() = default;
+  virtual ~Trigger() = default;
+  bool Grab();
+  virtual bool Get() = 0;
+  void WhenActive(Command* command);
+  void WhileActive(Command* command);
+  void WhenInactive(Command* command);
+  void CancelWhenActive(Command* command);
+  void ToggleWhenActive(Command* command);
+
+  void InitTable(std::shared_ptr<ITable> subtable) override;
+  std::shared_ptr<ITable> GetTable() const override;
+  std::string GetSmartDashboardType() const override;
+
+ protected:
+  std::shared_ptr<ITable> m_table;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/CircularBuffer.h b/wpilibc/shared/include/CircularBuffer.h
new file mode 100644
index 0000000..d273992
--- /dev/null
+++ b/wpilibc/shared/include/CircularBuffer.h
@@ -0,0 +1,49 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2015-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <cstddef>
+#include <vector>
+
+namespace frc {
+
+/**
+ * This is a simple circular buffer so we don't need to "bucket brigade" copy
+ * old values.
+ */
+template <class T>
+class CircularBuffer {
+ public:
+  explicit CircularBuffer(size_t size);
+
+  void PushFront(T value);
+  void PushBack(T value);
+  T PopFront();
+  T PopBack();
+  void Resize(size_t size);
+  void Reset();
+
+  T& operator[](size_t index);
+  const T& operator[](size_t index) const;
+
+ private:
+  std::vector<T> m_data;
+
+  // Index of element at front of buffer
+  size_t m_front = 0;
+
+  // Number of elements used in buffer
+  size_t m_length = 0;
+
+  size_t ModuloInc(size_t index);
+  size_t ModuloDec(size_t index);
+};
+
+}  // namespace frc
+
+#include "CircularBuffer.inc"
diff --git a/wpilibc/shared/include/CircularBuffer.inc b/wpilibc/shared/include/CircularBuffer.inc
new file mode 100644
index 0000000..6f1e2c3
--- /dev/null
+++ b/wpilibc/shared/include/CircularBuffer.inc
@@ -0,0 +1,189 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2015-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <algorithm>
+
+namespace frc {
+
+template <class T>
+CircularBuffer<T>::CircularBuffer(size_t size) : m_data(size, 0) {}
+
+/**
+ * Push new value onto front of the buffer. The value at the back is overwritten
+ * if the buffer is full.
+ */
+template <class T>
+void CircularBuffer<T>::PushFront(T value) {
+  if (m_data.size() == 0) {
+    return;
+  }
+
+  m_front = ModuloDec(m_front);
+
+  m_data[m_front] = value;
+
+  if (m_length < m_data.size()) {
+    m_length++;
+  }
+}
+
+/**
+ * Push new value onto back of the buffer. The value at the front is overwritten
+ * if the buffer is full.
+ */
+template <class T>
+void CircularBuffer<T>::PushBack(T value) {
+  if (m_data.size() == 0) {
+    return;
+  }
+
+  m_data[(m_front + m_length) % m_data.size()] = value;
+
+  if (m_length < m_data.size()) {
+    m_length++;
+  } else {
+    // Increment front if buffer is full to maintain size
+    m_front = ModuloInc(m_front);
+  }
+}
+
+/**
+ * Pop value at front of buffer.
+ */
+template <class T>
+T CircularBuffer<T>::PopFront() {
+  // If there are no elements in the buffer, do nothing
+  if (m_length == 0) {
+    return 0;
+  }
+
+  T& temp = m_data[m_front];
+  m_front = ModuloInc(m_front);
+  m_length--;
+  return temp;
+}
+
+/**
+ * Pop value at back of buffer.
+ */
+template <class T>
+T CircularBuffer<T>::PopBack() {
+  // If there are no elements in the buffer, do nothing
+  if (m_length == 0) {
+    return 0;
+  }
+
+  m_length--;
+  return m_data[(m_front + m_length) % m_data.size()];
+}
+
+/**
+ * Resizes internal buffer to given size.
+ */
+template <class T>
+void CircularBuffer<T>::Resize(size_t size) {
+  if (size > m_data.size()) {
+    // Find end of buffer
+    size_t insertLocation = (m_front + m_length) % m_data.size();
+
+    // If insertion location precedes front of buffer, push front index back
+    if (insertLocation <= m_front) {
+      m_front += size - m_data.size();
+    }
+
+    // Add elements to end of buffer
+    m_data.insert(m_data.begin() + insertLocation, size - m_data.size(), 0);
+  } else if (size < m_data.size()) {
+    /* 1) Shift element block start at "front" left as many blocks as were
+     *    removed up to but not exceeding buffer[0]
+     * 2) Shrink buffer, which will remove even more elements automatically if
+     *    necessary
+     */
+    size_t elemsToRemove = m_data.size() - size;
+    auto frontIter = m_data.begin() + m_front;
+    if (m_front < elemsToRemove) {
+      /* Remove elements from end of buffer before shifting start of element
+       * block. Doing so saves a few copies.
+       */
+      m_data.erase(frontIter + size, m_data.end());
+
+      // Shift start of element block to left
+      m_data.erase(m_data.begin(), frontIter);
+
+      // Update metadata
+      m_front = 0;
+    } else {
+      // Shift start of element block to left
+      m_data.erase(frontIter - elemsToRemove, frontIter);
+
+      // Update metadata
+      m_front -= elemsToRemove;
+    }
+
+    /* Length only changes during a shrink if all unused spaces have been
+     * removed. Length decreases as used spaces are removed to meet the
+     * required size.
+     */
+    if (m_length > size) {
+      m_length = size;
+    }
+  }
+}
+
+/**
+ * Sets internal buffer contents to zero.
+ */
+template <class T>
+void CircularBuffer<T>::Reset() {
+  std::fill(m_data.begin(), m_data.end(), 0);
+  m_front = 0;
+  m_length = 0;
+}
+
+/**
+ * @return Element at index starting from front of buffer.
+ */
+template <class T>
+T& CircularBuffer<T>::operator[](size_t index) {
+  return m_data[(m_front + index) % m_data.size()];
+}
+
+/**
+ * @return Element at index starting from front of buffer.
+ */
+template <class T>
+const T& CircularBuffer<T>::operator[](size_t index) const {
+  return m_data[(m_front + index) % m_data.size()];
+}
+
+/**
+ * Increment an index modulo the length of the buffer.
+ *
+ * @return The result of the modulo operation.
+ */
+template <class T>
+size_t CircularBuffer<T>::ModuloInc(size_t index) {
+  return (index + 1) % m_data.size();
+}
+
+/**
+ * Decrement an index modulo the length of the buffer.
+ *
+ * @return The result of the modulo operation.
+ */
+template <class T>
+size_t CircularBuffer<T>::ModuloDec(size_t index) {
+  if (index == 0) {
+    return m_data.size() - 1;
+  } else {
+    return index - 1;
+  }
+}
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/Command.h b/wpilibc/shared/include/Commands/Command.h
new file mode 100644
index 0000000..19d1e7a
--- /dev/null
+++ b/wpilibc/shared/include/Commands/Command.h
@@ -0,0 +1,173 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <set>
+#include <string>
+
+#include "ErrorBase.h"
+#include "SmartDashboard/NamedSendable.h"
+#include "tables/ITableListener.h"
+
+namespace frc {
+
+class CommandGroup;
+class Subsystem;
+
+/**
+ * The Command class is at the very core of the entire command framework.
+ * Every command can be started with a call to {@link Command#Start() Start()}.
+ * Once a command is started it will call {@link Command#Initialize()
+ * Initialize()}, and then will repeatedly call
+ * {@link Command#Execute() Execute()} until the
+ * {@link Command#IsFinished() IsFinished()} returns true.  Once it does,
+ * {@link Command#End() End()} will be called.
+ *
+ * <p>However, if at any point while it is running {@link Command#Cancel()
+ * Cancel()} is called, then the command will be stopped and
+ * {@link Command#Interrupted() Interrupted()} will be called.</p>
+ *
+ * <p>If a command uses a {@link Subsystem}, then it should specify that it does
+ * so by calling the {@link Command#Requires(Subsystem) Requires(...)} method
+ * in its constructor. Note that a Command may have multiple requirements, and
+ * {@link Command#Requires(Subsystem) Requires(...)} should be called for each
+ * one.</p>
+ *
+ * <p>If a command is running and a new command with shared requirements is
+ * started, then one of two things will happen.  If the active command is
+ * interruptible, then {@link Command#Cancel() Cancel()} will be called and the
+ * command will be removed to make way for the new one.  If the active command
+ * is not interruptible, the other one will not even be started, and the active
+ * one will continue functioning.</p>
+ *
+ * @see CommandGroup
+ * @see Subsystem
+ */
+class Command : public ErrorBase, public NamedSendable, public ITableListener {
+  friend class CommandGroup;
+  friend class Scheduler;
+
+ public:
+  Command();
+  explicit Command(const std::string& name);
+  explicit Command(double timeout);
+  Command(const std::string& name, double timeout);
+  virtual ~Command();
+  double TimeSinceInitialized() const;
+  void Requires(Subsystem* s);
+  bool IsCanceled() const;
+  void Start();
+  bool Run();
+  void Cancel();
+  bool IsRunning() const;
+  bool IsInterruptible() const;
+  void SetInterruptible(bool interruptible);
+  bool DoesRequire(Subsystem* subsystem) const;
+  typedef std::set<Subsystem*> SubsystemSet;
+  SubsystemSet GetRequirements() const;
+  CommandGroup* GetGroup() const;
+  void SetRunWhenDisabled(bool run);
+  bool WillRunWhenDisabled() const;
+  int GetID() const;
+
+ protected:
+  void SetTimeout(double timeout);
+  bool IsTimedOut() const;
+  bool AssertUnlocked(const std::string& message);
+  void SetParent(CommandGroup* parent);
+  void ClearRequirements();
+
+  virtual void Initialize();
+  virtual void Execute();
+
+  /**
+   * Returns whether this command is finished.
+   * If it is, then the command will be removed and {@link Command#end() end()}
+   * will be called.
+   *
+   * <p>It may be useful for a team to reference the {@link Command#isTimedOut()
+   * isTimedOut()} method for time-sensitive commands.</p>
+   *
+   * <p>Returning false will result in the command never ending automatically.
+   * It may still be cancelled manually or interrupted by another command.
+   * Returning true will result in the command executing once and finishing
+   * immediately. We recommend using {@link InstantCommand} for this.</p>
+   *
+   * @return whether this command is finished.
+   * @see Command#isTimedOut() isTimedOut()
+   */
+  virtual bool IsFinished() = 0;
+
+  virtual void End();
+  virtual void Interrupted();
+
+  virtual void _Initialize();
+  virtual void _Interrupted();
+  virtual void _Execute();
+  virtual void _End();
+  virtual void _Cancel();
+
+  friend class ConditionalCommand;
+
+ private:
+  void LockChanges();
+  /*synchronized*/ void Removed();
+  void StartRunning();
+  void StartTiming();
+
+  /** The name of this command */
+  std::string m_name;
+
+  /** The time since this command was initialized */
+  double m_startTime = -1;
+
+  /** The time (in seconds) before this command "times out" (or -1 if no
+   * timeout) */
+  double m_timeout;
+
+  /** Whether or not this command has been initialized */
+  bool m_initialized = false;
+
+  /** The requirements (or null if no requirements) */
+  SubsystemSet m_requirements;
+
+  /** Whether or not it is running */
+  bool m_running = false;
+
+  /** Whether or not it is interruptible*/
+  bool m_interruptible = true;
+
+  /** Whether or not it has been canceled */
+  bool m_canceled = false;
+
+  /** Whether or not it has been locked */
+  bool m_locked = false;
+
+  /** Whether this command should run when the robot is disabled */
+  bool m_runWhenDisabled = false;
+
+  /** The {@link CommandGroup} this is in */
+  CommandGroup* m_parent = nullptr;
+
+  int m_commandID = m_commandCounter++;
+  static int m_commandCounter;
+
+ public:
+  std::string GetName() const override;
+  void InitTable(std::shared_ptr<ITable> subtable) override;
+  std::shared_ptr<ITable> GetTable() const override;
+  std::string GetSmartDashboardType() const override;
+  void ValueChanged(ITable* source, llvm::StringRef key,
+                    std::shared_ptr<nt::Value> value, bool isNew) override;
+
+ protected:
+  std::shared_ptr<ITable> m_table;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/CommandGroup.h b/wpilibc/shared/include/Commands/CommandGroup.h
new file mode 100644
index 0000000..a0315d5
--- /dev/null
+++ b/wpilibc/shared/include/Commands/CommandGroup.h
@@ -0,0 +1,76 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <list>
+#include <string>
+#include <vector>
+
+#include "Commands/Command.h"
+#include "Commands/CommandGroupEntry.h"
+
+namespace frc {
+
+/**
+ * A {@link CommandGroup} is a list of commands which are executed in sequence.
+ *
+ * <p>Commands in a {@link CommandGroup} are added using the {@link
+ * CommandGroup#AddSequential(Command) AddSequential(...)} method and are
+ * called sequentially. {@link CommandGroup CommandGroups} are themselves
+ * {@link Command Commands} and can be given to other
+ * {@link CommandGroup CommandGroups}.</p>
+ *
+ * <p>{@link CommandGroup CommandGroups} will carry all of the requirements of
+ * their {@link Command subcommands}.  Additional requirements can be specified
+ * by calling {@link CommandGroup#Requires(Subsystem) Requires(...)} normally
+ * in the constructor.</P>
+ *
+ * <p>CommandGroups can also execute commands in parallel, simply by adding them
+ * using {@link CommandGroup#AddParallel(Command) AddParallel(...)}.</p>
+ *
+ * @see Command
+ * @see Subsystem
+ */
+class CommandGroup : public Command {
+ public:
+  CommandGroup() = default;
+  explicit CommandGroup(const std::string& name);
+  virtual ~CommandGroup() = default;
+
+  void AddSequential(Command* command);
+  void AddSequential(Command* command, double timeout);
+  void AddParallel(Command* command);
+  void AddParallel(Command* command, double timeout);
+  bool IsInterruptible() const;
+  int GetSize() const;
+
+ protected:
+  virtual void Initialize();
+  virtual void Execute();
+  virtual bool IsFinished();
+  virtual void End();
+  virtual void Interrupted();
+  virtual void _Initialize();
+  virtual void _Interrupted();
+  virtual void _Execute();
+  virtual void _End();
+
+ private:
+  void CancelConflicts(Command* command);
+
+  /** The commands in this group (stored in entries) */
+  std::vector<CommandGroupEntry> m_commands;
+
+  /** The active children in this group (stored in entries) */
+  std::list<CommandGroupEntry> m_children;
+
+  /** The current command, -1 signifies that none have been run */
+  int m_currentCommandIndex = -1;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/CommandGroupEntry.h b/wpilibc/shared/include/Commands/CommandGroupEntry.h
new file mode 100644
index 0000000..b1f3e91
--- /dev/null
+++ b/wpilibc/shared/include/Commands/CommandGroupEntry.h
@@ -0,0 +1,31 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+namespace frc {
+
+class Command;
+
+class CommandGroupEntry {
+ public:
+  typedef enum {
+    kSequence_InSequence,
+    kSequence_BranchPeer,
+    kSequence_BranchChild
+  } Sequence;
+
+  CommandGroupEntry() = default;
+  CommandGroupEntry(Command* command, Sequence state, double timeout = -1.0);
+  bool IsTimedOut() const;
+
+  double m_timeout = -1.0;
+  Command* m_command = nullptr;
+  Sequence m_state = kSequence_InSequence;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/ConditionalCommand.h b/wpilibc/shared/include/Commands/ConditionalCommand.h
new file mode 100644
index 0000000..e7fcb3c
--- /dev/null
+++ b/wpilibc/shared/include/Commands/ConditionalCommand.h
@@ -0,0 +1,81 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2017. All Rights Reserved.                             */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <string>
+
+#include "Commands/Command.h"
+#include "Commands/InstantCommand.h"
+
+namespace frc {
+
+/**
+ * A {@link ConditionalCommand} is a {@link Command} that starts one of two
+ * commands.
+ *
+ * <p>
+ * A {@link ConditionalCommand} uses m_condition to determine whether it should
+ * run m_onTrue or m_onFalse.
+ * </p>
+ *
+ * <p>
+ * A {@link ConditionalCommand} adds the proper {@link Command} to the {@link
+ * Scheduler} during {@link ConditionalCommand#initialize()} and then {@link
+ * ConditionalCommand#isFinished()} will return true once that {@link Command}
+ * has finished executing.
+ * </p>
+ *
+ * <p>
+ * If no {@link Command} is specified for m_onFalse, the occurrence of that
+ * condition will be a no-op.
+ * </p>
+ *
+ * @see Command
+ * @see Scheduler
+ */
+class ConditionalCommand : public Command {
+ public:
+  explicit ConditionalCommand(Command* onTrue,
+                              Command* onFalse = new InstantCommand());
+  ConditionalCommand(const std::string& name, Command* onTrue,
+                     Command* onFalse = new InstantCommand());
+  virtual ~ConditionalCommand() = default;
+
+ protected:
+  /**
+   * The Condition to test to determine which Command to run.
+   *
+   * @return true if m_onTrue should be run or false if m_onFalse should be run.
+   */
+  virtual bool Condition() = 0;
+
+  void _Initialize() override;
+  void _Cancel() override;
+  bool IsFinished() override;
+  void Interrupted() override;
+
+ private:
+  /**
+   * The Command to execute if {@link ConditionalCommand#Condition()} returns
+   * true
+   */
+  Command* m_onTrue;
+
+  /**
+   * The Command to execute if {@link ConditionalCommand#Condition()} returns
+   * false
+   */
+  Command* m_onFalse;
+
+  /**
+   * Stores command chosen by condition
+   */
+  Command* m_chosenCommand = nullptr;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/InstantCommand.h b/wpilibc/shared/include/Commands/InstantCommand.h
new file mode 100644
index 0000000..1ac2bd0
--- /dev/null
+++ b/wpilibc/shared/include/Commands/InstantCommand.h
@@ -0,0 +1,32 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <string>
+
+#include "Commands/Command.h"
+
+namespace frc {
+
+/**
+ * This command will execute once, then finish immediately afterward.
+ *
+ * <p>Subclassing {@link InstantCommand} is shorthand for returning true from
+ * {@link Command isFinished}.
+ */
+class InstantCommand : public Command {
+ public:
+  explicit InstantCommand(const std::string& name);
+  InstantCommand() = default;
+  virtual ~InstantCommand() = default;
+
+ protected:
+  bool IsFinished() override;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/PIDCommand.h b/wpilibc/shared/include/Commands/PIDCommand.h
new file mode 100644
index 0000000..4cc426e
--- /dev/null
+++ b/wpilibc/shared/include/Commands/PIDCommand.h
@@ -0,0 +1,61 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "Commands/Command.h"
+#include "PIDController.h"
+#include "PIDOutput.h"
+#include "PIDSource.h"
+
+namespace frc {
+
+class PIDCommand : public Command, public PIDOutput, public PIDSource {
+ public:
+  PIDCommand(const std::string& name, double p, double i, double d);
+  PIDCommand(const std::string& name, double p, double i, double d,
+             double period);
+  PIDCommand(const std::string& name, double p, double i, double d, double f,
+             double period);
+  PIDCommand(double p, double i, double d);
+  PIDCommand(double p, double i, double d, double period);
+  PIDCommand(double p, double i, double d, double f, double period);
+  virtual ~PIDCommand() = default;
+
+  void SetSetpointRelative(double deltaSetpoint);
+
+  // PIDOutput interface
+  virtual void PIDWrite(double output);
+
+  // PIDSource interface
+  virtual double PIDGet();
+
+ protected:
+  std::shared_ptr<PIDController> GetPIDController() const;
+  virtual void _Initialize();
+  virtual void _Interrupted();
+  virtual void _End();
+  void SetSetpoint(double setpoint);
+  double GetSetpoint() const;
+  double GetPosition();
+
+  virtual double ReturnPIDInput() = 0;
+  virtual void UsePIDOutput(double output) = 0;
+
+ private:
+  /** The internal {@link PIDController} */
+  std::shared_ptr<PIDController> m_controller;
+
+ public:
+  void InitTable(std::shared_ptr<ITable> subtable) override;
+  std::string GetSmartDashboardType() const override;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/PIDSubsystem.h b/wpilibc/shared/include/Commands/PIDSubsystem.h
new file mode 100644
index 0000000..d73aef6
--- /dev/null
+++ b/wpilibc/shared/include/Commands/PIDSubsystem.h
@@ -0,0 +1,76 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "Commands/Subsystem.h"
+#include "PIDController.h"
+#include "PIDOutput.h"
+#include "PIDSource.h"
+
+namespace frc {
+
+/**
+ * This class is designed to handle the case where there is a {@link Subsystem}
+ * which uses a single {@link PIDController} almost constantly (for instance,
+ * an elevator which attempts to stay at a constant height).
+ *
+ * <p>It provides some convenience methods to run an internal {@link
+ * PIDController}. It also allows access to the internal {@link PIDController}
+ * in order to give total control to the programmer.</p>
+ *
+ */
+class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource {
+ public:
+  PIDSubsystem(const std::string& name, double p, double i, double d);
+  PIDSubsystem(const std::string& name, double p, double i, double d, double f);
+  PIDSubsystem(const std::string& name, double p, double i, double d, double f,
+               double period);
+  PIDSubsystem(double p, double i, double d);
+  PIDSubsystem(double p, double i, double d, double f);
+  PIDSubsystem(double p, double i, double d, double f, double period);
+  virtual ~PIDSubsystem() = default;
+
+  void Enable();
+  void Disable();
+
+  // PIDOutput interface
+  virtual void PIDWrite(double output);
+
+  // PIDSource interface
+  virtual double PIDGet();
+  void SetSetpoint(double setpoint);
+  void SetSetpointRelative(double deltaSetpoint);
+  void SetInputRange(double minimumInput, double maximumInput);
+  void SetOutputRange(double minimumOutput, double maximumOutput);
+  double GetSetpoint();
+  double GetPosition();
+  double GetRate();
+
+  virtual void SetAbsoluteTolerance(double absValue);
+  virtual void SetPercentTolerance(double percent);
+  virtual bool OnTarget() const;
+
+ protected:
+  std::shared_ptr<PIDController> GetPIDController();
+
+  virtual double ReturnPIDInput() = 0;
+  virtual void UsePIDOutput(double output) = 0;
+
+ private:
+  /** The internal {@link PIDController} */
+  std::shared_ptr<PIDController> m_controller;
+
+ public:
+  void InitTable(std::shared_ptr<ITable> subtable) override;
+  std::string GetSmartDashboardType() const override;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/PrintCommand.h b/wpilibc/shared/include/Commands/PrintCommand.h
new file mode 100644
index 0000000..ee8396b
--- /dev/null
+++ b/wpilibc/shared/include/Commands/PrintCommand.h
@@ -0,0 +1,28 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <string>
+
+#include "Commands/InstantCommand.h"
+
+namespace frc {
+
+class PrintCommand : public InstantCommand {
+ public:
+  explicit PrintCommand(const std::string& message);
+  virtual ~PrintCommand() = default;
+
+ protected:
+  virtual void Initialize();
+
+ private:
+  std::string m_message;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/Scheduler.h b/wpilibc/shared/include/Commands/Scheduler.h
new file mode 100644
index 0000000..eb749aa
--- /dev/null
+++ b/wpilibc/shared/include/Commands/Scheduler.h
@@ -0,0 +1,73 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
+#include <string>
+#include <vector>
+
+#include "Commands/Command.h"
+#include "ErrorBase.h"
+#include "HAL/cpp/priority_mutex.h"
+#include "SmartDashboard/NamedSendable.h"
+#include "SmartDashboard/SmartDashboard.h"
+#include "networktables/NetworkTable.h"
+
+namespace frc {
+
+class ButtonScheduler;
+class Subsystem;
+
+class Scheduler : public ErrorBase, public NamedSendable {
+ public:
+  static Scheduler* GetInstance();
+
+  void AddCommand(Command* command);
+  void AddButton(ButtonScheduler* button);
+  void RegisterSubsystem(Subsystem* subsystem);
+  void Run();
+  void Remove(Command* command);
+  void RemoveAll();
+  void ResetAll();
+  void SetEnabled(bool enabled);
+
+  void UpdateTable();
+  std::string GetSmartDashboardType() const;
+  void InitTable(std::shared_ptr<ITable> subTable);
+  std::shared_ptr<ITable> GetTable() const;
+  std::string GetName() const;
+  std::string GetType() const;
+
+ private:
+  Scheduler();
+  virtual ~Scheduler() = default;
+
+  void ProcessCommandAddition(Command* command);
+
+  Command::SubsystemSet m_subsystems;
+  priority_mutex m_buttonsLock;
+  typedef std::vector<ButtonScheduler*> ButtonVector;
+  ButtonVector m_buttons;
+  typedef std::vector<Command*> CommandVector;
+  priority_mutex m_additionsLock;
+  CommandVector m_additions;
+  typedef std::set<Command*> CommandSet;
+  CommandSet m_commands;
+  bool m_adding = false;
+  bool m_enabled = true;
+  std::vector<std::string> commands;
+  std::vector<double> ids;
+  std::vector<double> toCancel;
+  std::shared_ptr<ITable> m_table;
+  bool m_runningCommandsChanged = false;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/StartCommand.h b/wpilibc/shared/include/Commands/StartCommand.h
new file mode 100644
index 0000000..9ac4d21
--- /dev/null
+++ b/wpilibc/shared/include/Commands/StartCommand.h
@@ -0,0 +1,26 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Commands/InstantCommand.h"
+
+namespace frc {
+
+class StartCommand : public InstantCommand {
+ public:
+  explicit StartCommand(Command* commandToStart);
+  virtual ~StartCommand() = default;
+
+ protected:
+  virtual void Initialize();
+
+ private:
+  Command* m_commandToFork;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/Subsystem.h b/wpilibc/shared/include/Commands/Subsystem.h
new file mode 100644
index 0000000..3121098
--- /dev/null
+++ b/wpilibc/shared/include/Commands/Subsystem.h
@@ -0,0 +1,52 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "ErrorBase.h"
+#include "SmartDashboard/NamedSendable.h"
+
+namespace frc {
+
+class Command;
+
+class Subsystem : public ErrorBase, public NamedSendable {
+  friend class Scheduler;
+
+ public:
+  explicit Subsystem(const std::string& name);
+  virtual ~Subsystem() = default;
+
+  void SetDefaultCommand(Command* command);
+  Command* GetDefaultCommand();
+  void SetCurrentCommand(Command* command);
+  Command* GetCurrentCommand() const;
+  virtual void InitDefaultCommand();
+
+ private:
+  void ConfirmCommand();
+
+  Command* m_currentCommand = nullptr;
+  bool m_currentCommandChanged = true;
+  Command* m_defaultCommand = nullptr;
+  std::string m_name;
+  bool m_initializedDefaultCommand = false;
+
+ public:
+  std::string GetName() const override;
+  void InitTable(std::shared_ptr<ITable> subtable) override;
+  std::shared_ptr<ITable> GetTable() const override;
+  std::string GetSmartDashboardType() const override;
+
+ protected:
+  std::shared_ptr<ITable> m_table;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/TimedCommand.h b/wpilibc/shared/include/Commands/TimedCommand.h
new file mode 100644
index 0000000..3331aa3
--- /dev/null
+++ b/wpilibc/shared/include/Commands/TimedCommand.h
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <string>
+
+#include "Commands/Command.h"
+
+namespace frc {
+
+/**
+ * A {@link TimedCommand} will wait for a timeout before finishing.
+ * {@link TimedCommand} is used to execute a command for a given amount of time.
+ */
+class TimedCommand : public Command {
+ public:
+  TimedCommand(const std::string& name, double timeout);
+  explicit TimedCommand(double timeout);
+  virtual ~TimedCommand() = default;
+
+ protected:
+  bool IsFinished() override;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/WaitCommand.h b/wpilibc/shared/include/Commands/WaitCommand.h
new file mode 100644
index 0000000..e1be8aa
--- /dev/null
+++ b/wpilibc/shared/include/Commands/WaitCommand.h
@@ -0,0 +1,23 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <string>
+
+#include "Commands/TimedCommand.h"
+
+namespace frc {
+
+class WaitCommand : public TimedCommand {
+ public:
+  explicit WaitCommand(double timeout);
+  WaitCommand(const std::string& name, double timeout);
+  virtual ~WaitCommand() = default;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/WaitForChildren.h b/wpilibc/shared/include/Commands/WaitForChildren.h
new file mode 100644
index 0000000..3537805
--- /dev/null
+++ b/wpilibc/shared/include/Commands/WaitForChildren.h
@@ -0,0 +1,26 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <string>
+
+#include "Commands/Command.h"
+
+namespace frc {
+
+class WaitForChildren : public Command {
+ public:
+  explicit WaitForChildren(double timeout);
+  WaitForChildren(const std::string& name, double timeout);
+  virtual ~WaitForChildren() = default;
+
+ protected:
+  virtual bool IsFinished();
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Commands/WaitUntilCommand.h b/wpilibc/shared/include/Commands/WaitUntilCommand.h
new file mode 100644
index 0000000..190522d
--- /dev/null
+++ b/wpilibc/shared/include/Commands/WaitUntilCommand.h
@@ -0,0 +1,29 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <string>
+
+#include "Commands/Command.h"
+
+namespace frc {
+
+class WaitUntilCommand : public Command {
+ public:
+  explicit WaitUntilCommand(double time);
+  WaitUntilCommand(const std::string& name, double time);
+  virtual ~WaitUntilCommand() = default;
+
+ protected:
+  virtual bool IsFinished();
+
+ private:
+  double m_time;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Controller.h b/wpilibc/shared/include/Controller.h
new file mode 100644
index 0000000..68c2712
--- /dev/null
+++ b/wpilibc/shared/include/Controller.h
@@ -0,0 +1,34 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+namespace frc {
+
+/**
+ * Interface for Controllers.
+ * Common interface for controllers. Controllers run control loops, the most
+ * common are PID controllers and their variants, but this includes anything
+ * that is controlling an actuator in a separate thread.
+ */
+class Controller {
+ public:
+  virtual ~Controller() = default;
+
+  /**
+   * Allows the control loop to run
+   */
+  virtual void Enable() = 0;
+
+  /**
+   * Stops the control loop from running until explicitly re-enabled by calling
+   * enable()
+   */
+  virtual void Disable() = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Error.h b/wpilibc/shared/include/Error.h
new file mode 100644
index 0000000..435c644
--- /dev/null
+++ b/wpilibc/shared/include/Error.h
@@ -0,0 +1,65 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <stdint.h>
+
+#include <string>
+
+#include "Base.h"
+#include "llvm/StringRef.h"
+
+#ifdef _WIN32
+#include <Windows.h>
+// Windows.h defines #define GetMessage GetMessageW, which we don't want.
+#undef GetMessage
+#endif
+
+namespace frc {
+
+//  Forward declarations
+class ErrorBase;
+
+/**
+ * Error object represents a library error.
+ */
+class Error {
+ public:
+  typedef int Code;
+
+  Error() = default;
+
+  Error(const Error&) = delete;
+  Error& operator=(const Error&) = delete;
+
+  void Clone(const Error& error);
+  Code GetCode() const;
+  std::string GetMessage() const;
+  std::string GetFilename() const;
+  std::string GetFunction() const;
+  int GetLineNumber() const;
+  const ErrorBase* GetOriginatingObject() const;
+  double GetTimestamp() const;
+  void Clear();
+  void Set(Code code, llvm::StringRef contextMessage, llvm::StringRef filename,
+           llvm::StringRef function, int lineNumber,
+           const ErrorBase* originatingObject);
+
+ private:
+  void Report();
+
+  Code m_code = 0;
+  std::string m_message;
+  std::string m_filename;
+  std::string m_function;
+  int m_lineNumber = 0;
+  const ErrorBase* m_originatingObject = nullptr;
+  double m_timestamp = 0.0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/ErrorBase.h b/wpilibc/shared/include/ErrorBase.h
new file mode 100644
index 0000000..652e8ea
--- /dev/null
+++ b/wpilibc/shared/include/ErrorBase.h
@@ -0,0 +1,120 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Base.h"
+#include "Error.h"
+#include "HAL/cpp/priority_mutex.h"
+#include "llvm/StringRef.h"
+
+#define wpi_setErrnoErrorWithContext(context) \
+  this->SetErrnoError((context), __FILE__, __FUNCTION__, __LINE__)
+#define wpi_setErrnoError() wpi_setErrnoErrorWithContext("")
+#define wpi_setImaqErrorWithContext(code, context)                             \
+  do {                                                                         \
+    if ((code) != 0)                                                           \
+      this->SetImaqError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
+  } while (0)
+#define wpi_setErrorWithContext(code, context)                             \
+  do {                                                                     \
+    if ((code) != 0)                                                       \
+      this->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
+  } while (0)
+#define wpi_setErrorWithContextRange(code, min, max, req, context)          \
+  do {                                                                      \
+    if ((code) != 0)                                                        \
+      this->SetErrorRange((code), (min), (max), (req), (context), __FILE__, \
+                          __FUNCTION__, __LINE__);                          \
+  } while (0)
+#define wpi_setError(code) wpi_setErrorWithContext(code, "")
+#define wpi_setStaticErrorWithContext(object, code, context)                 \
+  do {                                                                       \
+    if ((code) != 0)                                                         \
+      object->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
+  } while (0)
+#define wpi_setStaticError(object, code) \
+  wpi_setStaticErrorWithContext(object, code, "")
+#define wpi_setGlobalErrorWithContext(code, context)                \
+  do {                                                              \
+    if ((code) != 0)                                                \
+      ::frc::ErrorBase::SetGlobalError((code), (context), __FILE__, \
+                                       __FUNCTION__, __LINE__);     \
+  } while (0)
+#define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "")
+#define wpi_setWPIErrorWithContext(error, context)                    \
+  this->SetWPIError((wpi_error_s_##error), (wpi_error_value_##error), \
+                    (context), __FILE__, __FUNCTION__, __LINE__)
+#define wpi_setWPIError(error) (wpi_setWPIErrorWithContext(error, ""))
+#define wpi_setStaticWPIErrorWithContext(object, error, context)  \
+  object->SetWPIError((wpi_error_s_##error), (context), __FILE__, \
+                      __FUNCTION__, __LINE__)
+#define wpi_setStaticWPIError(object, error) \
+  wpi_setStaticWPIErrorWithContext(object, error, "")
+#define wpi_setGlobalWPIErrorWithContext(error, context)                \
+  ::frc::ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), \
+                                      __FILE__, __FUNCTION__, __LINE__)
+#define wpi_setGlobalWPIError(error) wpi_setGlobalWPIErrorWithContext(error, "")
+
+namespace frc {
+
+/**
+ * Base class for most objects.
+ * ErrorBase is the base class for most objects since it holds the generated
+ * error
+ * for that object. In addition, there is a single instance of a global error
+ * object
+ */
+class ErrorBase {
+  // TODO: Consider initializing instance variables and cleanup in destructor
+ public:
+  ErrorBase() = default;
+  virtual ~ErrorBase() = default;
+
+  ErrorBase(const ErrorBase&) = delete;
+  ErrorBase& operator=(const ErrorBase&) = delete;
+
+  virtual Error& GetError();
+  virtual const Error& GetError() const;
+  virtual void SetErrnoError(llvm::StringRef contextMessage,
+                             llvm::StringRef filename, llvm::StringRef function,
+                             int lineNumber) const;
+  virtual void SetImaqError(int success, llvm::StringRef contextMessage,
+                            llvm::StringRef filename, llvm::StringRef function,
+                            int lineNumber) const;
+  virtual void SetError(Error::Code code, llvm::StringRef contextMessage,
+                        llvm::StringRef filename, llvm::StringRef function,
+                        int lineNumber) const;
+  virtual void SetErrorRange(Error::Code code, int32_t minRange,
+                             int32_t maxRange, int32_t requestedValue,
+                             llvm::StringRef contextMessage,
+                             llvm::StringRef filename, llvm::StringRef function,
+                             int lineNumber) const;
+  virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code,
+                           llvm::StringRef contextMessage,
+                           llvm::StringRef filename, llvm::StringRef function,
+                           int lineNumber) const;
+  virtual void CloneError(const ErrorBase& rhs) const;
+  virtual void ClearError() const;
+  virtual bool StatusIsFatal() const;
+  static void SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
+                             llvm::StringRef filename, llvm::StringRef function,
+                             int lineNumber);
+  static void SetGlobalWPIError(llvm::StringRef errorMessage,
+                                llvm::StringRef contextMessage,
+                                llvm::StringRef filename,
+                                llvm::StringRef function, int lineNumber);
+  static Error& GetGlobalError();
+
+ protected:
+  mutable Error m_error;
+  // TODO: Replace globalError with a global list of all errors.
+  static priority_mutex _globalErrorMutex;
+  static Error _globalError;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Filters/Filter.h b/wpilibc/shared/include/Filters/Filter.h
new file mode 100644
index 0000000..eabc1c7
--- /dev/null
+++ b/wpilibc/shared/include/Filters/Filter.h
@@ -0,0 +1,54 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2015-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+
+#include "PIDSource.h"
+
+namespace frc {
+
+/**
+ * Interface for filters
+ */
+class Filter : public PIDSource {
+ public:
+  explicit Filter(std::shared_ptr<PIDSource> source);
+  virtual ~Filter() = default;
+
+  // PIDSource interface
+  void SetPIDSourceType(PIDSourceType pidSource) override;
+  PIDSourceType GetPIDSourceType() const;
+  double PIDGet() override = 0;
+
+  /**
+   * Returns the current filter estimate without also inserting new data as
+   * PIDGet() would do.
+   *
+   * @return The current filter estimate
+   */
+  virtual double Get() const = 0;
+
+  /**
+   * Reset the filter state
+   */
+  virtual void Reset() = 0;
+
+ protected:
+  /**
+   * Calls PIDGet() of source
+   *
+   * @return Current value of source
+   */
+  double PIDGetSource();
+
+ private:
+  std::shared_ptr<PIDSource> m_source;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Filters/LinearDigitalFilter.h b/wpilibc/shared/include/Filters/LinearDigitalFilter.h
new file mode 100644
index 0000000..a9fabc4
--- /dev/null
+++ b/wpilibc/shared/include/Filters/LinearDigitalFilter.h
@@ -0,0 +1,106 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2015-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <initializer_list>
+#include <memory>
+#include <vector>
+
+#include "CircularBuffer.h"
+#include "Filter.h"
+
+namespace frc {
+
+/**
+ * This class implements a linear, digital filter. All types of FIR and IIR
+ * filters are supported. Static factory methods are provided to create commonly
+ * used types of filters.
+ *
+ * Filters are of the form:<br>
+ *  y[n] = (b0 * x[n] + b1 * x[n-1] + … + bP * x[n-P]) -
+ *         (a0 * y[n-1] + a2 * y[n-2] + … + aQ * y[n-Q])
+ *
+ * Where:<br>
+ *  y[n] is the output at time "n"<br>
+ *  x[n] is the input at time "n"<br>
+ *  y[n-1] is the output from the LAST time step ("n-1")<br>
+ *  x[n-1] is the input from the LAST time step ("n-1")<br>
+ *  b0 … bP are the "feedforward" (FIR) gains<br>
+ *  a0 … aQ are the "feedback" (IIR) gains<br>
+ * IMPORTANT! Note the "-" sign in front of the feedback term! This is a common
+ *            convention in signal processing.
+ *
+ * What can linear filters do? Basically, they can filter, or diminish, the
+ * effects of undesirable input frequencies. High frequencies, or rapid changes,
+ * can be indicative of sensor noise or be otherwise undesirable. A "low pass"
+ * filter smooths out the signal, reducing the impact of these high frequency
+ * components.  Likewise, a "high pass" filter gets rid of slow-moving signal
+ * components, letting you detect large changes more easily.
+ *
+ * Example FRC applications of filters:
+ *  - Getting rid of noise from an analog sensor input (note: the roboRIO's FPGA
+ *    can do this faster in hardware)
+ *  - Smoothing out joystick input to prevent the wheels from slipping or the
+ *    robot from tipping
+ *  - Smoothing motor commands so that unnecessary strain isn't put on
+ *    electrical or mechanical components
+ *  - If you use clever gains, you can make a PID controller out of this class!
+ *
+ * For more on filters, I highly recommend the following articles:<br>
+ *  http://en.wikipedia.org/wiki/Linear_filter<br>
+ *  http://en.wikipedia.org/wiki/Iir_filter<br>
+ *  http://en.wikipedia.org/wiki/Fir_filter<br>
+ *
+ * Note 1: PIDGet() should be called by the user on a known, regular period.
+ * You can set up a Notifier to do this (look at the WPILib PIDController
+ * class), or do it "inline" with code in a periodic function.
+ *
+ * Note 2: For ALL filters, gains are necessarily a function of frequency. If
+ * you make a filter that works well for you at, say, 100Hz, you will most
+ * definitely need to adjust the gains if you then want to run it at 200Hz!
+ * Combining this with Note 1 - the impetus is on YOU as a developer to make
+ * sure PIDGet() gets called at the desired, constant frequency!
+ */
+class LinearDigitalFilter : public Filter {
+ public:
+  LinearDigitalFilter(std::shared_ptr<PIDSource> source,
+                      std::initializer_list<double> ffGains,
+                      std::initializer_list<double> fbGains);
+  LinearDigitalFilter(std::shared_ptr<PIDSource> source,
+                      std::initializer_list<double> ffGains,
+                      const std::vector<double>& fbGains);
+  LinearDigitalFilter(std::shared_ptr<PIDSource> source,
+                      const std::vector<double>& ffGains,
+                      std::initializer_list<double> fbGains);
+  LinearDigitalFilter(std::shared_ptr<PIDSource> source,
+                      const std::vector<double>& ffGains,
+                      const std::vector<double>& fbGains);
+
+  // Static methods to create commonly used filters
+  static LinearDigitalFilter SinglePoleIIR(std::shared_ptr<PIDSource> source,
+                                           double timeConstant, double period);
+  static LinearDigitalFilter HighPass(std::shared_ptr<PIDSource> source,
+                                      double timeConstant, double period);
+  static LinearDigitalFilter MovingAverage(std::shared_ptr<PIDSource> source,
+                                           int taps);
+
+  // Filter interface
+  double Get() const override;
+  void Reset() override;
+
+  // PIDSource interface
+  double PIDGet() override;
+
+ private:
+  CircularBuffer<double> m_inputs;
+  CircularBuffer<double> m_outputs;
+  std::vector<double> m_inputGains;
+  std::vector<double> m_outputGains;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/GamepadBase.h b/wpilibc/shared/include/GamepadBase.h
new file mode 100644
index 0000000..b073c2c
--- /dev/null
+++ b/wpilibc/shared/include/GamepadBase.h
@@ -0,0 +1,26 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "GenericHID.h"
+
+namespace frc {
+
+/**
+ * Gamepad Interface.
+ */
+class GamepadBase : public GenericHID {
+ public:
+  explicit GamepadBase(int port);
+  virtual ~GamepadBase() = default;
+
+  virtual bool GetBumper(JoystickHand hand = kRightHand) const = 0;
+  virtual bool GetStickButton(JoystickHand hand) const = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/GenericHID.h b/wpilibc/shared/include/GenericHID.h
new file mode 100644
index 0000000..657abe6
--- /dev/null
+++ b/wpilibc/shared/include/GenericHID.h
@@ -0,0 +1,75 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <stdint.h>
+
+#include <string>
+
+namespace frc {
+
+class DriverStation;
+
+/**
+ * GenericHID Interface.
+ */
+class GenericHID {
+ public:
+  typedef enum { kLeftRumble, kRightRumble } RumbleType;
+
+  typedef enum {
+    kUnknown = -1,
+    kXInputUnknown = 0,
+    kXInputGamepad = 1,
+    kXInputWheel = 2,
+    kXInputArcadeStick = 3,
+    kXInputFlightStick = 4,
+    kXInputDancePad = 5,
+    kXInputGuitar = 6,
+    kXInputGuitar2 = 7,
+    kXInputDrumKit = 8,
+    kXInputGuitar3 = 11,
+    kXInputArcadePad = 19,
+    kHIDJoystick = 20,
+    kHIDGamepad = 21,
+    kHIDDriving = 22,
+    kHIDFlight = 23,
+    kHID1stPerson = 24
+  } HIDType;
+
+  enum JoystickHand { kLeftHand = 0, kRightHand = 1 };
+
+  explicit GenericHID(int port);
+  virtual ~GenericHID() = default;
+
+  virtual double GetX(JoystickHand hand = kRightHand) const = 0;
+  virtual double GetY(JoystickHand hand = kRightHand) const = 0;
+  virtual double GetRawAxis(int axis) const;
+
+  bool GetRawButton(int button) const;
+
+  int GetPOV(int pov = 0) const;
+  int GetPOVCount() const;
+
+  int GetPort() const;
+  GenericHID::HIDType GetType() const;
+  std::string GetName() const;
+
+  void SetOutput(int outputNumber, bool value);
+  void SetOutputs(int value);
+  void SetRumble(RumbleType type, double value);
+
+ private:
+  DriverStation& m_ds;
+  int m_port;
+  int m_outputs = 0;
+  uint16_t m_leftRumble = 0;
+  uint16_t m_rightRumble = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/GyroBase.h b/wpilibc/shared/include/GyroBase.h
new file mode 100644
index 0000000..03b4617
--- /dev/null
+++ b/wpilibc/shared/include/GyroBase.h
@@ -0,0 +1,45 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "LiveWindow/LiveWindowSendable.h"
+#include "PIDSource.h"
+#include "SensorBase.h"
+#include "interfaces/Gyro.h"
+
+namespace frc {
+
+/**
+ * GyroBase is the common base class for Gyro implementations such as
+ * AnalogGyro.
+ */
+class GyroBase : public Gyro,
+                 public SensorBase,
+                 public PIDSource,
+                 public LiveWindowSendable {
+ public:
+  virtual ~GyroBase() = default;
+
+  // PIDSource interface
+  double PIDGet() override;
+
+  void UpdateTable() override;
+  void StartLiveWindowMode() override;
+  void StopLiveWindowMode() override;
+  std::string GetSmartDashboardType() const override;
+  void InitTable(std::shared_ptr<ITable> subTable) override;
+  std::shared_ptr<ITable> GetTable() const override;
+
+ private:
+  std::shared_ptr<ITable> m_table;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/HLUsageReporting.h b/wpilibc/shared/include/HLUsageReporting.h
new file mode 100644
index 0000000..3d3c47b
--- /dev/null
+++ b/wpilibc/shared/include/HLUsageReporting.h
@@ -0,0 +1,29 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+namespace frc {
+
+class HLUsageReportingInterface {
+ public:
+  virtual ~HLUsageReportingInterface() = default;
+  virtual void ReportScheduler() = 0;
+  virtual void ReportSmartDashboard() = 0;
+};
+
+class HLUsageReporting {
+ private:
+  static HLUsageReportingInterface* impl;
+
+ public:
+  static void SetImplementation(HLUsageReportingInterface* i);
+  static void ReportScheduler();
+  static void ReportSmartDashboard();
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Joystick.h b/wpilibc/shared/include/Joystick.h
new file mode 100644
index 0000000..e4ee16f
--- /dev/null
+++ b/wpilibc/shared/include/Joystick.h
@@ -0,0 +1,88 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <stdint.h>
+
+#include <memory>
+#include <vector>
+
+#include "ErrorBase.h"
+#include "JoystickBase.h"
+
+namespace frc {
+
+class DriverStation;
+
+/**
+ * Handle input from standard Joysticks connected to the Driver Station.
+ * This class handles standard input that comes from the Driver Station. Each
+ * time a value is requested the most recent value is returned. There is a
+ * single class instance for each joystick and the mapping of ports to hardware
+ * buttons depends on the code in the Driver Station.
+ */
+class Joystick : public JoystickBase, public ErrorBase {
+ public:
+  static const int kDefaultXAxis = 0;
+  static const int kDefaultYAxis = 1;
+  static const int kDefaultZAxis = 2;
+  static const int kDefaultTwistAxis = 2;
+  static const int kDefaultThrottleAxis = 3;
+
+  typedef enum {
+    kXAxis,
+    kYAxis,
+    kZAxis,
+    kTwistAxis,
+    kThrottleAxis,
+    kNumAxisTypes
+  } AxisType;
+
+  static const int kDefaultTriggerButton = 1;
+  static const int kDefaultTopButton = 2;
+
+  typedef enum { kTriggerButton, kTopButton, kNumButtonTypes } ButtonType;
+
+  explicit Joystick(int port);
+  Joystick(int port, int numAxisTypes, int numButtonTypes);
+  virtual ~Joystick() = default;
+
+  Joystick(const Joystick&) = delete;
+  Joystick& operator=(const Joystick&) = delete;
+
+  int GetAxisChannel(AxisType axis) const;
+  void SetAxisChannel(AxisType axis, int channel);
+
+  double GetX(JoystickHand hand = kRightHand) const override;
+  double GetY(JoystickHand hand = kRightHand) const override;
+  double GetZ(JoystickHand hand = kRightHand) const override;
+  double GetTwist() const override;
+  double GetThrottle() const override;
+  virtual double GetAxis(AxisType axis) const;
+
+  bool GetTrigger(JoystickHand hand = kRightHand) const override;
+  bool GetTop(JoystickHand hand = kRightHand) const override;
+  bool GetButton(ButtonType button) const;
+  static Joystick* GetStickForPort(int port);
+
+  virtual double GetMagnitude() const;
+  virtual double GetDirectionRadians() const;
+  virtual double GetDirectionDegrees() const;
+
+  int GetAxisType(int axis) const;
+
+  int GetAxisCount() const;
+  int GetButtonCount() const;
+
+ private:
+  DriverStation& m_ds;
+  std::vector<int> m_axes;
+  std::vector<int> m_buttons;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/JoystickBase.h b/wpilibc/shared/include/JoystickBase.h
new file mode 100644
index 0000000..262c3e2
--- /dev/null
+++ b/wpilibc/shared/include/JoystickBase.h
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "GenericHID.h"
+
+namespace frc {
+
+/**
+ * Joystick Interface.
+ */
+class JoystickBase : public GenericHID {
+ public:
+  explicit JoystickBase(int port);
+  virtual ~JoystickBase() = default;
+
+  virtual double GetZ(JoystickHand hand = kRightHand) const = 0;
+  virtual double GetTwist() const = 0;
+  virtual double GetThrottle() const = 0;
+
+  virtual bool GetTrigger(JoystickHand hand = kRightHand) const = 0;
+  virtual bool GetTop(JoystickHand hand = kRightHand) const = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/LiveWindow/LiveWindow.h b/wpilibc/shared/include/LiveWindow/LiveWindow.h
new file mode 100644
index 0000000..c2be96a
--- /dev/null
+++ b/wpilibc/shared/include/LiveWindow/LiveWindow.h
@@ -0,0 +1,87 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2012-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "Commands/Scheduler.h"
+#include "LiveWindow/LiveWindowSendable.h"
+#include "tables/ITable.h"
+
+namespace frc {
+
+struct LiveWindowComponent {
+  std::string subsystem;
+  std::string name;
+  bool isSensor = false;
+
+  LiveWindowComponent() = default;
+  LiveWindowComponent(std::string subsystem, std::string name, bool isSensor) {
+    this->subsystem = subsystem;
+    this->name = name;
+    this->isSensor = isSensor;
+  }
+};
+
+/**
+ * The LiveWindow class is the public interface for putting sensors and
+ * actuators
+ * on the LiveWindow.
+ */
+class LiveWindow {
+ public:
+  static LiveWindow* GetInstance();
+  void Run();
+  void AddSensor(const std::string& subsystem, const std::string& name,
+                 LiveWindowSendable* component);
+  void AddSensor(const std::string& subsystem, const std::string& name,
+                 LiveWindowSendable& component);
+  void AddSensor(const std::string& subsystem, const std::string& name,
+                 std::shared_ptr<LiveWindowSendable> component);
+  void AddActuator(const std::string& subsystem, const std::string& name,
+                   LiveWindowSendable* component);
+  void AddActuator(const std::string& subsystem, const std::string& name,
+                   LiveWindowSendable& component);
+  void AddActuator(const std::string& subsystem, const std::string& name,
+                   std::shared_ptr<LiveWindowSendable> component);
+
+  void AddSensor(std::string type, int channel, LiveWindowSendable* component);
+  void AddActuator(std::string type, int channel,
+                   LiveWindowSendable* component);
+  void AddActuator(std::string type, int module, int channel,
+                   LiveWindowSendable* component);
+
+  bool IsEnabled() const { return m_enabled; }
+  void SetEnabled(bool enabled);
+
+ protected:
+  LiveWindow();
+  virtual ~LiveWindow() = default;
+
+ private:
+  void UpdateValues();
+  void Initialize();
+  void InitializeLiveWindowComponents();
+
+  std::vector<std::shared_ptr<LiveWindowSendable>> m_sensors;
+  std::map<std::shared_ptr<LiveWindowSendable>, LiveWindowComponent>
+      m_components;
+
+  std::shared_ptr<ITable> m_liveWindowTable;
+  std::shared_ptr<ITable> m_statusTable;
+
+  Scheduler* m_scheduler;
+
+  bool m_enabled = false;
+  bool m_firstTime = true;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/LiveWindow/LiveWindowSendable.h b/wpilibc/shared/include/LiveWindow/LiveWindowSendable.h
new file mode 100644
index 0000000..08b330d
--- /dev/null
+++ b/wpilibc/shared/include/LiveWindow/LiveWindowSendable.h
@@ -0,0 +1,38 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2012-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "SmartDashboard/Sendable.h"
+
+namespace frc {
+
+/**
+ * Live Window Sendable is a special type of object sendable to the live window.
+ */
+class LiveWindowSendable : public Sendable {
+ public:
+  /**
+   * Update the table for this sendable object with the latest
+   * values.
+   */
+  virtual void UpdateTable() = 0;
+
+  /**
+   * Start having this sendable object automatically respond to
+   * value changes reflect the value on the table.
+   */
+  virtual void StartLiveWindowMode() = 0;
+
+  /**
+   * Stop having this sendable object automatically respond to value
+   * changes.
+   */
+  virtual void StopLiveWindowMode() = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/LiveWindow/LiveWindowStatusListener.h b/wpilibc/shared/include/LiveWindow/LiveWindowStatusListener.h
new file mode 100644
index 0000000..ec6fc2f
--- /dev/null
+++ b/wpilibc/shared/include/LiveWindow/LiveWindowStatusListener.h
@@ -0,0 +1,23 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2012-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+
+#include "tables/ITable.h"
+#include "tables/ITableListener.h"
+
+namespace frc {
+
+class LiveWindowStatusListener : public ITableListener {
+ public:
+  virtual void ValueChanged(ITable* source, llvm::StringRef key,
+                            std::shared_ptr<nt::Value> value, bool isNew);
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/PIDController.h b/wpilibc/shared/include/PIDController.h
new file mode 100644
index 0000000..a304f9c
--- /dev/null
+++ b/wpilibc/shared/include/PIDController.h
@@ -0,0 +1,153 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <atomic>
+#include <memory>
+#include <queue>
+#include <string>
+
+#include "Base.h"
+#include "Controller.h"
+#include "HAL/cpp/priority_mutex.h"
+#include "LiveWindow/LiveWindow.h"
+#include "Notifier.h"
+#include "PIDInterface.h"
+#include "PIDSource.h"
+#include "Timer.h"
+
+namespace frc {
+
+class PIDOutput;
+
+/**
+ * Class implements a PID Control Loop.
+ *
+ * Creates a separate thread which reads the given PIDSource and takes
+ * care of the integral calculations, as well as writing the given PIDOutput.
+ *
+ * This feedback controller runs in discrete time, so time deltas are not used
+ * in the integral and derivative calculations. Therefore, the sample rate
+ * affects the controller's behavior for a given set of PID constants.
+ */
+class PIDController : public LiveWindowSendable,
+                      public PIDInterface,
+                      public ITableListener {
+ public:
+  PIDController(double p, double i, double d, PIDSource* source,
+                PIDOutput* output, double period = 0.05);
+  PIDController(double p, double i, double d, double f, PIDSource* source,
+                PIDOutput* output, double period = 0.05);
+  virtual ~PIDController();
+
+  PIDController(const PIDController&) = delete;
+  PIDController& operator=(const PIDController) = delete;
+
+  virtual double Get() const;
+  virtual void SetContinuous(bool continuous = true);
+  virtual void SetInputRange(double minimumInput, double maximumInput);
+  virtual void SetOutputRange(double minimumOutput, double maximumOutput);
+  void SetPID(double p, double i, double d) override;
+  virtual void SetPID(double p, double i, double d, double f);
+  double GetP() const override;
+  double GetI() const override;
+  double GetD() const override;
+  virtual double GetF() const;
+
+  void SetSetpoint(double setpoint) override;
+  double GetSetpoint() const override;
+  double GetDeltaSetpoint() const;
+
+  virtual double GetError() const;
+  virtual double GetAvgError() const;
+
+  virtual void SetPIDSourceType(PIDSourceType pidSource);
+  virtual PIDSourceType GetPIDSourceType() const;
+
+  virtual void SetTolerance(double percent);
+  virtual void SetAbsoluteTolerance(double absValue);
+  virtual void SetPercentTolerance(double percentValue);
+  virtual void SetToleranceBuffer(int buf = 1);
+  virtual bool OnTarget() const;
+
+  void Enable() override;
+  void Disable() override;
+  bool IsEnabled() const override;
+
+  void Reset() override;
+
+  void InitTable(std::shared_ptr<ITable> subtable) override;
+
+ protected:
+  PIDSource* m_pidInput;
+  PIDOutput* m_pidOutput;
+
+  std::shared_ptr<ITable> m_table;
+  virtual void Calculate();
+  virtual double CalculateFeedForward();
+  double GetContinuousError(double error) const;
+
+ private:
+  // factor for "proportional" control
+  double m_P;
+  // factor for "integral" control
+  double m_I;
+  // factor for "derivative" control
+  double m_D;
+  // factor for "feed forward" control
+  double m_F;
+  // |maximum output|
+  double m_maximumOutput = 1.0;
+  // |minimum output|
+  double m_minimumOutput = -1.0;
+  // maximum input - limit setpoint to this
+  double m_maximumInput = 0;
+  // minimum input - limit setpoint to this
+  double m_minimumInput = 0;
+  // do the endpoints wrap around? eg. Absolute encoder
+  bool m_continuous = false;
+  // is the pid controller enabled
+  bool m_enabled = false;
+  // the prior error (used to compute velocity)
+  double m_prevError = 0;
+  // the sum of the errors for use in the integral calc
+  double m_totalError = 0;
+  enum {
+    kAbsoluteTolerance,
+    kPercentTolerance,
+    kNoTolerance
+  } m_toleranceType = kNoTolerance;
+
+  // the percetage or absolute error that is considered on target.
+  double m_tolerance = 0.05;
+  double m_setpoint = 0;
+  double m_prevSetpoint = 0;
+  double m_error = 0;
+  double m_result = 0;
+  double m_period;
+
+  // Length of buffer for averaging for tolerances.
+  std::atomic<unsigned> m_bufLength{1};
+  std::queue<double> m_buf;
+  double m_bufTotal = 0;
+
+  mutable priority_recursive_mutex m_mutex;
+
+  std::unique_ptr<Notifier> m_controlLoop;
+  Timer m_setpointTimer;
+
+  std::shared_ptr<ITable> GetTable() const override;
+  std::string GetSmartDashboardType() const override;
+  void ValueChanged(ITable* source, llvm::StringRef key,
+                    std::shared_ptr<nt::Value> value, bool isNew) override;
+  void UpdateTable() override;
+  void StartLiveWindowMode() override;
+  void StopLiveWindowMode() override;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/PIDInterface.h b/wpilibc/shared/include/PIDInterface.h
new file mode 100644
index 0000000..608b8d8
--- /dev/null
+++ b/wpilibc/shared/include/PIDInterface.h
@@ -0,0 +1,32 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Base.h"
+#include "Controller.h"
+#include "LiveWindow/LiveWindow.h"
+
+namespace frc {
+
+class PIDInterface : public Controller {
+  virtual void SetPID(double p, double i, double d) = 0;
+  virtual double GetP() const = 0;
+  virtual double GetI() const = 0;
+  virtual double GetD() const = 0;
+
+  virtual void SetSetpoint(double setpoint) = 0;
+  virtual double GetSetpoint() const = 0;
+
+  virtual void Enable() = 0;
+  virtual void Disable() = 0;
+  virtual bool IsEnabled() const = 0;
+
+  virtual void Reset() = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/PIDOutput.h b/wpilibc/shared/include/PIDOutput.h
new file mode 100644
index 0000000..efa4255
--- /dev/null
+++ b/wpilibc/shared/include/PIDOutput.h
@@ -0,0 +1,25 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Base.h"
+
+namespace frc {
+
+/**
+ * PIDOutput interface is a generic output for the PID class.
+ * PWMs use this class.
+ * Users implement this interface to allow for a PIDController to
+ * read directly from the inputs.
+ */
+class PIDOutput {
+ public:
+  virtual void PIDWrite(double output) = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/PIDSource.h b/wpilibc/shared/include/PIDSource.h
new file mode 100644
index 0000000..1f849c1
--- /dev/null
+++ b/wpilibc/shared/include/PIDSource.h
@@ -0,0 +1,29 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+namespace frc {
+
+enum class PIDSourceType { kDisplacement, kRate };
+
+/**
+ * PIDSource interface is a generic sensor source for the PID class.
+ * All sensors that can be used with the PID class will implement the PIDSource
+ * that returns a standard value that will be used in the PID code.
+ */
+class PIDSource {
+ public:
+  virtual void SetPIDSourceType(PIDSourceType pidSource);
+  PIDSourceType GetPIDSourceType() const;
+  virtual double PIDGet() = 0;
+
+ protected:
+  PIDSourceType m_pidSource = PIDSourceType::kDisplacement;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Resource.h b/wpilibc/shared/include/Resource.h
new file mode 100644
index 0000000..d42ce50
--- /dev/null
+++ b/wpilibc/shared/include/Resource.h
@@ -0,0 +1,51 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <stdint.h>
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "ErrorBase.h"
+#include "HAL/cpp/priority_mutex.h"
+
+namespace frc {
+
+/**
+ * The Resource class is a convenient way to track allocated resources.
+ * It tracks them as indicies in the range [0 .. elements - 1].
+ * E.g. the library uses this to track hardware channel allocation.
+ *
+ * The Resource class does not allocate the hardware channels or other
+ * resources; it just tracks which indices were marked in use by
+ * Allocate and not yet freed by Free.
+ */
+class Resource : public ErrorBase {
+ public:
+  virtual ~Resource() = default;
+
+  Resource(const Resource&) = delete;
+  Resource& operator=(const Resource&) = delete;
+
+  static void CreateResourceObject(std::unique_ptr<Resource>& r,
+                                   uint32_t elements);
+  explicit Resource(uint32_t size);
+  uint32_t Allocate(const std::string& resourceDesc);
+  uint32_t Allocate(uint32_t index, const std::string& resourceDesc);
+  void Free(uint32_t index);
+
+ private:
+  std::vector<bool> m_isAllocated;
+  priority_recursive_mutex m_allocateLock;
+
+  static priority_recursive_mutex m_createLock;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/RobotState.h b/wpilibc/shared/include/RobotState.h
new file mode 100644
index 0000000..195bb62
--- /dev/null
+++ b/wpilibc/shared/include/RobotState.h
@@ -0,0 +1,38 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+
+namespace frc {
+
+class RobotStateInterface {
+ public:
+  virtual ~RobotStateInterface() = default;
+  virtual bool IsDisabled() const = 0;
+  virtual bool IsEnabled() const = 0;
+  virtual bool IsOperatorControl() const = 0;
+  virtual bool IsAutonomous() const = 0;
+  virtual bool IsTest() const = 0;
+};
+
+class RobotState {
+ private:
+  static std::shared_ptr<RobotStateInterface> impl;
+
+ public:
+  static void SetImplementation(RobotStateInterface& i);
+  static void SetImplementation(std::shared_ptr<RobotStateInterface> i);
+  static bool IsDisabled();
+  static bool IsEnabled();
+  static bool IsOperatorControl();
+  static bool IsAutonomous();
+  static bool IsTest();
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/SmartDashboard/NamedSendable.h b/wpilibc/shared/include/SmartDashboard/NamedSendable.h
new file mode 100644
index 0000000..759447f
--- /dev/null
+++ b/wpilibc/shared/include/SmartDashboard/NamedSendable.h
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2012-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <string>
+
+#include "SmartDashboard/Sendable.h"
+
+namespace frc {
+
+/**
+ * The interface for sendable objects that gives the sendable a default name in
+ * the Smart Dashboard
+ *
+ */
+class NamedSendable : public Sendable {
+ public:
+  /**
+   * @return the name of the subtable of SmartDashboard that the Sendable object
+   *         will use
+   */
+  virtual std::string GetName() const = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/SmartDashboard/Sendable.h b/wpilibc/shared/include/SmartDashboard/Sendable.h
new file mode 100644
index 0000000..d7ca758
--- /dev/null
+++ b/wpilibc/shared/include/SmartDashboard/Sendable.h
@@ -0,0 +1,37 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "tables/ITable.h"
+
+namespace frc {
+
+class Sendable {
+ public:
+  /**
+   * Initializes a table for this sendable object.
+   * @param subtable The table to put the values in.
+   */
+  virtual void InitTable(std::shared_ptr<ITable> subtable) = 0;
+
+  /**
+   * @return the table that is currently associated with the sendable
+   */
+  virtual std::shared_ptr<ITable> GetTable() const = 0;
+
+  /**
+   * @return the string representation of the named data type that will be used
+   *         by the smart dashboard for this sendable
+   */
+  virtual std::string GetSmartDashboardType() const = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/SmartDashboard/SendableChooser.h b/wpilibc/shared/include/SmartDashboard/SendableChooser.h
new file mode 100644
index 0000000..5dbee54
--- /dev/null
+++ b/wpilibc/shared/include/SmartDashboard/SendableChooser.h
@@ -0,0 +1,51 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "SmartDashboard/SendableChooserBase.h"
+#include "llvm/StringMap.h"
+#include "llvm/StringRef.h"
+#include "tables/ITable.h"
+
+namespace frc {
+
+/**
+ * The {@link SendableChooser} class is a useful tool for presenting a selection
+ * of options to the {@link SmartDashboard}.
+ *
+ * <p>For instance, you may wish to be able to select between multiple
+ * autonomous modes. You can do this by putting every possible {@link Command}
+ * you want to run as an autonomous into a {@link SendableChooser} and then put
+ * it into the {@link SmartDashboard} to have a list of options appear on the
+ * laptop.  Once autonomous starts, simply ask the {@link SendableChooser} what
+ * the selected value is.</p>
+ *
+ * @tparam T The type of values to be stored
+ * @see SmartDashboard
+ */
+template <class T>
+class SendableChooser : public SendableChooserBase {
+ public:
+  virtual ~SendableChooser() = default;
+
+  void AddObject(llvm::StringRef name, const T& object);
+  void AddDefault(llvm::StringRef name, const T& object);
+  T GetSelected();
+
+  void InitTable(std::shared_ptr<ITable> subtable) override;
+
+ private:
+  llvm::StringMap<T> m_choices;
+};
+
+}  // namespace frc
+
+#include "SendableChooser.inc"
diff --git a/wpilibc/shared/include/SmartDashboard/SendableChooser.inc b/wpilibc/shared/include/SmartDashboard/SendableChooser.inc
new file mode 100644
index 0000000..ba9363f
--- /dev/null
+++ b/wpilibc/shared/include/SmartDashboard/SendableChooser.inc
@@ -0,0 +1,83 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <algorithm>
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace frc {
+
+/**
+ * Adds the given object to the list of options.
+ *
+ * On the {@link SmartDashboard} on the desktop, the object will appear as the
+ * given name.
+ *
+ * @param name   the name of the option
+ * @param object the option
+ */
+template <class T>
+void SendableChooser<T>::AddObject(llvm::StringRef name, const T& object) {
+  m_choices[name] = object;
+}
+
+/**
+ * Add the given object to the list of options and marks it as the default.
+ *
+ * Functionally, this is very close to {@link SendableChooser#AddObject(const
+ * char *name, void *object) AddObject(...)} except that it will use this as
+ * the default option if none other is explicitly selected.
+ *
+ * @param name   the name of the option
+ * @param object the option
+ */
+template <class T>
+void SendableChooser<T>::AddDefault(llvm::StringRef name, const T& object) {
+  m_defaultChoice = name;
+  AddObject(name, object);
+}
+
+/**
+ * Returns the selected option.
+ *
+ * If there is none selected, it will return the default.  If there is none
+ * selected and no default, then it will return {@code nullptr}.
+ *
+ * @return the option selected
+ */
+template <class T>
+T SendableChooser<T>::GetSelected() {
+  std::string selected = m_table->GetString(kSelected, m_defaultChoice);
+  if (selected == "") {
+    return nullptr;
+  } else {
+    return m_choices[selected];
+  }
+}
+
+template <class T>
+void SendableChooser<T>::InitTable(std::shared_ptr<ITable> subtable) {
+  std::vector<std::string> keys;
+  m_table = subtable;
+  if (m_table != nullptr) {
+    for (const auto& choice : m_choices) {
+      keys.push_back(choice.first());
+    }
+
+    // Unlike std::map, llvm::StringMap elements are not sorted
+    std::sort(keys.begin(), keys.end());
+
+    m_table->PutValue(kOptions, nt::Value::MakeStringArray(std::move(keys)));
+    m_table->PutString(kDefault, m_defaultChoice);
+  }
+}
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/SmartDashboard/SendableChooserBase.h b/wpilibc/shared/include/SmartDashboard/SendableChooserBase.h
new file mode 100644
index 0000000..04102ee
--- /dev/null
+++ b/wpilibc/shared/include/SmartDashboard/SendableChooserBase.h
@@ -0,0 +1,40 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2017. All Rights Reserved.                             */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <memory>
+#include <string>
+
+#include "SmartDashboard/Sendable.h"
+#include "tables/ITable.h"
+
+namespace frc {
+
+/**
+ * This class is a non-template base class for {@link SendableChooser}.
+ *
+ * It contains static, non-templated variables to avoid their duplication in the
+ * template class.
+ */
+class SendableChooserBase : public Sendable {
+ public:
+  virtual ~SendableChooserBase() = default;
+
+  std::shared_ptr<ITable> GetTable() const override;
+  std::string GetSmartDashboardType() const override;
+
+ protected:
+  static const char* kDefault;
+  static const char* kOptions;
+  static const char* kSelected;
+
+  std::string m_defaultChoice;
+  std::shared_ptr<ITable> m_table;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/SmartDashboard/SmartDashboard.h b/wpilibc/shared/include/SmartDashboard/SmartDashboard.h
new file mode 100644
index 0000000..8656d73
--- /dev/null
+++ b/wpilibc/shared/include/SmartDashboard/SmartDashboard.h
@@ -0,0 +1,100 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "SensorBase.h"
+#include "SmartDashboard/NamedSendable.h"
+#include "SmartDashboard/Sendable.h"
+#include "tables/ITable.h"
+
+namespace frc {
+
+class SmartDashboard : public SensorBase {
+ public:
+  static void init();
+
+  static bool ContainsKey(llvm::StringRef key);
+
+  static std::vector<std::string> GetKeys(int types = 0);
+
+  static void SetPersistent(llvm::StringRef key);
+  static void ClearPersistent(llvm::StringRef key);
+  static bool IsPersistent(llvm::StringRef key);
+
+  static void SetFlags(llvm::StringRef key, unsigned int flags);
+  static void ClearFlags(llvm::StringRef key, unsigned int flags);
+  static unsigned int GetFlags(llvm::StringRef key);
+
+  static void Delete(llvm::StringRef key);
+
+  static void PutData(llvm::StringRef key, Sendable* data);
+  static void PutData(NamedSendable* value);
+  static Sendable* GetData(llvm::StringRef keyName);
+
+  static bool PutBoolean(llvm::StringRef keyName, bool value);
+  static bool SetDefaultBoolean(llvm::StringRef key, bool defaultValue);
+  static bool GetBoolean(llvm::StringRef keyName, bool defaultValue);
+
+  static bool PutNumber(llvm::StringRef keyName, double value);
+  static bool SetDefaultNumber(llvm::StringRef key, double defaultValue);
+  static double GetNumber(llvm::StringRef keyName, double defaultValue);
+
+  static bool PutString(llvm::StringRef keyName, llvm::StringRef value);
+  static bool SetDefaultString(llvm::StringRef key,
+                               llvm::StringRef defaultValue);
+  static std::string GetString(llvm::StringRef keyName,
+                               llvm::StringRef defaultValue);
+
+  static bool PutBooleanArray(llvm::StringRef key, llvm::ArrayRef<int> value);
+  static bool SetDefaultBooleanArray(llvm::StringRef key,
+                                     llvm::ArrayRef<int> defaultValue);
+  static std::vector<int> GetBooleanArray(llvm::StringRef key,
+                                          llvm::ArrayRef<int> defaultValue);
+
+  static bool PutNumberArray(llvm::StringRef key, llvm::ArrayRef<double> value);
+  static bool SetDefaultNumberArray(llvm::StringRef key,
+                                    llvm::ArrayRef<double> defaultValue);
+  static std::vector<double> GetNumberArray(
+      llvm::StringRef key, llvm::ArrayRef<double> defaultValue);
+
+  static bool PutStringArray(llvm::StringRef key,
+                             llvm::ArrayRef<std::string> value);
+  static bool SetDefaultStringArray(llvm::StringRef key,
+                                    llvm::ArrayRef<std::string> defaultValue);
+  static std::vector<std::string> GetStringArray(
+      llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue);
+
+  static bool PutRaw(llvm::StringRef key, llvm::StringRef value);
+  static bool SetDefaultRaw(llvm::StringRef key, llvm::StringRef defaultValue);
+  static std::string GetRaw(llvm::StringRef key, llvm::StringRef defaultValue);
+
+  static bool PutValue(llvm::StringRef keyName,
+                       std::shared_ptr<nt::Value> value);
+  static bool SetDefaultValue(llvm::StringRef key,
+                              std::shared_ptr<nt::Value> defaultValue);
+  static std::shared_ptr<nt::Value> GetValue(llvm::StringRef keyName);
+
+ private:
+  virtual ~SmartDashboard() = default;
+
+  /** The {@link NetworkTable} used by {@link SmartDashboard} */
+  static std::shared_ptr<ITable> m_table;
+
+  /**
+   * A map linking tables in the SmartDashboard to the
+   * {@link SmartDashboardData} objects they came from.
+   */
+  static std::map<std::shared_ptr<ITable>, Sendable*> m_tablesToData;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Timer.h b/wpilibc/shared/include/Timer.h
new file mode 100644
index 0000000..c71e3c8
--- /dev/null
+++ b/wpilibc/shared/include/Timer.h
@@ -0,0 +1,57 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "Base.h"
+#include "HAL/cpp/priority_mutex.h"
+
+namespace frc {
+
+typedef void (*TimerInterruptHandler)(void* param);
+
+void Wait(double seconds);
+double GetClock();
+double GetTime();
+
+/**
+ * Timer objects measure accumulated time in seconds.
+ * The timer object functions like a stopwatch. It can be started, stopped, and
+ * cleared. When the timer is running its value counts up in seconds. When
+ * stopped, the timer holds the current value. The implementation simply records
+ * the time when started and subtracts the current time whenever the value is
+ * requested.
+ */
+class Timer {
+ public:
+  Timer();
+  virtual ~Timer() = default;
+
+  Timer(const Timer&) = delete;
+  Timer& operator=(const Timer&) = delete;
+
+  double Get() const;
+  void Reset();
+  void Start();
+  void Stop();
+  bool HasPeriodPassed(double period);
+
+  static double GetFPGATimestamp();
+  static double GetPPCTimestamp();
+  static double GetMatchTime();
+
+  // The time, in seconds, at which the 32-bit FPGA timestamp rolls over to 0
+  static const double kRolloverTime;
+
+ private:
+  double m_startTime = 0.0;
+  double m_accumulatedTime = 0.0;
+  bool m_running = false;
+  mutable priority_mutex m_mutex;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/Utility.h b/wpilibc/shared/include/Utility.h
new file mode 100644
index 0000000..bf97692
--- /dev/null
+++ b/wpilibc/shared/include/Utility.h
@@ -0,0 +1,60 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+/** @file
+ * Contains global utility functions
+ */
+
+#include <stdint.h>
+
+#include <string>
+
+#include "llvm/StringRef.h"
+
+#define wpi_assert(condition) \
+  wpi_assert_impl(condition, #condition, "", __FILE__, __LINE__, __FUNCTION__)
+#define wpi_assertWithMessage(condition, message)                     \
+  wpi_assert_impl(condition, #condition, message, __FILE__, __LINE__, \
+                  __FUNCTION__)
+
+#define wpi_assertEqual(a, b) \
+  wpi_assertEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__)
+#define wpi_assertEqualWithMessage(a, b, message) \
+  wpi_assertEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, __FUNCTION__)
+
+#define wpi_assertNotEqual(a, b) \
+  wpi_assertNotEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__)
+#define wpi_assertNotEqualWithMessage(a, b, message)                 \
+  wpi_assertNotEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, \
+                          __FUNCTION__)
+
+bool wpi_assert_impl(bool conditionValue, llvm::StringRef conditionText,
+                     llvm::StringRef message, llvm::StringRef fileName,
+                     int lineNumber, llvm::StringRef funcName);
+bool wpi_assertEqual_impl(int valueA, int valueB, llvm::StringRef valueAString,
+                          llvm::StringRef valueBString, llvm::StringRef message,
+                          llvm::StringRef fileName, int lineNumber,
+                          llvm::StringRef funcName);
+bool wpi_assertNotEqual_impl(int valueA, int valueB,
+                             llvm::StringRef valueAString,
+                             llvm::StringRef valueBString,
+                             llvm::StringRef message, llvm::StringRef fileName,
+                             int lineNumber, llvm::StringRef funcName);
+
+void wpi_suspendOnAssertEnabled(bool enabled);
+
+namespace frc {
+
+int GetFPGAVersion();
+int64_t GetFPGARevision();
+uint64_t GetFPGATime();
+bool GetUserButton();
+std::string GetStackTrace(int offset);
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/WPIErrors.h b/wpilibc/shared/include/WPIErrors.h
new file mode 100644
index 0000000..ece177c
--- /dev/null
+++ b/wpilibc/shared/include/WPIErrors.h
@@ -0,0 +1,104 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include <stdint.h>
+
+#ifdef WPI_ERRORS_DEFINE_STRINGS
+#define S(label, offset, message)            \
+  const char* wpi_error_s_##label = message; \
+  const int wpi_error_value_##label = offset
+#else
+#define S(label, offset, message)         \
+  extern const char* wpi_error_s_##label; \
+  const int wpi_error_value_##label = offset
+#endif
+
+/*
+ * Fatal errors
+ */
+S(ModuleIndexOutOfRange, -1,
+  "Allocating module that is out of range or not found");
+S(ChannelIndexOutOfRange, -1, "Allocating channel that is out of range");
+S(NotAllocated, -2, "Attempting to free unallocated resource");
+S(ResourceAlreadyAllocated, -3, "Attempted to reuse an allocated resource");
+S(NoAvailableResources, -4, "No available resources to allocate");
+S(NullParameter, -5, "A pointer parameter to a method is nullptr");
+S(Timeout, -6, "A timeout has been exceeded");
+S(CompassManufacturerError, -7, "Compass manufacturer doesn't match HiTechnic");
+S(CompassTypeError, -8,
+  "Compass type doesn't match expected type for HiTechnic compass");
+S(IncompatibleMode, -9, "The object is in an incompatible mode");
+S(AnalogTriggerLimitOrderError, -10,
+  "AnalogTrigger limits error.  Lower limit > Upper Limit");
+S(AnalogTriggerPulseOutputError, -11,
+  "Attempted to read AnalogTrigger pulse output.");
+S(TaskError, -12, "Task can't be started");
+S(TaskIDError, -13, "Task error: Invalid ID.");
+S(TaskDeletedError, -14, "Task error: Task already deleted.");
+S(TaskOptionsError, -15, "Task error: Invalid options.");
+S(TaskMemoryError, -16, "Task can't be started due to insufficient memory.");
+S(TaskPriorityError, -17, "Task error: Invalid priority [1-255].");
+S(DriveUninitialized, -18, "RobotDrive not initialized for the C interface");
+S(CompressorNonMatching, -19,
+  "Compressor slot/channel doesn't match previous instance");
+S(CompressorAlreadyDefined, -20, "Creating a second compressor instance");
+S(CompressorUndefined, -21,
+  "Using compressor functions without defining compressor");
+S(InconsistentArrayValueAdded, -22,
+  "When packing data into an array to the dashboard, not all values added were "
+  "of the same type.");
+S(MismatchedComplexTypeClose, -23,
+  "When packing data to the dashboard, a Close for a complex type was called "
+  "without a matching Open.");
+S(DashboardDataOverflow, -24,
+  "When packing data to the dashboard, too much data was packed and the buffer "
+  "overflowed.");
+S(DashboardDataCollision, -25,
+  "The same buffer was used for packing data and for printing.");
+S(EnhancedIOMissing, -26, "IO is not attached or Enhanced IO is not enabled.");
+S(LineNotOutput, -27,
+  "Cannot SetDigitalOutput for a line not configured for output.");
+S(ParameterOutOfRange, -28, "A parameter is out of range.");
+S(SPIClockRateTooLow, -29, "SPI clock rate was below the minimum supported");
+S(JaguarVersionError, -30, "Jaguar firmware version error");
+S(JaguarMessageNotFound, -31, "Jaguar message not found");
+S(NetworkTablesReadError, -40, "Error reading NetworkTables socket");
+S(NetworkTablesBufferFull, -41, "Buffer full writing to NetworkTables socket");
+S(NetworkTablesWrongType, -42,
+  "The wrong type was read from the NetworkTables entry");
+S(NetworkTablesCorrupt, -43, "NetworkTables data stream is corrupt");
+S(SmartDashboardMissingKey, -43, "SmartDashboard data does not exist");
+S(CommandIllegalUse, -50, "Illegal use of Command");
+S(UnsupportedInSimulation, -80, "Unsupported in simulation");
+S(CameraServerError, -90, "CameraServer error");
+
+/*
+ * Warnings
+ */
+S(SampleRateTooHigh, 1, "Analog module sample rate is too high");
+S(VoltageOutOfRange, 2,
+  "Voltage to convert to raw value is out of range [-10; 10]");
+S(CompressorTaskError, 3, "Compressor task won't start");
+S(LoopTimingError, 4, "Digital module loop timing is not the expected value");
+S(NonBinaryDigitalValue, 5, "Digital output value is not 0 or 1");
+S(IncorrectBatteryChannel, 6,
+  "Battery measurement channel is not correct value");
+S(BadJoystickIndex, 7, "Joystick index is out of range, should be 0-3");
+S(BadJoystickAxis, 8, "Joystick axis or POV is out of range");
+S(InvalidMotorIndex, 9, "Motor index is out of range, should be 0-3");
+S(DriverStationTaskError, 10, "Driver Station task won't start");
+S(EnhancedIOPWMPeriodOutOfRange, 11,
+  "Driver Station Enhanced IO PWM Output period out of range.");
+S(SPIWriteNoMOSI, 12, "Cannot write to SPI port with no MOSI output");
+S(SPIReadNoMISO, 13, "Cannot read from SPI port with no MISO input");
+S(SPIReadNoData, 14, "No data available to read from SPI");
+S(IncompatibleState, 15,
+  "Incompatible State: The operation cannot be completed");
+
+#undef S
diff --git a/wpilibc/shared/include/WPILibVersion.h b/wpilibc/shared/include/WPILibVersion.h
new file mode 100644
index 0000000..80c4a3c
--- /dev/null
+++ b/wpilibc/shared/include/WPILibVersion.h
@@ -0,0 +1,14 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+/*
+ * The corresponding WPILibVersion.cpp file is autogenerated by the build
+ * system. If it does not exist, make sure that you run a build.
+ */
+extern const char* WPILibVersion;
diff --git a/wpilibc/shared/include/XboxController.h b/wpilibc/shared/include/XboxController.h
new file mode 100644
index 0000000..d60d656
--- /dev/null
+++ b/wpilibc/shared/include/XboxController.h
@@ -0,0 +1,53 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "ErrorBase.h"
+#include "GamepadBase.h"
+
+namespace frc {
+
+class DriverStation;
+
+/**
+ * Handle input from Xbox 360 or Xbox One controllers connected to the Driver
+ * Station.
+ *
+ * This class handles Xbox input that comes from the Driver Station. Each time a
+ * value is requested the most recent value is returend. There is a single class
+ * instance for each controller and the mapping of ports to hardware buttons
+ * depends on the code in the Driver Station.
+ */
+class XboxController : public GamepadBase, public ErrorBase {
+ public:
+  explicit XboxController(int port);
+  virtual ~XboxController() = default;
+
+  XboxController(const XboxController&) = delete;
+  XboxController& operator=(const XboxController&) = delete;
+
+  double GetX(JoystickHand hand) const override;
+  double GetY(JoystickHand hand) const override;
+
+  bool GetBumper(JoystickHand hand) const override;
+  bool GetStickButton(JoystickHand hand) const override;
+
+  virtual double GetTriggerAxis(JoystickHand hand) const;
+
+  bool GetAButton() const;
+  bool GetBButton() const;
+  bool GetXButton() const;
+  bool GetYButton() const;
+  bool GetBackButton() const;
+  bool GetStartButton() const;
+
+ private:
+  DriverStation& m_ds;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/interfaces/Accelerometer.h b/wpilibc/shared/include/interfaces/Accelerometer.h
new file mode 100644
index 0000000..f8491eb
--- /dev/null
+++ b/wpilibc/shared/include/interfaces/Accelerometer.h
@@ -0,0 +1,51 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2014-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+namespace frc {
+
+/**
+ * Interface for 3-axis accelerometers
+ */
+class Accelerometer {
+ public:
+  virtual ~Accelerometer() = default;
+
+  enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 };
+
+  /**
+   * Common interface for setting the measuring range of an accelerometer.
+   *
+   * @param range The maximum acceleration, positive or negative, that the
+   * accelerometer will measure.  Not all accelerometers support all ranges.
+   */
+  virtual void SetRange(Range range) = 0;
+
+  /**
+   * Common interface for getting the x axis acceleration
+   *
+   * @return The acceleration along the x axis in g-forces
+   */
+  virtual double GetX() = 0;
+
+  /**
+   * Common interface for getting the y axis acceleration
+   *
+   * @return The acceleration along the y axis in g-forces
+   */
+  virtual double GetY() = 0;
+
+  /**
+   * Common interface for getting the z axis acceleration
+   *
+   * @return The acceleration along the z axis in g-forces
+   */
+  virtual double GetZ() = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/interfaces/Gyro.h b/wpilibc/shared/include/interfaces/Gyro.h
new file mode 100644
index 0000000..6ae2f65
--- /dev/null
+++ b/wpilibc/shared/include/interfaces/Gyro.h
@@ -0,0 +1,60 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2014-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+namespace frc {
+
+/**
+ * Interface for yaw rate gyros
+ */
+class Gyro {
+ public:
+  virtual ~Gyro() = default;
+
+  /**
+   * Calibrate the gyro by running for a number of samples and computing the
+   * center value. Then use the center value as the Accumulator center value for
+   * subsequent measurements. It's important to make sure that the robot is not
+   * moving while the centering calculations are in progress, this is typically
+   * done when the robot is first turned on while it's sitting at rest before
+   * the competition starts.
+   */
+  virtual void Calibrate() = 0;
+
+  /**
+   * Reset the gyro. Resets the gyro to a heading of zero. This can be used if
+   * there is significant drift in the gyro and it needs to be recalibrated
+   * after it has been running.
+   */
+  virtual void Reset() = 0;
+
+  /**
+   * Return the actual angle in degrees that the robot is currently facing.
+   *
+   * The angle is based on the current accumulator value corrected by the
+   * oversampling rate, the gyro type and the A/D calibration values. The angle
+   * is continuous, that is it will continue from 360 to 361 degrees. This
+   * allows algorithms that wouldn't want to see a discontinuity in the gyro
+   * output as it sweeps past from 360 to 0 on the second time around.
+   *
+   * @return the current heading of the robot in degrees. This heading is based
+   *         on integration of the returned rate from the gyro.
+   */
+  virtual double GetAngle() const = 0;
+
+  /**
+   * Return the rate of rotation of the gyro
+   *
+   * The rate is based on the most recent reading of the gyro analog value
+   *
+   * @return the current rate in degrees per second
+   */
+  virtual double GetRate() const = 0;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/include/interfaces/Potentiometer.h b/wpilibc/shared/include/interfaces/Potentiometer.h
new file mode 100644
index 0000000..b50a849
--- /dev/null
+++ b/wpilibc/shared/include/interfaces/Potentiometer.h
@@ -0,0 +1,31 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#pragma once
+
+#include "PIDSource.h"
+
+namespace frc {
+
+/**
+ * Interface for potentiometers.
+ */
+class Potentiometer : public PIDSource {
+ public:
+  virtual ~Potentiometer() = default;
+
+  /**
+   * Common interface for getting the current value of a potentiometer.
+   *
+   * @return The current set speed.  Value is between -1.0 and 1.0.
+   */
+  virtual double Get() const = 0;
+
+  void SetPIDSourceType(PIDSourceType pidSource) override;
+};
+
+}  // namespace frc
diff --git a/wpilibc/shared/src/Buttons/Button.cpp b/wpilibc/shared/src/Buttons/Button.cpp
new file mode 100644
index 0000000..4edc64e
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/Button.cpp
@@ -0,0 +1,50 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/Button.h"
+
+using namespace frc;
+
+/**
+ * Specifies the command to run when a button is first pressed.
+ *
+ * @param command The pointer to the command to run
+ */
+void Button::WhenPressed(Command* command) { WhenActive(command); }
+
+/**
+ * Specifies the command to be scheduled while the button is pressed.
+ *
+ * The command will be scheduled repeatedly while the button is pressed and will
+ * be canceled when the button is released.
+ *
+ * @param command The pointer to the command to run
+ */
+void Button::WhileHeld(Command* command) { WhileActive(command); }
+
+/**
+ * Specifies the command to run when the button is released.
+ *
+ * The command will be scheduled a single time.
+ *
+ * @param command The pointer to the command to run
+ */
+void Button::WhenReleased(Command* command) { WhenInactive(command); }
+
+/**
+ * Cancels the specificed command when the button is pressed.
+ *
+ * @param command The command to be canceled
+ */
+void Button::CancelWhenPressed(Command* command) { CancelWhenActive(command); }
+
+/**
+ * Toggle the specified command when the button is pressed.
+ *
+ * @param command The command to be toggled
+ */
+void Button::ToggleWhenPressed(Command* command) { ToggleWhenActive(command); }
diff --git a/wpilibc/shared/src/Buttons/ButtonScheduler.cpp b/wpilibc/shared/src/Buttons/ButtonScheduler.cpp
new file mode 100644
index 0000000..c1ce026
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/ButtonScheduler.cpp
@@ -0,0 +1,17 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/ButtonScheduler.h"
+
+#include "Commands/Scheduler.h"
+
+using namespace frc;
+
+ButtonScheduler::ButtonScheduler(bool last, Trigger* button, Command* orders)
+    : m_pressedLast(last), m_button(button), m_command(orders) {}
+
+void ButtonScheduler::Start() { Scheduler::GetInstance()->AddButton(this); }
diff --git a/wpilibc/shared/src/Buttons/CancelButtonScheduler.cpp b/wpilibc/shared/src/Buttons/CancelButtonScheduler.cpp
new file mode 100644
index 0000000..c3c419e
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/CancelButtonScheduler.cpp
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/CancelButtonScheduler.h"
+
+#include "Buttons/Button.h"
+#include "Commands/Command.h"
+
+using namespace frc;
+
+CancelButtonScheduler::CancelButtonScheduler(bool last, Trigger* button,
+                                             Command* orders)
+    : ButtonScheduler(last, button, orders) {
+  pressedLast = m_button->Grab();
+}
+
+void CancelButtonScheduler::Execute() {
+  if (m_button->Grab()) {
+    if (!pressedLast) {
+      pressedLast = true;
+      m_command->Cancel();
+    }
+  } else {
+    pressedLast = false;
+  }
+}
diff --git a/wpilibc/shared/src/Buttons/HeldButtonScheduler.cpp b/wpilibc/shared/src/Buttons/HeldButtonScheduler.cpp
new file mode 100644
index 0000000..21f9652
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/HeldButtonScheduler.cpp
@@ -0,0 +1,29 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/HeldButtonScheduler.h"
+
+#include "Buttons/Button.h"
+#include "Commands/Command.h"
+
+using namespace frc;
+
+HeldButtonScheduler::HeldButtonScheduler(bool last, Trigger* button,
+                                         Command* orders)
+    : ButtonScheduler(last, button, orders) {}
+
+void HeldButtonScheduler::Execute() {
+  if (m_button->Grab()) {
+    m_pressedLast = true;
+    m_command->Start();
+  } else {
+    if (m_pressedLast) {
+      m_pressedLast = false;
+      m_command->Cancel();
+    }
+  }
+}
diff --git a/wpilibc/shared/src/Buttons/InternalButton.cpp b/wpilibc/shared/src/Buttons/InternalButton.cpp
new file mode 100644
index 0000000..8969e38
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/InternalButton.cpp
@@ -0,0 +1,19 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/InternalButton.h"
+
+using namespace frc;
+
+InternalButton::InternalButton(bool inverted)
+    : m_pressed(inverted), m_inverted(inverted) {}
+
+void InternalButton::SetInverted(bool inverted) { m_inverted = inverted; }
+
+void InternalButton::SetPressed(bool pressed) { m_pressed = pressed; }
+
+bool InternalButton::Get() { return m_pressed ^ m_inverted; }
diff --git a/wpilibc/shared/src/Buttons/JoystickButton.cpp b/wpilibc/shared/src/Buttons/JoystickButton.cpp
new file mode 100644
index 0000000..92cec36
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/JoystickButton.cpp
@@ -0,0 +1,15 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/JoystickButton.h"
+
+using namespace frc;
+
+JoystickButton::JoystickButton(GenericHID* joystick, int buttonNumber)
+    : m_joystick(joystick), m_buttonNumber(buttonNumber) {}
+
+bool JoystickButton::Get() { return m_joystick->GetRawButton(m_buttonNumber); }
diff --git a/wpilibc/shared/src/Buttons/NetworkButton.cpp b/wpilibc/shared/src/Buttons/NetworkButton.cpp
new file mode 100644
index 0000000..d0c5abf
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/NetworkButton.cpp
@@ -0,0 +1,30 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/NetworkButton.h"
+
+#include "networktables/NetworkTable.h"
+
+using namespace frc;
+
+NetworkButton::NetworkButton(const std::string& tableName,
+                             const std::string& field)
+    :  // TODO how is this supposed to work???
+      m_netTable(NetworkTable::GetTable(tableName)),
+      m_field(field) {}
+
+NetworkButton::NetworkButton(std::shared_ptr<ITable> table,
+                             const std::string& field)
+    : m_netTable(table), m_field(field) {}
+
+bool NetworkButton::Get() {
+  /*if (m_netTable->isConnected())
+          return m_netTable->GetBoolean(m_field.c_str());
+  else
+          return false;*/
+  return m_netTable->GetBoolean(m_field, false);
+}
diff --git a/wpilibc/shared/src/Buttons/PressedButtonScheduler.cpp b/wpilibc/shared/src/Buttons/PressedButtonScheduler.cpp
new file mode 100644
index 0000000..d17ece3
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/PressedButtonScheduler.cpp
@@ -0,0 +1,28 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/PressedButtonScheduler.h"
+
+#include "Buttons/Button.h"
+#include "Commands/Command.h"
+
+using namespace frc;
+
+PressedButtonScheduler::PressedButtonScheduler(bool last, Trigger* button,
+                                               Command* orders)
+    : ButtonScheduler(last, button, orders) {}
+
+void PressedButtonScheduler::Execute() {
+  if (m_button->Grab()) {
+    if (!m_pressedLast) {
+      m_pressedLast = true;
+      m_command->Start();
+    }
+  } else {
+    m_pressedLast = false;
+  }
+}
diff --git a/wpilibc/shared/src/Buttons/ReleasedButtonScheduler.cpp b/wpilibc/shared/src/Buttons/ReleasedButtonScheduler.cpp
new file mode 100644
index 0000000..a0ec57e
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/ReleasedButtonScheduler.cpp
@@ -0,0 +1,28 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/ReleasedButtonScheduler.h"
+
+#include "Buttons/Button.h"
+#include "Commands/Command.h"
+
+using namespace frc;
+
+ReleasedButtonScheduler::ReleasedButtonScheduler(bool last, Trigger* button,
+                                                 Command* orders)
+    : ButtonScheduler(last, button, orders) {}
+
+void ReleasedButtonScheduler::Execute() {
+  if (m_button->Grab()) {
+    m_pressedLast = true;
+  } else {
+    if (m_pressedLast) {
+      m_pressedLast = false;
+      m_command->Start();
+    }
+  }
+}
diff --git a/wpilibc/shared/src/Buttons/ToggleButtonScheduler.cpp b/wpilibc/shared/src/Buttons/ToggleButtonScheduler.cpp
new file mode 100644
index 0000000..4225a80
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/ToggleButtonScheduler.cpp
@@ -0,0 +1,34 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/ToggleButtonScheduler.h"
+
+#include "Buttons/Button.h"
+#include "Commands/Command.h"
+
+using namespace frc;
+
+ToggleButtonScheduler::ToggleButtonScheduler(bool last, Trigger* button,
+                                             Command* orders)
+    : ButtonScheduler(last, button, orders) {
+  pressedLast = m_button->Grab();
+}
+
+void ToggleButtonScheduler::Execute() {
+  if (m_button->Grab()) {
+    if (!pressedLast) {
+      pressedLast = true;
+      if (m_command->IsRunning()) {
+        m_command->Cancel();
+      } else {
+        m_command->Start();
+      }
+    }
+  } else {
+    pressedLast = false;
+  }
+}
diff --git a/wpilibc/shared/src/Buttons/Trigger.cpp b/wpilibc/shared/src/Buttons/Trigger.cpp
new file mode 100644
index 0000000..f0e6bf3
--- /dev/null
+++ b/wpilibc/shared/src/Buttons/Trigger.cpp
@@ -0,0 +1,61 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Buttons/Button.h"
+#include "Buttons/CancelButtonScheduler.h"
+#include "Buttons/HeldButtonScheduler.h"
+#include "Buttons/PressedButtonScheduler.h"
+#include "Buttons/ReleasedButtonScheduler.h"
+#include "Buttons/ToggleButtonScheduler.h"
+
+using namespace frc;
+
+bool Trigger::Grab() {
+  if (Get()) {
+    return true;
+  } else if (m_table != nullptr) {
+    return m_table->GetBoolean("pressed", false);
+  } else {
+    return false;
+  }
+}
+
+void Trigger::WhenActive(Command* command) {
+  auto pbs = new PressedButtonScheduler(Grab(), this, command);
+  pbs->Start();
+}
+
+void Trigger::WhileActive(Command* command) {
+  auto hbs = new HeldButtonScheduler(Grab(), this, command);
+  hbs->Start();
+}
+
+void Trigger::WhenInactive(Command* command) {
+  auto rbs = new ReleasedButtonScheduler(Grab(), this, command);
+  rbs->Start();
+}
+
+void Trigger::CancelWhenActive(Command* command) {
+  auto cbs = new CancelButtonScheduler(Grab(), this, command);
+  cbs->Start();
+}
+
+void Trigger::ToggleWhenActive(Command* command) {
+  auto tbs = new ToggleButtonScheduler(Grab(), this, command);
+  tbs->Start();
+}
+
+std::string Trigger::GetSmartDashboardType() const { return "Button"; }
+
+void Trigger::InitTable(std::shared_ptr<ITable> subtable) {
+  m_table = subtable;
+  if (m_table != nullptr) {
+    m_table->PutBoolean("pressed", Get());
+  }
+}
+
+std::shared_ptr<ITable> Trigger::GetTable() const { return m_table; }
diff --git a/wpilibc/shared/src/Commands/Command.cpp b/wpilibc/shared/src/Commands/Command.cpp
new file mode 100644
index 0000000..3d7d2ac
--- /dev/null
+++ b/wpilibc/shared/src/Commands/Command.cpp
@@ -0,0 +1,459 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/Command.h"
+
+#include <typeinfo>
+
+#include "Commands/CommandGroup.h"
+#include "Commands/Scheduler.h"
+#include "RobotState.h"
+#include "Timer.h"
+#include "WPIErrors.h"
+
+using namespace frc;
+
+static const std::string kName = "name";
+static const std::string kRunning = "running";
+static const std::string kIsParented = "isParented";
+
+int Command::m_commandCounter = 0;
+
+/**
+ * Creates a new command.
+ * The name of this command will be default.
+ */
+Command::Command() : Command("", -1.0) {}
+
+/**
+ * Creates a new command with the given name and no timeout.
+ *
+ * @param name the name for this command
+ */
+Command::Command(const std::string& name) : Command(name, -1.0) {}
+
+/**
+ * Creates a new command with the given timeout and a default name.
+ *
+ * @param timeout the time (in seconds) before this command "times out"
+ * @see Command#isTimedOut() isTimedOut()
+ */
+Command::Command(double timeout) : Command("", timeout) {}
+
+/**
+ * Creates a new command with the given name and timeout.
+ *
+ * @param name    the name of the command
+ * @param timeout the time (in seconds) before this command "times out"
+ * @see Command#isTimedOut() isTimedOut()
+ */
+Command::Command(const std::string& name, double timeout) {
+  // We use -1.0 to indicate no timeout.
+  if (timeout < 0.0 && timeout != -1.0)
+    wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");
+
+  m_timeout = timeout;
+
+  // If name contains an empty string
+  if (name.length() == 0) {
+    m_name = std::string("Command_") + std::string(typeid(*this).name());
+  } else {
+    m_name = name;
+  }
+}
+
+Command::~Command() {
+  if (m_table != nullptr) m_table->RemoveTableListener(this);
+}
+
+/**
+ * Get the ID (sequence number) for this command.
+ *
+ * The ID is a unique sequence number that is incremented for each command.
+ *
+ * @return the ID of this command
+ */
+int Command::GetID() const { return m_commandID; }
+
+/**
+ * Sets the timeout of this command.
+ *
+ * @param timeout the timeout (in seconds)
+ * @see Command#isTimedOut() isTimedOut()
+ */
+void Command::SetTimeout(double timeout) {
+  if (timeout < 0.0)
+    wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");
+  else
+    m_timeout = timeout;
+}
+
+/**
+ * Returns the time since this command was initialized (in seconds).
+ *
+ * This function will work even if there is no specified timeout.
+ *
+ * @return the time since this command was initialized (in seconds).
+ */
+double Command::TimeSinceInitialized() const {
+  if (m_startTime < 0.0)
+    return 0.0;
+  else
+    return Timer::GetFPGATimestamp() - m_startTime;
+}
+
+/**
+ * This method specifies that the given {@link Subsystem} is used by this
+ * command.
+ *
+ * This method is crucial to the functioning of the Command System in general.
+ *
+ * <p>Note that the recommended way to call this method is in the
+ * constructor.</p>
+ *
+ * @param subsystem the {@link Subsystem} required
+ * @see Subsystem
+ */
+void Command::Requires(Subsystem* subsystem) {
+  if (!AssertUnlocked("Can not add new requirement to command")) return;
+
+  if (subsystem != nullptr)
+    m_requirements.insert(subsystem);
+  else
+    wpi_setWPIErrorWithContext(NullParameter, "subsystem");
+}
+
+/**
+ * Called when the command has been removed.
+ *
+ * This will call {@link Command#interrupted() interrupted()} or
+ * {@link Command#end() end()}.
+ */
+void Command::Removed() {
+  if (m_initialized) {
+    if (IsCanceled()) {
+      Interrupted();
+      _Interrupted();
+    } else {
+      End();
+      _End();
+    }
+  }
+  m_initialized = false;
+  m_canceled = false;
+  m_running = false;
+  if (m_table != nullptr) m_table->PutBoolean(kRunning, false);
+}
+
+/**
+ * Starts up the command.  Gets the command ready to start.
+ *
+ * <p>Note that the command will eventually start, however it will not
+ * necessarily do so immediately, and may in fact be canceled before initialize
+ * is even called.</p>
+ */
+void Command::Start() {
+  LockChanges();
+  if (m_parent != nullptr)
+    wpi_setWPIErrorWithContext(
+        CommandIllegalUse,
+        "Can not start a command that is part of a command group");
+
+  Scheduler::GetInstance()->AddCommand(this);
+}
+
+/**
+ * The run method is used internally to actually run the commands.
+ *
+ * @return whether or not the command should stay within the {@link Scheduler}.
+ */
+bool Command::Run() {
+  if (!m_runWhenDisabled && m_parent == nullptr && RobotState::IsDisabled())
+    Cancel();
+
+  if (IsCanceled()) return false;
+
+  if (!m_initialized) {
+    m_initialized = true;
+    StartTiming();
+    _Initialize();
+    Initialize();
+  }
+  _Execute();
+  Execute();
+  return !IsFinished();
+}
+
+/**
+ * The initialize method is called the first time this Command is run after
+ * being started.
+ */
+void Command::Initialize() {}
+
+/**
+ * The execute method is called repeatedly until this Command either finishes
+ * or is canceled.
+ */
+void Command::Execute() {}
+
+/**
+ * Called when the command ended peacefully.  This is where you may want
+ * to wrap up loose ends, like shutting off a motor that was being used
+ * in the command.
+ */
+void Command::End() {}
+
+/**
+ * Called when the command ends because somebody called
+ * {@link Command#cancel() cancel()} or another command shared the same
+ * requirements as this one, and booted it out.
+ *
+ * <p>This is where you may want to wrap up loose ends, like shutting off a
+ * motor that was being used in the command.</p>
+ *
+ * <p>Generally, it is useful to simply call the {@link Command#end() end()}
+ * method within this method, as done here.</p>
+ */
+void Command::Interrupted() { End(); }
+
+void Command::_Initialize() {}
+
+void Command::_Interrupted() {}
+
+void Command::_Execute() {}
+
+void Command::_End() {}
+
+/**
+ * Called to indicate that the timer should start.
+ *
+ * This is called right before {@link Command#initialize() initialize()} is,
+ * inside the {@link Command#run() run()} method.
+ */
+void Command::StartTiming() { m_startTime = Timer::GetFPGATimestamp(); }
+
+/**
+ * Returns whether or not the
+ * {@link Command#timeSinceInitialized() timeSinceInitialized()} method returns
+ * a number which is greater than or equal to the timeout for the command.
+ *
+ * If there is no timeout, this will always return false.
+ *
+ * @return whether the time has expired
+ */
+bool Command::IsTimedOut() const {
+  return m_timeout != -1 && TimeSinceInitialized() >= m_timeout;
+}
+
+/**
+ * Returns the requirements (as an std::set of {@link Subsystem Subsystems}
+ * pointers) of this command.
+ *
+ * @return the requirements (as an std::set of {@link Subsystem Subsystems}
+ *         pointers) of this command
+ */
+Command::SubsystemSet Command::GetRequirements() const {
+  return m_requirements;
+}
+
+/**
+ * Prevents further changes from being made.
+ */
+void Command::LockChanges() { m_locked = true; }
+
+/**
+ * If changes are locked, then this will generate a CommandIllegalUse error.
+ *
+ * @param message the message to report on error (it is appended by a default
+ *                message)
+ * @return true if assert passed, false if assert failed
+ */
+bool Command::AssertUnlocked(const std::string& message) {
+  if (m_locked) {
+    std::string buf =
+        message + " after being started or being added to a command group";
+    wpi_setWPIErrorWithContext(CommandIllegalUse, buf);
+    return false;
+  }
+  return true;
+}
+
+/**
+ * Sets the parent of this command.  No actual change is made to the group.
+ *
+ * @param parent the parent
+ */
+void Command::SetParent(CommandGroup* parent) {
+  if (parent == nullptr) {
+    wpi_setWPIErrorWithContext(NullParameter, "parent");
+  } else if (m_parent != nullptr) {
+    wpi_setWPIErrorWithContext(CommandIllegalUse,
+                               "Can not give command to a command group after "
+                               "already being put in a command group");
+  } else {
+    LockChanges();
+    m_parent = parent;
+    if (m_table != nullptr) {
+      m_table->PutBoolean(kIsParented, true);
+    }
+  }
+}
+
+/**
+ * Clears list of subsystem requirements. This is only used by
+ * {@link ConditionalCommand} so cancelling the chosen command works properly in
+ * {@link CommandGroup}.
+ */
+void Command::ClearRequirements() { m_requirements.clear(); }
+
+/**
+ * This is used internally to mark that the command has been started.
+ *
+ * The lifecycle of a command is:
+ *
+ * startRunning() is called.
+ * run() is called (multiple times potentially)
+ * removed() is called
+ *
+ * It is very important that startRunning and removed be called in order or some
+ * assumptions of the code will be broken.
+ */
+void Command::StartRunning() {
+  m_running = true;
+  m_startTime = -1;
+  if (m_table != nullptr) m_table->PutBoolean(kRunning, true);
+}
+
+/**
+ * Returns whether or not the command is running.
+ *
+ * This may return true even if the command has just been canceled, as it may
+ * not have yet called {@link Command#interrupted()}.
+ *
+ * @return whether or not the command is running
+ */
+bool Command::IsRunning() const { return m_running; }
+
+/**
+ * This will cancel the current command.
+ *
+ * <p>This will cancel the current command eventually.  It can be called
+ * multiple times. And it can be called when the command is not running.  If
+ * the command is running though, then the command will be marked as canceled
+ * and eventually removed.</p>
+ *
+ * <p>A command can not be canceled if it is a part of a command group, you
+ * must cancel the command group instead.</p>
+ */
+void Command::Cancel() {
+  if (m_parent != nullptr)
+    wpi_setWPIErrorWithContext(
+        CommandIllegalUse,
+        "Can not cancel a command that is part of a command group");
+
+  _Cancel();
+}
+
+/**
+ * This works like cancel(), except that it doesn't throw an exception if it is
+ * a part of a command group.
+ *
+ * Should only be called by the parent command group.
+ */
+void Command::_Cancel() {
+  if (IsRunning()) m_canceled = true;
+}
+
+/**
+ * Returns whether or not this has been canceled.
+ *
+ * @return whether or not this has been canceled
+ */
+bool Command::IsCanceled() const { return m_canceled; }
+
+/**
+ * Returns whether or not this command can be interrupted.
+ *
+ * @return whether or not this command can be interrupted
+ */
+bool Command::IsInterruptible() const { return m_interruptible; }
+
+/**
+ * Sets whether or not this command can be interrupted.
+ *
+ * @param interruptible whether or not this command can be interrupted
+ */
+void Command::SetInterruptible(bool interruptible) {
+  m_interruptible = interruptible;
+}
+
+/**
+ * Checks if the command requires the given {@link Subsystem}.
+ *
+ * @param system the system
+ * @return whether or not the subsystem is required (false if given nullptr)
+ */
+bool Command::DoesRequire(Subsystem* system) const {
+  return m_requirements.count(system) > 0;
+}
+
+/**
+ * Returns the {@link CommandGroup} that this command is a part of.
+ *
+ * Will return null if this {@link Command} is not in a group.
+ *
+ * @return the {@link CommandGroup} that this command is a part of (or null if
+ *         not in group)
+ */
+CommandGroup* Command::GetGroup() const { return m_parent; }
+
+/**
+ * Sets whether or not this {@link Command} should run when the robot is
+ * disabled.
+ *
+ * <p>By default a command will not run when the robot is disabled, and will in
+ * fact be canceled.</p>
+ *
+ * @param run whether or not this command should run when the robot is disabled
+ */
+void Command::SetRunWhenDisabled(bool run) { m_runWhenDisabled = run; }
+
+/**
+ * Returns whether or not this {@link Command} will run when the robot is
+ * disabled, or if it will cancel itself.
+ *
+ * @return whether or not this {@link Command} will run when the robot is
+ *         disabled, or if it will cancel itself
+ */
+bool Command::WillRunWhenDisabled() const { return m_runWhenDisabled; }
+
+std::string Command::GetName() const { return m_name; }
+
+std::string Command::GetSmartDashboardType() const { return "Command"; }
+
+void Command::InitTable(std::shared_ptr<ITable> subtable) {
+  if (m_table != nullptr) m_table->RemoveTableListener(this);
+  m_table = subtable;
+  if (m_table != nullptr) {
+    m_table->PutString(kName, GetName());
+    m_table->PutBoolean(kRunning, IsRunning());
+    m_table->PutBoolean(kIsParented, m_parent != nullptr);
+    m_table->AddTableListener(kRunning, this, false);
+  }
+}
+
+std::shared_ptr<ITable> Command::GetTable() const { return m_table; }
+
+void Command::ValueChanged(ITable* source, llvm::StringRef key,
+                           std::shared_ptr<nt::Value> value, bool isNew) {
+  if (!value->IsBoolean()) return;
+  if (value->GetBoolean()) {
+    if (!IsRunning()) Start();
+  } else {
+    if (IsRunning()) Cancel();
+  }
+}
diff --git a/wpilibc/shared/src/Commands/CommandGroup.cpp b/wpilibc/shared/src/Commands/CommandGroup.cpp
new file mode 100644
index 0000000..a19acbe
--- /dev/null
+++ b/wpilibc/shared/src/Commands/CommandGroup.cpp
@@ -0,0 +1,321 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/CommandGroup.h"
+
+#include "WPIErrors.h"
+
+using namespace frc;
+
+/**
+ * Creates a new {@link CommandGroup CommandGroup} with the given name.
+ * @param name the name for this command group
+ */
+CommandGroup::CommandGroup(const std::string& name) : Command(name) {}
+
+/**
+ * Adds a new {@link Command Command} to the group.  The {@link Command Command}
+ * will be started after all the previously added {@link Command Commands}.
+ *
+ * <p>Note that any requirements the given {@link Command Command} has will be
+ * added to the group.  For this reason, a {@link Command Command's}
+ * requirements can not be changed after being added to a group.</p>
+ *
+ * <p>It is recommended that this method be called in the constructor.</p>
+ *
+ * @param command The {@link Command Command} to be added
+ */
+void CommandGroup::AddSequential(Command* command) {
+  if (command == nullptr) {
+    wpi_setWPIErrorWithContext(NullParameter, "command");
+    return;
+  }
+  if (!AssertUnlocked("Cannot add new command to command group")) return;
+
+  command->SetParent(this);
+
+  m_commands.push_back(
+      CommandGroupEntry(command, CommandGroupEntry::kSequence_InSequence));
+  // Iterate through command->GetRequirements() and call Requires() on each
+  // required subsystem
+  Command::SubsystemSet requirements = command->GetRequirements();
+  auto iter = requirements.begin();
+  for (; iter != requirements.end(); iter++) Requires(*iter);
+}
+
+/**
+ * Adds a new {@link Command Command} to the group with a given timeout.
+ * The {@link Command Command} will be started after all the previously added
+ * commands.
+ *
+ * <p>Once the {@link Command Command} is started, it will be run until it
+ * finishes or the time expires, whichever is sooner.  Note that the given
+ * {@link Command Command} will have no knowledge that it is on a timer.</p>
+ *
+ * <p>Note that any requirements the given {@link Command Command} has will be
+ * added to the group.  For this reason, a {@link Command Command's}
+ * requirements can not be changed after being added to a group.</p>
+ *
+ * <p>It is recommended that this method be called in the constructor.</p>
+ *
+ * @param command The {@link Command Command} to be added
+ * @param timeout The timeout (in seconds)
+ */
+void CommandGroup::AddSequential(Command* command, double timeout) {
+  if (command == nullptr) {
+    wpi_setWPIErrorWithContext(NullParameter, "command");
+    return;
+  }
+  if (!AssertUnlocked("Cannot add new command to command group")) return;
+  if (timeout < 0.0) {
+    wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");
+    return;
+  }
+
+  command->SetParent(this);
+
+  m_commands.push_back(CommandGroupEntry(
+      command, CommandGroupEntry::kSequence_InSequence, timeout));
+  // Iterate through command->GetRequirements() and call Requires() on each
+  // required subsystem
+  Command::SubsystemSet requirements = command->GetRequirements();
+  auto iter = requirements.begin();
+  for (; iter != requirements.end(); iter++) Requires(*iter);
+}
+
+/**
+ * Adds a new child {@link Command} to the group.  The {@link Command} will be
+ * started after all the previously added {@link Command Commands}.
+ *
+ * <p>Instead of waiting for the child to finish, a {@link CommandGroup} will
+ * have it run at the same time as the subsequent {@link Command Commands}.
+ * The child will run until either it finishes, a new child with conflicting
+ * requirements is started, or the main sequence runs a {@link Command} with
+ * conflicting requirements.  In the latter two cases, the child will be
+ * canceled even if it says it can't be interrupted.</p>
+ *
+ * <p>Note that any requirements the given {@link Command Command} has will be
+ * added to the group.  For this reason, a {@link Command Command's}
+ * requirements can not be changed after being added to a group.</p>
+ *
+ * <p>It is recommended that this method be called in the constructor.</p>
+ *
+ * @param command The command to be added
+ */
+void CommandGroup::AddParallel(Command* command) {
+  if (command == nullptr) {
+    wpi_setWPIErrorWithContext(NullParameter, "command");
+    return;
+  }
+  if (!AssertUnlocked("Cannot add new command to command group")) return;
+
+  command->SetParent(this);
+
+  m_commands.push_back(
+      CommandGroupEntry(command, CommandGroupEntry::kSequence_BranchChild));
+  // Iterate through command->GetRequirements() and call Requires() on each
+  // required subsystem
+  Command::SubsystemSet requirements = command->GetRequirements();
+  auto iter = requirements.begin();
+  for (; iter != requirements.end(); iter++) Requires(*iter);
+}
+
+/**
+ * Adds a new child {@link Command} to the group with the given timeout.  The
+ * {@link Command} will be started after all the previously added
+ * {@link Command Commands}.
+ *
+ * <p>Once the {@link Command Command} is started, it will run until it
+ * finishes, is interrupted, or the time expires, whichever is sooner.  Note
+ * that the given {@link Command Command} will have no knowledge that it is on
+ * a timer.</p>
+ *
+ * <p>Instead of waiting for the child to finish, a {@link CommandGroup} will
+ * have it run at the same time as the subsequent {@link Command Commands}.
+ * The child will run until either it finishes, the timeout expires, a new
+ * child with conflicting requirements is started, or the main sequence runs a
+ * {@link Command} with conflicting requirements.  In the latter two cases, the
+ * child will be canceled even if it says it can't be interrupted.</p>
+ *
+ * <p>Note that any requirements the given {@link Command Command} has will be
+ * added to the group.  For this reason, a {@link Command Command's}
+ * requirements can not be changed after being added to a group.</p>
+ *
+ * <p>It is recommended that this method be called in the constructor.</p>
+ *
+ * @param command The command to be added
+ * @param timeout The timeout (in seconds)
+ */
+void CommandGroup::AddParallel(Command* command, double timeout) {
+  if (command == nullptr) {
+    wpi_setWPIErrorWithContext(NullParameter, "command");
+    return;
+  }
+  if (!AssertUnlocked("Cannot add new command to command group")) return;
+  if (timeout < 0.0) {
+    wpi_setWPIErrorWithContext(ParameterOutOfRange, "timeout < 0.0");
+    return;
+  }
+
+  command->SetParent(this);
+
+  m_commands.push_back(CommandGroupEntry(
+      command, CommandGroupEntry::kSequence_BranchChild, timeout));
+  // Iterate through command->GetRequirements() and call Requires() on each
+  // required subsystem
+  Command::SubsystemSet requirements = command->GetRequirements();
+  auto iter = requirements.begin();
+  for (; iter != requirements.end(); iter++) Requires(*iter);
+}
+
+void CommandGroup::_Initialize() { m_currentCommandIndex = -1; }
+
+void CommandGroup::_Execute() {
+  CommandGroupEntry entry;
+  Command* cmd = nullptr;
+  bool firstRun = false;
+
+  if (m_currentCommandIndex == -1) {
+    firstRun = true;
+    m_currentCommandIndex = 0;
+  }
+
+  while (static_cast<size_t>(m_currentCommandIndex) < m_commands.size()) {
+    if (cmd != nullptr) {
+      if (entry.IsTimedOut()) cmd->_Cancel();
+
+      if (cmd->Run()) {
+        break;
+      } else {
+        cmd->Removed();
+        m_currentCommandIndex++;
+        firstRun = true;
+        cmd = nullptr;
+        continue;
+      }
+    }
+
+    entry = m_commands[m_currentCommandIndex];
+    cmd = nullptr;
+
+    switch (entry.m_state) {
+      case CommandGroupEntry::kSequence_InSequence:
+        cmd = entry.m_command;
+        if (firstRun) {
+          cmd->StartRunning();
+          CancelConflicts(cmd);
+          firstRun = false;
+        }
+        break;
+
+      case CommandGroupEntry::kSequence_BranchPeer:
+        m_currentCommandIndex++;
+        entry.m_command->Start();
+        break;
+
+      case CommandGroupEntry::kSequence_BranchChild:
+        m_currentCommandIndex++;
+        CancelConflicts(entry.m_command);
+        entry.m_command->StartRunning();
+        m_children.push_back(entry);
+        break;
+    }
+  }
+
+  // Run Children
+  auto iter = m_children.begin();
+  for (; iter != m_children.end();) {
+    entry = *iter;
+    Command* child = entry.m_command;
+    if (entry.IsTimedOut()) child->_Cancel();
+
+    if (!child->Run()) {
+      child->Removed();
+      iter = m_children.erase(iter);
+    } else {
+      iter++;
+    }
+  }
+}
+
+void CommandGroup::_End() {
+  // Theoretically, we don't have to check this, but we do if teams override the
+  // IsFinished method
+  if (m_currentCommandIndex != -1 &&
+      static_cast<size_t>(m_currentCommandIndex) < m_commands.size()) {
+    Command* cmd = m_commands[m_currentCommandIndex].m_command;
+    cmd->_Cancel();
+    cmd->Removed();
+  }
+
+  auto iter = m_children.begin();
+  for (; iter != m_children.end(); iter++) {
+    Command* cmd = iter->m_command;
+    cmd->_Cancel();
+    cmd->Removed();
+  }
+  m_children.clear();
+}
+
+void CommandGroup::_Interrupted() { _End(); }
+
+// Can be overwritten by teams
+void CommandGroup::Initialize() {}
+
+// Can be overwritten by teams
+void CommandGroup::Execute() {}
+
+// Can be overwritten by teams
+void CommandGroup::End() {}
+
+// Can be overwritten by teams
+void CommandGroup::Interrupted() {}
+
+bool CommandGroup::IsFinished() {
+  return static_cast<size_t>(m_currentCommandIndex) >= m_commands.size() &&
+         m_children.empty();
+}
+
+bool CommandGroup::IsInterruptible() const {
+  if (!Command::IsInterruptible()) return false;
+
+  if (m_currentCommandIndex != -1 &&
+      static_cast<size_t>(m_currentCommandIndex) < m_commands.size()) {
+    Command* cmd = m_commands[m_currentCommandIndex].m_command;
+    if (!cmd->IsInterruptible()) return false;
+  }
+
+  auto iter = m_children.cbegin();
+  for (; iter != m_children.cend(); iter++) {
+    if (!iter->m_command->IsInterruptible()) return false;
+  }
+
+  return true;
+}
+
+void CommandGroup::CancelConflicts(Command* command) {
+  auto childIter = m_children.begin();
+  for (; childIter != m_children.end();) {
+    Command* child = childIter->m_command;
+    bool erased = false;
+
+    Command::SubsystemSet requirements = command->GetRequirements();
+    auto requirementIter = requirements.begin();
+    for (; requirementIter != requirements.end(); requirementIter++) {
+      if (child->DoesRequire(*requirementIter)) {
+        child->_Cancel();
+        child->Removed();
+        childIter = m_children.erase(childIter);
+        erased = true;
+        break;
+      }
+    }
+    if (!erased) childIter++;
+  }
+}
+
+int CommandGroup::GetSize() const { return m_children.size(); }
diff --git a/wpilibc/shared/src/Commands/CommandGroupEntry.cpp b/wpilibc/shared/src/Commands/CommandGroupEntry.cpp
new file mode 100644
index 0000000..22476bb
--- /dev/null
+++ b/wpilibc/shared/src/Commands/CommandGroupEntry.cpp
@@ -0,0 +1,23 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/CommandGroupEntry.h"
+
+#include "Commands/Command.h"
+
+using namespace frc;
+
+CommandGroupEntry::CommandGroupEntry(Command* command, Sequence state,
+                                     double timeout)
+    : m_timeout(timeout), m_command(command), m_state(state) {}
+
+bool CommandGroupEntry::IsTimedOut() const {
+  if (m_timeout < 0.0) return false;
+  double time = m_command->TimeSinceInitialized();
+  if (time == 0.0) return false;
+  return time >= m_timeout;
+}
diff --git a/wpilibc/shared/src/Commands/ConditionalCommand.cpp b/wpilibc/shared/src/Commands/ConditionalCommand.cpp
new file mode 100644
index 0000000..6d36086
--- /dev/null
+++ b/wpilibc/shared/src/Commands/ConditionalCommand.cpp
@@ -0,0 +1,84 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2017. All Rights Reserved.                             */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/ConditionalCommand.h"
+
+#include "Commands/Scheduler.h"
+
+using namespace frc;
+
+/**
+ * Creates a new ConditionalCommand with given onTrue and onFalse Commands.
+ *
+ * @param onTrue The Command to execute if {@link
+ * ConditionalCommand#Condition()} returns true
+ * @param onFalse The Command to execute if {@link
+ * ConditionalCommand#Condition()} returns false
+ */
+ConditionalCommand::ConditionalCommand(Command* onTrue, Command* onFalse) {
+  m_onTrue = onTrue;
+  m_onFalse = onFalse;
+
+  for (auto requirement : m_onTrue->GetRequirements()) Requires(requirement);
+  for (auto requirement : m_onFalse->GetRequirements()) Requires(requirement);
+}
+
+/**
+ * Creates a new ConditionalCommand with given onTrue and onFalse Commands.
+ *
+ * @param name the name for this command group
+ * @param onTrue The Command to execute if {@link
+ * ConditionalCommand#Condition()} returns true
+ * @param onFalse The Command to execute if {@link
+ * ConditionalCommand#Condition()} returns false
+ */
+ConditionalCommand::ConditionalCommand(const std::string& name, Command* onTrue,
+                                       Command* onFalse)
+    : Command(name) {
+  m_onTrue = onTrue;
+  m_onFalse = onFalse;
+
+  for (auto requirement : m_onTrue->GetRequirements()) Requires(requirement);
+  for (auto requirement : m_onFalse->GetRequirements()) Requires(requirement);
+}
+
+void ConditionalCommand::_Initialize() {
+  if (Condition()) {
+    m_chosenCommand = m_onTrue;
+  } else {
+    m_chosenCommand = m_onFalse;
+  }
+
+  /*
+   * This is a hack to make cancelling the chosen command inside a CommandGroup
+   * work properly
+   */
+  m_chosenCommand->ClearRequirements();
+
+  m_chosenCommand->Start();
+}
+
+void ConditionalCommand::_Cancel() {
+  if (m_chosenCommand != nullptr && m_chosenCommand->IsRunning()) {
+    m_chosenCommand->Cancel();
+  }
+
+  Command::_Cancel();
+}
+
+bool ConditionalCommand::IsFinished() {
+  return m_chosenCommand != nullptr && m_chosenCommand->IsRunning() &&
+         m_chosenCommand->IsFinished();
+}
+
+void ConditionalCommand::Interrupted() {
+  if (m_chosenCommand != nullptr && m_chosenCommand->IsRunning()) {
+    m_chosenCommand->Cancel();
+  }
+
+  Command::Interrupted();
+}
diff --git a/wpilibc/shared/src/Commands/InstantCommand.cpp b/wpilibc/shared/src/Commands/InstantCommand.cpp
new file mode 100644
index 0000000..ddae80c
--- /dev/null
+++ b/wpilibc/shared/src/Commands/InstantCommand.cpp
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/InstantCommand.h"
+
+using namespace frc;
+
+/**
+ * Creates a new {@link InstantCommand} with the given name.
+ * @param name the name for this command
+ */
+InstantCommand::InstantCommand(const std::string& name) : Command(name) {}
+
+bool InstantCommand::IsFinished() { return true; }
diff --git a/wpilibc/shared/src/Commands/PIDCommand.cpp b/wpilibc/shared/src/Commands/PIDCommand.cpp
new file mode 100644
index 0000000..44d96a6
--- /dev/null
+++ b/wpilibc/shared/src/Commands/PIDCommand.cpp
@@ -0,0 +1,75 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/PIDCommand.h"
+
+#include <cfloat>
+
+using namespace frc;
+
+PIDCommand::PIDCommand(const std::string& name, double p, double i, double d,
+                       double f, double period)
+    : Command(name) {
+  m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
+}
+
+PIDCommand::PIDCommand(double p, double i, double d, double f, double period) {
+  m_controller =
+      std::make_shared<PIDController>(p, i, d, f, this, this, period);
+}
+
+PIDCommand::PIDCommand(const std::string& name, double p, double i, double d)
+    : Command(name) {
+  m_controller = std::make_shared<PIDController>(p, i, d, this, this);
+}
+
+PIDCommand::PIDCommand(const std::string& name, double p, double i, double d,
+                       double period)
+    : Command(name) {
+  m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
+}
+
+PIDCommand::PIDCommand(double p, double i, double d) {
+  m_controller = std::make_shared<PIDController>(p, i, d, this, this);
+}
+
+PIDCommand::PIDCommand(double p, double i, double d, double period) {
+  m_controller = std::make_shared<PIDController>(p, i, d, this, this, period);
+}
+
+void PIDCommand::_Initialize() { m_controller->Enable(); }
+
+void PIDCommand::_End() { m_controller->Disable(); }
+
+void PIDCommand::_Interrupted() { _End(); }
+
+void PIDCommand::SetSetpointRelative(double deltaSetpoint) {
+  SetSetpoint(GetSetpoint() + deltaSetpoint);
+}
+
+void PIDCommand::PIDWrite(double output) { UsePIDOutput(output); }
+
+double PIDCommand::PIDGet() { return ReturnPIDInput(); }
+
+std::shared_ptr<PIDController> PIDCommand::GetPIDController() const {
+  return m_controller;
+}
+
+void PIDCommand::SetSetpoint(double setpoint) {
+  m_controller->SetSetpoint(setpoint);
+}
+
+double PIDCommand::GetSetpoint() const { return m_controller->GetSetpoint(); }
+
+double PIDCommand::GetPosition() { return ReturnPIDInput(); }
+
+std::string PIDCommand::GetSmartDashboardType() const { return "PIDCommand"; }
+
+void PIDCommand::InitTable(std::shared_ptr<ITable> subtable) {
+  m_controller->InitTable(subtable);
+  Command::InitTable(subtable);
+}
diff --git a/wpilibc/shared/src/Commands/PIDSubsystem.cpp b/wpilibc/shared/src/Commands/PIDSubsystem.cpp
new file mode 100644
index 0000000..89146e6
--- /dev/null
+++ b/wpilibc/shared/src/Commands/PIDSubsystem.cpp
@@ -0,0 +1,248 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/PIDSubsystem.h"
+
+#include "PIDController.h"
+
+using namespace frc;
+
+/**
+ * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
+ * values.
+ *
+ * @param name the name
+ * @param p    the proportional value
+ * @param i    the integral value
+ * @param d    the derivative value
+ */
+PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
+                           double d)
+    : Subsystem(name) {
+  m_controller = std::make_shared<PIDController>(p, i, d, this, this);
+}
+
+/**
+ * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
+ * values.
+ *
+ * @param name the name
+ * @param p    the proportional value
+ * @param i    the integral value
+ * @param d    the derivative value
+ * @param f    the feedforward value
+ */
+PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
+                           double d, double f)
+    : Subsystem(name) {
+  m_controller = std::make_shared<PIDController>(p, i, d, f, this, this);
+}
+
+/**
+ * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
+ * values.
+ *
+ * It will also space the time between PID loop calculations to be equal to the
+ * given period.
+ *
+ * @param name   the name
+ * @param p      the proportional value
+ * @param i      the integral value
+ * @param d      the derivative value
+ * @param f      the feedfoward value
+ * @param period the time (in seconds) between calculations
+ */
+PIDSubsystem::PIDSubsystem(const std::string& name, double p, double i,
+                           double d, double f, double period)
+    : Subsystem(name) {
+  m_controller =
+      std::make_shared<PIDController>(p, i, d, f, this, this, period);
+}
+
+/**
+ * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
+ * values.
+ *
+ * It will use the class name as its name.
+ *
+ * @param p the proportional value
+ * @param i the integral value
+ * @param d the derivative value
+ */
+PIDSubsystem::PIDSubsystem(double p, double i, double d)
+    : Subsystem("PIDSubsystem") {
+  m_controller = std::make_shared<PIDController>(p, i, d, this, this);
+}
+
+/**
+ * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
+ * values.
+ *
+ * It will use the class name as its name.
+ *
+ * @param p the proportional value
+ * @param i the integral value
+ * @param d the derivative value
+ * @param f the feedforward value
+ */
+PIDSubsystem::PIDSubsystem(double p, double i, double d, double f)
+    : Subsystem("PIDSubsystem") {
+  m_controller = std::make_shared<PIDController>(p, i, d, f, this, this);
+}
+
+/**
+ * Instantiates a {@link PIDSubsystem} that will use the given p, i and d
+ * values.
+ *
+ * It will use the class name as its name. It will also space the time
+ * between PID loop calculations to be equal to the given period.
+ *
+ * @param p      the proportional value
+ * @param i      the integral value
+ * @param d      the derivative value
+ * @param f      the feedforward value
+ * @param period the time (in seconds) between calculations
+ */
+PIDSubsystem::PIDSubsystem(double p, double i, double d, double f,
+                           double period)
+    : Subsystem("PIDSubsystem") {
+  m_controller =
+      std::make_shared<PIDController>(p, i, d, f, this, this, period);
+}
+
+/**
+ * Enables the internal {@link PIDController}.
+ */
+void PIDSubsystem::Enable() { m_controller->Enable(); }
+
+/**
+  * Disables the internal {@link PIDController}.
+  */
+void PIDSubsystem::Disable() { m_controller->Disable(); }
+
+/**
+ * Returns the {@link PIDController} used by this {@link PIDSubsystem}.
+ *
+ * Use this if you would like to fine tune the pid loop.
+ *
+ * @return the {@link PIDController} used by this {@link PIDSubsystem}
+ */
+std::shared_ptr<PIDController> PIDSubsystem::GetPIDController() {
+  return m_controller;
+}
+
+/**
+ * Sets the setpoint to the given value.
+ *
+ * If {@link PIDCommand#SetRange(double, double) SetRange(...)} was called,
+ * then the given setpoint will be trimmed to fit within the range.
+ *
+ * @param setpoint the new setpoint
+ */
+void PIDSubsystem::SetSetpoint(double setpoint) {
+  m_controller->SetSetpoint(setpoint);
+}
+
+/**
+ * Adds the given value to the setpoint.
+ *
+ * If {@link PIDCommand#SetRange(double, double) SetRange(...)} was used,
+ * then the bounds will still be honored by this method.
+ *
+ * @param deltaSetpoint the change in the setpoint
+ */
+void PIDSubsystem::SetSetpointRelative(double deltaSetpoint) {
+  SetSetpoint(GetSetpoint() + deltaSetpoint);
+}
+
+/**
+ * Return the current setpoint.
+ *
+ * @return The current setpoint
+ */
+double PIDSubsystem::GetSetpoint() { return m_controller->GetSetpoint(); }
+
+/**
+ * Sets the maximum and minimum values expected from the input.
+ *
+ * @param minimumInput the minimum value expected from the input
+ * @param maximumInput the maximum value expected from the output
+ */
+void PIDSubsystem::SetInputRange(double minimumInput, double maximumInput) {
+  m_controller->SetInputRange(minimumInput, maximumInput);
+}
+
+/**
+ * Sets the maximum and minimum values to write.
+ *
+ * @param minimumOutput the minimum value to write to the output
+ * @param maximumOutput the maximum value to write to the output
+ */
+void PIDSubsystem::SetOutputRange(double minimumOutput, double maximumOutput) {
+  m_controller->SetOutputRange(minimumOutput, maximumOutput);
+}
+
+/**
+ * Set the absolute error which is considered tolerable for use with
+ * OnTarget.
+ *
+ * @param absValue absolute error which is tolerable
+ */
+void PIDSubsystem::SetAbsoluteTolerance(double absValue) {
+  m_controller->SetAbsoluteTolerance(absValue);
+}
+
+/**
+ * Set the percentage error which is considered tolerable for use with OnTarget.
+ *
+ * @param percent percentage error which is tolerable
+ */
+void PIDSubsystem::SetPercentTolerance(double percent) {
+  m_controller->SetPercentTolerance(percent);
+}
+
+/**
+ * Return true if the error is within the percentage of the total input range,
+ * determined by SetTolerance.
+ *
+ * This asssumes that the maximum and minimum input were set using SetInput.
+ * Use OnTarget() in the IsFinished() method of commands that use this
+ * subsystem.
+ *
+ * Currently this just reports on target as the actual value passes through the
+ * setpoint. Ideally it should be based on being within the tolerance for some
+ * period of time.
+ *
+ * @return true if the error is within the percentage tolerance of the input
+ *         range
+ */
+bool PIDSubsystem::OnTarget() const { return m_controller->OnTarget(); }
+
+/**
+ * Returns the current position.
+ *
+ * @return the current position
+ */
+double PIDSubsystem::GetPosition() { return ReturnPIDInput(); }
+
+/**
+ * Returns the current rate.
+ *
+ * @return the current rate
+ */
+double PIDSubsystem::GetRate() { return ReturnPIDInput(); }
+
+void PIDSubsystem::PIDWrite(double output) { UsePIDOutput(output); }
+
+double PIDSubsystem::PIDGet() { return ReturnPIDInput(); }
+
+std::string PIDSubsystem::GetSmartDashboardType() const { return "PIDCommand"; }
+
+void PIDSubsystem::InitTable(std::shared_ptr<ITable> subtable) {
+  m_controller->InitTable(subtable);
+  Subsystem::InitTable(subtable);
+}
diff --git a/wpilibc/shared/src/Commands/PrintCommand.cpp b/wpilibc/shared/src/Commands/PrintCommand.cpp
new file mode 100644
index 0000000..afdcad5
--- /dev/null
+++ b/wpilibc/shared/src/Commands/PrintCommand.cpp
@@ -0,0 +1,19 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/PrintCommand.h"
+
+#include <iostream>
+
+using namespace frc;
+
+PrintCommand::PrintCommand(const std::string& message)
+    : InstantCommand("Print \"" + message + "\"") {
+  m_message = message;
+}
+
+void PrintCommand::Initialize() { std::cout << m_message << "\n"; }
diff --git a/wpilibc/shared/src/Commands/Scheduler.cpp b/wpilibc/shared/src/Commands/Scheduler.cpp
new file mode 100644
index 0000000..aa325b4
--- /dev/null
+++ b/wpilibc/shared/src/Commands/Scheduler.cpp
@@ -0,0 +1,279 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/Scheduler.h"
+
+#include <algorithm>
+#include <iostream>
+#include <set>
+
+#include "Buttons/ButtonScheduler.h"
+#include "Commands/Subsystem.h"
+#include "HLUsageReporting.h"
+#include "WPIErrors.h"
+
+using namespace frc;
+
+Scheduler::Scheduler() { HLUsageReporting::ReportScheduler(); }
+
+/**
+ * Returns the {@link Scheduler}, creating it if one does not exist.
+ *
+ * @return the {@link Scheduler}
+ */
+Scheduler* Scheduler::GetInstance() {
+  static Scheduler instance;
+  return &instance;
+}
+
+void Scheduler::SetEnabled(bool enabled) { m_enabled = enabled; }
+
+/**
+ * Add a command to be scheduled later.
+ *
+ * In any pass through the scheduler, all commands are added to the additions
+ * list, then at the end of the pass, they are all scheduled.
+ *
+ * @param command The command to be scheduled
+ */
+void Scheduler::AddCommand(Command* command) {
+  std::lock_guard<priority_mutex> sync(m_additionsLock);
+  if (std::find(m_additions.begin(), m_additions.end(), command) !=
+      m_additions.end())
+    return;
+  m_additions.push_back(command);
+}
+
+void Scheduler::AddButton(ButtonScheduler* button) {
+  std::lock_guard<priority_mutex> sync(m_buttonsLock);
+  m_buttons.push_back(button);
+}
+
+void Scheduler::ProcessCommandAddition(Command* command) {
+  if (command == nullptr) return;
+
+  // Check to make sure no adding during adding
+  if (m_adding) {
+    wpi_setWPIErrorWithContext(IncompatibleState,
+                               "Can not start command from cancel method");
+    return;
+  }
+
+  // Only add if not already in
+  auto found = m_commands.find(command);
+  if (found == m_commands.end()) {
+    // Check that the requirements can be had
+    Command::SubsystemSet requirements = command->GetRequirements();
+    Command::SubsystemSet::iterator iter;
+    for (iter = requirements.begin(); iter != requirements.end(); iter++) {
+      Subsystem* lock = *iter;
+      if (lock->GetCurrentCommand() != nullptr &&
+          !lock->GetCurrentCommand()->IsInterruptible())
+        return;
+    }
+
+    // Give it the requirements
+    m_adding = true;
+    for (iter = requirements.begin(); iter != requirements.end(); iter++) {
+      Subsystem* lock = *iter;
+      if (lock->GetCurrentCommand() != nullptr) {
+        lock->GetCurrentCommand()->Cancel();
+        Remove(lock->GetCurrentCommand());
+      }
+      lock->SetCurrentCommand(command);
+    }
+    m_adding = false;
+
+    m_commands.insert(command);
+
+    command->StartRunning();
+    m_runningCommandsChanged = true;
+  }
+}
+
+/**
+ * Runs a single iteration of the loop.
+ *
+ * This method should be called often in order to have a functioning
+ * {@link Command} system.  The loop has five stages:
+ *
+ * <ol>
+ * <li> Poll the Buttons </li>
+ * <li> Execute/Remove the Commands </li>
+ * <li> Send values to SmartDashboard </li>
+ * <li> Add Commands </li>
+ * <li> Add Defaults </li>
+ * </ol>
+ */
+void Scheduler::Run() {
+  // Get button input (going backwards preserves button priority)
+  {
+    if (!m_enabled) return;
+
+    std::lock_guard<priority_mutex> sync(m_buttonsLock);
+    auto rButtonIter = m_buttons.rbegin();
+    for (; rButtonIter != m_buttons.rend(); rButtonIter++) {
+      (*rButtonIter)->Execute();
+    }
+  }
+
+  m_runningCommandsChanged = false;
+
+  // Loop through the commands
+  auto commandIter = m_commands.begin();
+  for (; commandIter != m_commands.end();) {
+    Command* command = *commandIter;
+    // Increment before potentially removing to keep the iterator valid
+    commandIter++;
+    if (!command->Run()) {
+      Remove(command);
+      m_runningCommandsChanged = true;
+    }
+  }
+
+  // Add the new things
+  {
+    std::lock_guard<priority_mutex> sync(m_additionsLock);
+    auto additionsIter = m_additions.begin();
+    for (; additionsIter != m_additions.end(); additionsIter++) {
+      ProcessCommandAddition(*additionsIter);
+    }
+    m_additions.clear();
+  }
+
+  // Add in the defaults
+  auto subsystemIter = m_subsystems.begin();
+  for (; subsystemIter != m_subsystems.end(); subsystemIter++) {
+    Subsystem* lock = *subsystemIter;
+    if (lock->GetCurrentCommand() == nullptr) {
+      ProcessCommandAddition(lock->GetDefaultCommand());
+    }
+    lock->ConfirmCommand();
+  }
+
+  UpdateTable();
+}
+
+/**
+ * Registers a {@link Subsystem} to this {@link Scheduler}, so that the {@link
+ * Scheduler} might know if a default {@link Command} needs to be run.
+ *
+ * All {@link Subsystem Subsystems} should call this.
+ *
+ * @param system the system
+ */
+void Scheduler::RegisterSubsystem(Subsystem* subsystem) {
+  if (subsystem == nullptr) {
+    wpi_setWPIErrorWithContext(NullParameter, "subsystem");
+    return;
+  }
+  m_subsystems.insert(subsystem);
+}
+
+/**
+ * Removes the {@link Command} from the {@link Scheduler}.
+ *
+ * @param command the command to remove
+ */
+void Scheduler::Remove(Command* command) {
+  if (command == nullptr) {
+    wpi_setWPIErrorWithContext(NullParameter, "command");
+    return;
+  }
+
+  if (!m_commands.erase(command)) return;
+
+  Command::SubsystemSet requirements = command->GetRequirements();
+  auto iter = requirements.begin();
+  for (; iter != requirements.end(); iter++) {
+    Subsystem* lock = *iter;
+    lock->SetCurrentCommand(nullptr);
+  }
+
+  command->Removed();
+}
+
+void Scheduler::RemoveAll() {
+  while (m_commands.size() > 0) {
+    Remove(*m_commands.begin());
+  }
+}
+
+/**
+ * Completely resets the scheduler. Undefined behavior if running.
+ */
+void Scheduler::ResetAll() {
+  RemoveAll();
+  m_subsystems.clear();
+  m_buttons.clear();
+  m_additions.clear();
+  m_commands.clear();
+  m_table = nullptr;
+}
+
+/**
+ * Update the network tables associated with the Scheduler object on the
+ * SmartDashboard.
+ */
+void Scheduler::UpdateTable() {
+  CommandSet::iterator commandIter;
+  if (m_table != nullptr) {
+    // Get the list of possible commands to cancel
+    auto new_toCancel = m_table->GetValue("Cancel");
+    if (new_toCancel)
+      toCancel = new_toCancel->GetDoubleArray();
+    else
+      toCancel.resize(0);
+    // m_table->RetrieveValue("Ids", *ids);
+
+    // cancel commands that have had the cancel buttons pressed
+    // on the SmartDashboad
+    if (!toCancel.empty()) {
+      for (commandIter = m_commands.begin(); commandIter != m_commands.end();
+           ++commandIter) {
+        for (size_t i = 0; i < toCancel.size(); i++) {
+          Command* c = *commandIter;
+          if (c->GetID() == toCancel[i]) {
+            c->Cancel();
+          }
+        }
+      }
+      toCancel.resize(0);
+      m_table->PutValue("Cancel", nt::Value::MakeDoubleArray(toCancel));
+    }
+
+    // Set the running commands
+    if (m_runningCommandsChanged) {
+      commands.resize(0);
+      ids.resize(0);
+      for (commandIter = m_commands.begin(); commandIter != m_commands.end();
+           ++commandIter) {
+        Command* c = *commandIter;
+        commands.push_back(c->GetName());
+        ids.push_back(c->GetID());
+      }
+      m_table->PutValue("Names", nt::Value::MakeStringArray(commands));
+      m_table->PutValue("Ids", nt::Value::MakeDoubleArray(ids));
+    }
+  }
+}
+
+std::string Scheduler::GetName() const { return "Scheduler"; }
+
+std::string Scheduler::GetType() const { return "Scheduler"; }
+
+std::string Scheduler::GetSmartDashboardType() const { return "Scheduler"; }
+
+void Scheduler::InitTable(std::shared_ptr<ITable> subTable) {
+  m_table = subTable;
+
+  m_table->PutValue("Names", nt::Value::MakeStringArray(commands));
+  m_table->PutValue("Ids", nt::Value::MakeDoubleArray(ids));
+  m_table->PutValue("Cancel", nt::Value::MakeDoubleArray(toCancel));
+}
+
+std::shared_ptr<ITable> Scheduler::GetTable() const { return m_table; }
diff --git a/wpilibc/shared/src/Commands/StartCommand.cpp b/wpilibc/shared/src/Commands/StartCommand.cpp
new file mode 100644
index 0000000..8b66c40
--- /dev/null
+++ b/wpilibc/shared/src/Commands/StartCommand.cpp
@@ -0,0 +1,17 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/StartCommand.h"
+
+using namespace frc;
+
+StartCommand::StartCommand(Command* commandToStart)
+    : InstantCommand("StartCommand") {
+  m_commandToFork = commandToStart;
+}
+
+void StartCommand::Initialize() { m_commandToFork->Start(); }
diff --git a/wpilibc/shared/src/Commands/Subsystem.cpp b/wpilibc/shared/src/Commands/Subsystem.cpp
new file mode 100644
index 0000000..404d74f
--- /dev/null
+++ b/wpilibc/shared/src/Commands/Subsystem.cpp
@@ -0,0 +1,152 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/Subsystem.h"
+
+#include "Commands/Command.h"
+#include "Commands/Scheduler.h"
+#include "WPIErrors.h"
+
+using namespace frc;
+
+/**
+ * Creates a subsystem with the given name.
+ *
+ * @param name the name of the subsystem
+ */
+Subsystem::Subsystem(const std::string& name) {
+  m_name = name;
+  Scheduler::GetInstance()->RegisterSubsystem(this);
+}
+/**
+ * Initialize the default command for this subsystem.
+ *
+ * This is meant to be the place to call SetDefaultCommand in a subsystem and
+ * will be called on all the subsystems by the CommandBase method before the
+ * program starts running by using the list of all registered Subsystems inside
+ * the Scheduler.
+ *
+ * This should be overridden by a Subsystem that has a default Command
+ */
+void Subsystem::InitDefaultCommand() {}
+
+/**
+ * Sets the default command.  If this is not called or is called with null,
+ * then there will be no default command for the subsystem.
+ *
+ * <p><b>WARNING:</b> This should <b>NOT</b> be called in a constructor if the
+ * subsystem is a singleton.</p>
+ *
+ * @param command the default command (or null if there should be none)
+ */
+void Subsystem::SetDefaultCommand(Command* command) {
+  if (command == nullptr) {
+    m_defaultCommand = nullptr;
+  } else {
+    bool found = false;
+    Command::SubsystemSet requirements = command->GetRequirements();
+    auto iter = requirements.begin();
+    for (; iter != requirements.end(); iter++) {
+      if (*iter == this) {
+        found = true;
+        break;
+      }
+    }
+
+    if (!found) {
+      wpi_setWPIErrorWithContext(
+          CommandIllegalUse, "A default command must require the subsystem");
+      return;
+    }
+
+    m_defaultCommand = command;
+  }
+  if (m_table != nullptr) {
+    if (m_defaultCommand != nullptr) {
+      m_table->PutBoolean("hasDefault", true);
+      m_table->PutString("default", m_defaultCommand->GetName());
+    } else {
+      m_table->PutBoolean("hasDefault", false);
+    }
+  }
+}
+
+/**
+ * Returns the default command (or null if there is none).
+ *
+ * @return the default command
+ */
+Command* Subsystem::GetDefaultCommand() {
+  if (!m_initializedDefaultCommand) {
+    m_initializedDefaultCommand = true;
+    InitDefaultCommand();
+  }
+  return m_defaultCommand;
+}
+
+/**
+ * Sets the current command.
+ *
+ * @param command the new current command
+ */
+void Subsystem::SetCurrentCommand(Command* command) {
+  m_currentCommand = command;
+  m_currentCommandChanged = true;
+}
+
+/**
+ * Returns the command which currently claims this subsystem.
+ *
+ * @return the command which currently claims this subsystem
+ */
+Command* Subsystem::GetCurrentCommand() const { return m_currentCommand; }
+
+/**
+ * Call this to alert Subsystem that the current command is actually the
+ * command.
+ *
+ * Sometimes, the {@link Subsystem} is told that it has no command while the
+ * {@link Scheduler} is going through the loop, only to be soon after given a
+ * new one.  This will avoid that situation.
+ */
+void Subsystem::ConfirmCommand() {
+  if (m_currentCommandChanged) {
+    if (m_table != nullptr) {
+      if (m_currentCommand != nullptr) {
+        m_table->PutBoolean("hasCommand", true);
+        m_table->PutString("command", m_currentCommand->GetName());
+      } else {
+        m_table->PutBoolean("hasCommand", false);
+      }
+    }
+    m_currentCommandChanged = false;
+  }
+}
+
+std::string Subsystem::GetName() const { return m_name; }
+
+std::string Subsystem::GetSmartDashboardType() const { return "Subsystem"; }
+
+void Subsystem::InitTable(std::shared_ptr<ITable> subtable) {
+  m_table = subtable;
+  if (m_table != nullptr) {
+    if (m_defaultCommand != nullptr) {
+      m_table->PutBoolean("hasDefault", true);
+      m_table->PutString("default", m_defaultCommand->GetName());
+    } else {
+      m_table->PutBoolean("hasDefault", false);
+    }
+    if (m_currentCommand != nullptr) {
+      m_table->PutBoolean("hasCommand", true);
+      m_table->PutString("command", m_currentCommand->GetName());
+    } else {
+      m_table->PutBoolean("hasCommand", false);
+    }
+  }
+}
+
+std::shared_ptr<ITable> Subsystem::GetTable() const { return m_table; }
diff --git a/wpilibc/shared/src/Commands/TimedCommand.cpp b/wpilibc/shared/src/Commands/TimedCommand.cpp
new file mode 100644
index 0000000..d910749
--- /dev/null
+++ b/wpilibc/shared/src/Commands/TimedCommand.cpp
@@ -0,0 +1,17 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/TimedCommand.h"
+
+using namespace frc;
+
+TimedCommand::TimedCommand(const std::string& name, double timeout)
+    : Command(name, timeout) {}
+
+TimedCommand::TimedCommand(double timeout) : Command(timeout) {}
+
+bool TimedCommand::IsFinished() { return IsTimedOut(); }
diff --git a/wpilibc/shared/src/Commands/WaitCommand.cpp b/wpilibc/shared/src/Commands/WaitCommand.cpp
new file mode 100644
index 0000000..8bda85b
--- /dev/null
+++ b/wpilibc/shared/src/Commands/WaitCommand.cpp
@@ -0,0 +1,16 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/WaitCommand.h"
+
+using namespace frc;
+
+WaitCommand::WaitCommand(double timeout)
+    : TimedCommand("Wait(" + std::to_string(timeout) + ")", timeout) {}
+
+WaitCommand::WaitCommand(const std::string& name, double timeout)
+    : TimedCommand(name, timeout) {}
diff --git a/wpilibc/shared/src/Commands/WaitForChildren.cpp b/wpilibc/shared/src/Commands/WaitForChildren.cpp
new file mode 100644
index 0000000..e796299
--- /dev/null
+++ b/wpilibc/shared/src/Commands/WaitForChildren.cpp
@@ -0,0 +1,22 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/WaitForChildren.h"
+
+#include "Commands/CommandGroup.h"
+
+using namespace frc;
+
+WaitForChildren::WaitForChildren(double timeout)
+    : Command("WaitForChildren", timeout) {}
+
+WaitForChildren::WaitForChildren(const std::string& name, double timeout)
+    : Command(name, timeout) {}
+
+bool WaitForChildren::IsFinished() {
+  return GetGroup() == nullptr || GetGroup()->GetSize() == 0;
+}
diff --git a/wpilibc/shared/src/Commands/WaitUntilCommand.cpp b/wpilibc/shared/src/Commands/WaitUntilCommand.cpp
new file mode 100644
index 0000000..b9bffb4
--- /dev/null
+++ b/wpilibc/shared/src/Commands/WaitUntilCommand.cpp
@@ -0,0 +1,34 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Commands/WaitUntilCommand.h"
+
+#include "Timer.h"
+
+using namespace frc;
+
+/**
+ * A {@link WaitCommand} will wait until a certain match time before finishing.
+ *
+ * This will wait until the game clock reaches some value, then continue to the
+ * next command.
+ * @see CommandGroup
+ */
+WaitUntilCommand::WaitUntilCommand(double time)
+    : Command("WaitUntilCommand", time) {
+  m_time = time;
+}
+
+WaitUntilCommand::WaitUntilCommand(const std::string& name, double time)
+    : Command(name, time) {
+  m_time = time;
+}
+
+/**
+ * Check if we've reached the actual finish time.
+ */
+bool WaitUntilCommand::IsFinished() { return Timer::GetMatchTime() >= m_time; }
diff --git a/wpilibc/shared/src/Error.cpp b/wpilibc/shared/src/Error.cpp
new file mode 100644
index 0000000..b853b50
--- /dev/null
+++ b/wpilibc/shared/src/Error.cpp
@@ -0,0 +1,93 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Error.h"
+
+#include <sstream>
+
+#include "DriverStation.h"
+#include "Timer.h"
+#include "Utility.h"
+
+using namespace frc;
+
+void Error::Clone(const Error& error) {
+  m_code = error.m_code;
+  m_message = error.m_message;
+  m_filename = error.m_filename;
+  m_function = error.m_function;
+  m_lineNumber = error.m_lineNumber;
+  m_originatingObject = error.m_originatingObject;
+  m_timestamp = error.m_timestamp;
+}
+
+Error::Code Error::GetCode() const { return m_code; }
+
+std::string Error::GetMessage() const { return m_message; }
+
+std::string Error::GetFilename() const { return m_filename; }
+
+std::string Error::GetFunction() const { return m_function; }
+
+int Error::GetLineNumber() const { return m_lineNumber; }
+
+const ErrorBase* Error::GetOriginatingObject() const {
+  return m_originatingObject;
+}
+
+double Error::GetTimestamp() const { return m_timestamp; }
+
+void Error::Set(Code code, llvm::StringRef contextMessage,
+                llvm::StringRef filename, llvm::StringRef function,
+                int lineNumber, const ErrorBase* originatingObject) {
+  bool report = true;
+
+  if (code == m_code && GetTime() - m_timestamp < 1) {
+    report = false;
+  }
+
+  m_code = code;
+  m_message = contextMessage;
+  m_filename = filename;
+  m_function = function;
+  m_lineNumber = lineNumber;
+  m_originatingObject = originatingObject;
+
+  if (report) {
+    m_timestamp = GetTime();
+    Report();
+  }
+}
+
+void Error::Report() {
+  std::stringstream locStream;
+  locStream << m_function << " [";
+
+#if defined(_WIN32)
+  const int MAX_DIR = 100;
+  char basename[MAX_DIR];
+  _splitpath_s(m_filename.c_str(), nullptr, 0, basename, MAX_DIR, nullptr, 0,
+               nullptr, 0);
+  locStream << basename;
+#else
+  locStream << basename(m_filename.c_str());
+#endif
+  locStream << ":" << m_lineNumber << "]";
+
+  DriverStation::ReportError(true, m_code, m_message, locStream.str(),
+                             GetStackTrace(4));
+}
+
+void Error::Clear() {
+  m_code = 0;
+  m_message = "";
+  m_filename = "";
+  m_function = "";
+  m_lineNumber = 0;
+  m_originatingObject = nullptr;
+  m_timestamp = 0.0;
+}
diff --git a/wpilibc/shared/src/ErrorBase.cpp b/wpilibc/shared/src/ErrorBase.cpp
new file mode 100644
index 0000000..3323fe2
--- /dev/null
+++ b/wpilibc/shared/src/ErrorBase.cpp
@@ -0,0 +1,231 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "ErrorBase.h"
+
+#include <cerrno>
+#include <cstdio>
+#include <cstring>
+#include <iomanip>
+#include <sstream>
+
+#define WPI_ERRORS_DEFINE_STRINGS
+#include "WPIErrors.h"
+
+using namespace frc;
+
+priority_mutex ErrorBase::_globalErrorMutex;
+Error ErrorBase::_globalError;
+
+/**
+ * @brief Retrieve the current error.
+ * Get the current error information associated with this sensor.
+ */
+Error& ErrorBase::GetError() { return m_error; }
+
+const Error& ErrorBase::GetError() const { return m_error; }
+
+/**
+ * @brief Clear the current error information associated with this sensor.
+ */
+void ErrorBase::ClearError() const { m_error.Clear(); }
+
+/**
+ * @brief Set error information associated with a C library call that set an
+ * error to the "errno" global variable.
+ *
+ * @param contextMessage A custom message from the code that set the error.
+ * @param filename       Filename of the error source
+ * @param function       Function of the error source
+ * @param lineNumber     Line number of the error source
+ */
+void ErrorBase::SetErrnoError(llvm::StringRef contextMessage,
+                              llvm::StringRef filename,
+                              llvm::StringRef function, int lineNumber) const {
+  std::string err;
+  int errNo = errno;
+  if (errNo == 0) {
+    err = "OK: ";
+    err += contextMessage;
+  } else {
+    std::ostringstream oss;
+    oss << std::strerror(errNo) << " (0x" << std::setfill('0') << std::hex
+        << std::uppercase << std::setw(8) << errNo << "): " << contextMessage;
+    err = oss.str();
+  }
+
+  // Set the current error information for this object.
+  m_error.Set(-1, err, filename, function, lineNumber, this);
+
+  // Update the global error if there is not one already set.
+  std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
+  if (_globalError.GetCode() == 0) {
+    _globalError.Clone(m_error);
+  }
+}
+
+/**
+ * @brief Set the current error information associated from the nivision Imaq
+ * API.
+ *
+ * @param success        The return from the function
+ * @param contextMessage A custom message from the code that set the error.
+ * @param filename       Filename of the error source
+ * @param function       Function of the error source
+ * @param lineNumber     Line number of the error source
+ */
+void ErrorBase::SetImaqError(int success, llvm::StringRef contextMessage,
+                             llvm::StringRef filename, llvm::StringRef function,
+                             int lineNumber) const {
+  // If there was an error
+  if (success <= 0) {
+    std::stringstream err;
+    err << success << ": " << contextMessage;
+
+    // Set the current error information for this object.
+    m_error.Set(success, err.str(), filename, function, lineNumber, this);
+
+    // Update the global error if there is not one already set.
+    std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
+    if (_globalError.GetCode() == 0) {
+      _globalError.Clone(m_error);
+    }
+  }
+}
+
+/**
+ * @brief Set the current error information associated with this sensor.
+ *
+ * @param code           The error code
+ * @param contextMessage A custom message from the code that set the error.
+ * @param filename       Filename of the error source
+ * @param function       Function of the error source
+ * @param lineNumber     Line number of the error source
+ */
+void ErrorBase::SetError(Error::Code code, llvm::StringRef contextMessage,
+                         llvm::StringRef filename, llvm::StringRef function,
+                         int lineNumber) const {
+  //  If there was an error
+  if (code != 0) {
+    //  Set the current error information for this object.
+    m_error.Set(code, contextMessage, filename, function, lineNumber, this);
+
+    // Update the global error if there is not one already set.
+    std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
+    if (_globalError.GetCode() == 0) {
+      _globalError.Clone(m_error);
+    }
+  }
+}
+
+/**
+ * @brief Set the current error information associated with this sensor.
+ * Range versions use for initialization code.
+ *
+ * @param code           The error code
+ * @param minRange       The minimum allowed allocation range
+ * @param maxRange       The maximum allowed allocation range
+ * @param requestedValue The requested value to allocate
+ * @param contextMessage A custom message from the code that set the error.
+ * @param filename       Filename of the error source
+ * @param function       Function of the error source
+ * @param lineNumber     Line number of the error source
+ */
+void ErrorBase::SetErrorRange(Error::Code code, int32_t minRange,
+                              int32_t maxRange, int32_t requestedValue,
+                              llvm::StringRef contextMessage,
+                              llvm::StringRef filename,
+                              llvm::StringRef function, int lineNumber) const {
+  //  If there was an error
+  if (code != 0) {
+    size_t size = contextMessage.size() + 100;
+    char* buf = new char[size];
+    std::snprintf(
+        buf, size,
+        "%s, Minimum Value: %d, Maximum Value: %d, Requested Value: %d",
+        contextMessage.data(), minRange, maxRange, requestedValue);
+    //  Set the current error information for this object.
+    m_error.Set(code, buf, filename, function, lineNumber, this);
+    delete[] buf;
+
+    // Update the global error if there is not one already set.
+    std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
+    if (_globalError.GetCode() == 0) {
+      _globalError.Clone(m_error);
+    }
+  }
+}
+
+/**
+ * @brief Set the current error information associated with this sensor.
+ *
+ * @param errorMessage   The error message from WPIErrors.h
+ * @param contextMessage A custom message from the code that set the error.
+ * @param filename       Filename of the error source
+ * @param function       Function of the error source
+ * @param lineNumber     Line number of the error source
+ */
+void ErrorBase::SetWPIError(llvm::StringRef errorMessage, Error::Code code,
+                            llvm::StringRef contextMessage,
+                            llvm::StringRef filename, llvm::StringRef function,
+                            int lineNumber) const {
+  std::string err = errorMessage.str() + ": " + contextMessage.str();
+
+  //  Set the current error information for this object.
+  m_error.Set(code, err, filename, function, lineNumber, this);
+
+  // Update the global error if there is not one already set.
+  std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
+  if (_globalError.GetCode() == 0) {
+    _globalError.Clone(m_error);
+  }
+}
+
+void ErrorBase::CloneError(const ErrorBase& rhs) const {
+  m_error.Clone(rhs.GetError());
+}
+
+/**
+ * @brief Check if the current error code represents a fatal error.
+ *
+ * @return true if the current error is fatal.
+ */
+bool ErrorBase::StatusIsFatal() const { return m_error.GetCode() < 0; }
+
+void ErrorBase::SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
+                               llvm::StringRef filename,
+                               llvm::StringRef function, int lineNumber) {
+  // If there was an error
+  if (code != 0) {
+    std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
+
+    // Set the current error information for this object.
+    _globalError.Set(code, contextMessage, filename, function, lineNumber,
+                     nullptr);
+  }
+}
+
+void ErrorBase::SetGlobalWPIError(llvm::StringRef errorMessage,
+                                  llvm::StringRef contextMessage,
+                                  llvm::StringRef filename,
+                                  llvm::StringRef function, int lineNumber) {
+  std::string err = errorMessage.str() + ": " + contextMessage.str();
+
+  std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
+  if (_globalError.GetCode() != 0) {
+    _globalError.Clear();
+  }
+  _globalError.Set(-1, err, filename, function, lineNumber, nullptr);
+}
+
+/**
+ * Retrieve the current global error.
+ */
+Error& ErrorBase::GetGlobalError() {
+  std::lock_guard<priority_mutex> mutex(_globalErrorMutex);
+  return _globalError;
+}
diff --git a/wpilibc/shared/src/Filters/Filter.cpp b/wpilibc/shared/src/Filters/Filter.cpp
new file mode 100644
index 0000000..d2ac725
--- /dev/null
+++ b/wpilibc/shared/src/Filters/Filter.cpp
@@ -0,0 +1,22 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2015-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Filters/Filter.h"
+
+using namespace frc;
+
+Filter::Filter(std::shared_ptr<PIDSource> source) { m_source = source; }
+
+void Filter::SetPIDSourceType(PIDSourceType pidSource) {
+  m_source->SetPIDSourceType(pidSource);
+}
+
+PIDSourceType Filter::GetPIDSourceType() const {
+  return m_source->GetPIDSourceType();
+}
+
+double Filter::PIDGetSource() { return m_source->PIDGet(); }
diff --git a/wpilibc/shared/src/Filters/LinearDigitalFilter.cpp b/wpilibc/shared/src/Filters/LinearDigitalFilter.cpp
new file mode 100644
index 0000000..af04fcb
--- /dev/null
+++ b/wpilibc/shared/src/Filters/LinearDigitalFilter.cpp
@@ -0,0 +1,173 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2015-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Filters/LinearDigitalFilter.h"
+
+#include <cassert>
+#include <cmath>
+
+using namespace frc;
+
+/**
+ * Create a linear FIR or IIR filter.
+ *
+ * @param source  The PIDSource object that is used to get values
+ * @param ffGains The "feed forward" or FIR gains
+ * @param fbGains The "feed back" or IIR gains
+ */
+LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
+                                         std::initializer_list<double> ffGains,
+                                         std::initializer_list<double> fbGains)
+    : Filter(source),
+      m_inputs(ffGains.size()),
+      m_outputs(fbGains.size()),
+      m_inputGains(ffGains),
+      m_outputGains(fbGains) {}
+
+/**
+ * Create a linear FIR or IIR filter.
+ *
+ * @param source  The PIDSource object that is used to get values
+ * @param ffGains The "feed forward" or FIR gains
+ * @param fbGains The "feed back" or IIR gains
+ */
+LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
+                                         std::initializer_list<double> ffGains,
+                                         const std::vector<double>& fbGains)
+    : Filter(source),
+      m_inputs(ffGains.size()),
+      m_outputs(fbGains.size()),
+      m_inputGains(ffGains),
+      m_outputGains(fbGains) {}
+
+/**
+ * Create a linear FIR or IIR filter.
+ *
+ * @param source  The PIDSource object that is used to get values
+ * @param ffGains The "feed forward" or FIR gains
+ * @param fbGains The "feed back" or IIR gains
+ */
+LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
+                                         const std::vector<double>& ffGains,
+                                         std::initializer_list<double> fbGains)
+    : Filter(source),
+      m_inputs(ffGains.size()),
+      m_outputs(fbGains.size()),
+      m_inputGains(ffGains),
+      m_outputGains(fbGains) {}
+
+/**
+ * Create a linear FIR or IIR filter.
+ *
+ * @param source  The PIDSource object that is used to get values
+ * @param ffGains The "feed forward" or FIR gains
+ * @param fbGains The "feed back" or IIR gains
+ */
+LinearDigitalFilter::LinearDigitalFilter(std::shared_ptr<PIDSource> source,
+                                         const std::vector<double>& ffGains,
+                                         const std::vector<double>& fbGains)
+    : Filter(source),
+      m_inputs(ffGains.size()),
+      m_outputs(fbGains.size()),
+      m_inputGains(ffGains),
+      m_outputGains(fbGains) {}
+
+/**
+ * Creates a one-pole IIR low-pass filter of the form:<br>
+ *   y[n] = (1 - gain) * x[n] + gain * y[n-1]<br>
+ * where gain = e<sup>-dt / T</sup>, T is the time constant in seconds
+ *
+ * This filter is stable for time constants greater than zero.
+ *
+ * @param source       The PIDSource object that is used to get values
+ * @param timeConstant The discrete-time time constant in seconds
+ * @param period       The period in seconds between samples taken by the user
+ */
+LinearDigitalFilter LinearDigitalFilter::SinglePoleIIR(
+    std::shared_ptr<PIDSource> source, double timeConstant, double period) {
+  double gain = std::exp(-period / timeConstant);
+  return LinearDigitalFilter(std::move(source), {1.0 - gain}, {-gain});
+}
+
+/**
+ * Creates a first-order high-pass filter of the form:<br>
+ *   y[n] = gain * x[n] + (-gain) * x[n-1] + gain * y[n-1]<br>
+ * where gain = e<sup>-dt / T</sup>, T is the time constant in seconds
+ *
+ * This filter is stable for time constants greater than zero.
+ *
+ * @param source       The PIDSource object that is used to get values
+ * @param timeConstant The discrete-time time constant in seconds
+ * @param period       The period in seconds between samples taken by the user
+ */
+LinearDigitalFilter LinearDigitalFilter::HighPass(
+    std::shared_ptr<PIDSource> source, double timeConstant, double period) {
+  double gain = std::exp(-period / timeConstant);
+  return LinearDigitalFilter(std::move(source), {gain, -gain}, {-gain});
+}
+
+/**
+ * Creates a K-tap FIR moving average filter of the form:<br>
+ *   y[n] = 1/k * (x[k] + x[k-1] + … + x[0])
+ *
+ * This filter is always stable.
+ *
+ * @param source The PIDSource object that is used to get values
+ * @param taps   The number of samples to average over. Higher = smoother but
+ *               slower
+ */
+LinearDigitalFilter LinearDigitalFilter::MovingAverage(
+    std::shared_ptr<PIDSource> source, int taps) {
+  assert(taps > 0);
+
+  std::vector<double> gains(taps, 1.0 / taps);
+  return LinearDigitalFilter(std::move(source), gains, {});
+}
+
+double LinearDigitalFilter::Get() const {
+  double retVal = 0.0;
+
+  // Calculate the new value
+  for (size_t i = 0; i < m_inputGains.size(); i++) {
+    retVal += m_inputs[i] * m_inputGains[i];
+  }
+  for (size_t i = 0; i < m_outputGains.size(); i++) {
+    retVal -= m_outputs[i] * m_outputGains[i];
+  }
+
+  return retVal;
+}
+
+void LinearDigitalFilter::Reset() {
+  m_inputs.Reset();
+  m_outputs.Reset();
+}
+
+/**
+ * Calculates the next value of the filter
+ *
+ * @return The filtered value at this step
+ */
+double LinearDigitalFilter::PIDGet() {
+  double retVal = 0.0;
+
+  // Rotate the inputs
+  m_inputs.PushFront(PIDGetSource());
+
+  // Calculate the new value
+  for (size_t i = 0; i < m_inputGains.size(); i++) {
+    retVal += m_inputs[i] * m_inputGains[i];
+  }
+  for (size_t i = 0; i < m_outputGains.size(); i++) {
+    retVal -= m_outputs[i] * m_outputGains[i];
+  }
+
+  // Rotate the outputs
+  m_outputs.PushFront(retVal);
+
+  return retVal;
+}
diff --git a/wpilibc/shared/src/GamepadBase.cpp b/wpilibc/shared/src/GamepadBase.cpp
new file mode 100644
index 0000000..4f9e89f
--- /dev/null
+++ b/wpilibc/shared/src/GamepadBase.cpp
@@ -0,0 +1,12 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "GamepadBase.h"
+
+using namespace frc;
+
+GamepadBase::GamepadBase(int port) : GenericHID(port) {}
diff --git a/wpilibc/shared/src/GyroBase.cpp b/wpilibc/shared/src/GyroBase.cpp
new file mode 100644
index 0000000..61de319
--- /dev/null
+++ b/wpilibc/shared/src/GyroBase.cpp
@@ -0,0 +1,49 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "GyroBase.h"
+
+#include "LiveWindow/LiveWindow.h"
+#include "WPIErrors.h"
+
+using namespace frc;
+
+/**
+ * Get the PIDOutput for the PIDSource base object. Can be set to return
+ * angle or rate using SetPIDSourceType(). Defaults to angle.
+ *
+ * @return The PIDOutput (angle or rate, defaults to angle)
+ */
+double GyroBase::PIDGet() {
+  switch (GetPIDSourceType()) {
+    case PIDSourceType::kRate:
+      return GetRate();
+    case PIDSourceType::kDisplacement:
+      return GetAngle();
+    default:
+      return 0;
+  }
+}
+
+void GyroBase::UpdateTable() {
+  if (m_table != nullptr) {
+    m_table->PutNumber("Value", GetAngle());
+  }
+}
+
+void GyroBase::StartLiveWindowMode() {}
+
+void GyroBase::StopLiveWindowMode() {}
+
+std::string GyroBase::GetSmartDashboardType() const { return "Gyro"; }
+
+void GyroBase::InitTable(std::shared_ptr<ITable> subTable) {
+  m_table = subTable;
+  UpdateTable();
+}
+
+std::shared_ptr<ITable> GyroBase::GetTable() const { return m_table; }
diff --git a/wpilibc/shared/src/HLUsageReporting.cpp b/wpilibc/shared/src/HLUsageReporting.cpp
new file mode 100644
index 0000000..a3c82bb
--- /dev/null
+++ b/wpilibc/shared/src/HLUsageReporting.cpp
@@ -0,0 +1,28 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "HLUsageReporting.h"
+
+using namespace frc;
+
+HLUsageReportingInterface* HLUsageReporting::impl = nullptr;
+
+void HLUsageReporting::SetImplementation(HLUsageReportingInterface* i) {
+  impl = i;
+}
+
+void HLUsageReporting::ReportScheduler() {
+  if (impl != nullptr) {
+    impl->ReportScheduler();
+  }
+}
+
+void HLUsageReporting::ReportSmartDashboard() {
+  if (impl != nullptr) {
+    impl->ReportSmartDashboard();
+  }
+}
diff --git a/wpilibc/shared/src/JoystickBase.cpp b/wpilibc/shared/src/JoystickBase.cpp
new file mode 100644
index 0000000..c7a5fd7
--- /dev/null
+++ b/wpilibc/shared/src/JoystickBase.cpp
@@ -0,0 +1,12 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "JoystickBase.h"
+
+using namespace frc;
+
+JoystickBase::JoystickBase(int port) : GenericHID(port) {}
diff --git a/wpilibc/shared/src/LiveWindow/LiveWindow.cpp b/wpilibc/shared/src/LiveWindow/LiveWindow.cpp
new file mode 100644
index 0000000..1328545
--- /dev/null
+++ b/wpilibc/shared/src/LiveWindow/LiveWindow.cpp
@@ -0,0 +1,238 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2012-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "LiveWindow/LiveWindow.h"
+
+#include <algorithm>
+#include <sstream>
+
+#include "networktables/NetworkTable.h"
+
+using namespace frc;
+
+/**
+ * Get an instance of the LiveWindow main class.
+ *
+ * This is a singleton to guarantee that there is only a single instance
+ * regardless of how many times GetInstance is called.
+ */
+LiveWindow* LiveWindow::GetInstance() {
+  static LiveWindow instance;
+  return &instance;
+}
+
+/**
+ * LiveWindow constructor.
+ *
+ * Allocate the necessary tables.
+ */
+LiveWindow::LiveWindow() : m_scheduler(Scheduler::GetInstance()) {
+  m_liveWindowTable = NetworkTable::GetTable("LiveWindow");
+  m_statusTable = m_liveWindowTable->GetSubTable("~STATUS~");
+}
+
+/**
+ * Change the enabled status of LiveWindow.
+ *
+ * If it changes to enabled, start livewindow running otherwise stop it
+ */
+void LiveWindow::SetEnabled(bool enabled) {
+  if (m_enabled == enabled) return;
+  if (enabled) {
+    if (m_firstTime) {
+      InitializeLiveWindowComponents();
+      m_firstTime = false;
+    }
+    m_scheduler->SetEnabled(false);
+    m_scheduler->RemoveAll();
+    for (auto& elem : m_components) {
+      elem.first->StartLiveWindowMode();
+    }
+  } else {
+    for (auto& elem : m_components) {
+      elem.first->StopLiveWindowMode();
+    }
+    m_scheduler->SetEnabled(true);
+  }
+  m_enabled = enabled;
+  m_statusTable->PutBoolean("LW Enabled", m_enabled);
+}
+
+/**
+ * @name AddSensor(subsystem, name, component)
+ *
+ * Add a Sensor associated with the subsystem and call it by the given name.
+ *
+ * @param subsystem The subsystem this component is part of.
+ * @param name      The name of this component.
+ * @param component A LiveWindowSendable component that represents a sensor.
+ */
+//@{
+/**
+ * @brief Use a STL smart pointer to share ownership of component.
+ */
+void LiveWindow::AddSensor(const std::string& subsystem,
+                           const std::string& name,
+                           std::shared_ptr<LiveWindowSendable> component) {
+  m_components[component].subsystem = subsystem;
+  m_components[component].name = name;
+  m_components[component].isSensor = true;
+}
+
+/**
+ * @brief Pass a reference to LiveWindow and retain ownership of the component.
+ */
+void LiveWindow::AddSensor(const std::string& subsystem,
+                           const std::string& name,
+                           LiveWindowSendable& component) {
+  AddSensor(subsystem, name, std::shared_ptr<LiveWindowSendable>(
+                                 &component, [](LiveWindowSendable*) {}));
+}
+
+/**
+ * @brief Use a raw pointer to the LiveWindow.
+ * @deprecated Prefer smart pointers or references.
+ */
+void LiveWindow::AddSensor(const std::string& subsystem,
+                           const std::string& name,
+                           LiveWindowSendable* component) {
+  AddSensor(subsystem, name, std::shared_ptr<LiveWindowSendable>(
+                                 component, NullDeleter<LiveWindowSendable>()));
+}
+//@}
+
+/**
+ * @name AddActuator(subsystem, name, component)
+ *
+ * Add an Actuator associated with the subsystem and call it by the given name.
+ *
+ * @param subsystem The subsystem this component is part of.
+ * @param name      The name of this component.
+ * @param component A LiveWindowSendable component that represents a actuator.
+ */
+//@{
+/**
+ * @brief Use a STL smart pointer to share ownership of component.
+ */
+void LiveWindow::AddActuator(const std::string& subsystem,
+                             const std::string& name,
+                             std::shared_ptr<LiveWindowSendable> component) {
+  m_components[component].subsystem = subsystem;
+  m_components[component].name = name;
+  m_components[component].isSensor = false;
+}
+
+/**
+ * @brief Pass a reference to LiveWindow and retain ownership of the component.
+ */
+void LiveWindow::AddActuator(const std::string& subsystem,
+                             const std::string& name,
+                             LiveWindowSendable& component) {
+  AddActuator(subsystem, name, std::shared_ptr<LiveWindowSendable>(
+                                   &component, [](LiveWindowSendable*) {}));
+}
+
+/**
+ * @brief Use a raw pointer to the LiveWindow.
+ * @deprecated Prefer smart pointers or references.
+ */
+void LiveWindow::AddActuator(const std::string& subsystem,
+                             const std::string& name,
+                             LiveWindowSendable* component) {
+  AddActuator(subsystem, name,
+              std::shared_ptr<LiveWindowSendable>(
+                  component, NullDeleter<LiveWindowSendable>()));
+}
+//@}
+
+/**
+ * Meant for internal use in other WPILib classes.
+ */
+void LiveWindow::AddSensor(std::string type, int channel,
+                           LiveWindowSendable* component) {
+  std::ostringstream oss;
+  oss << type << "[" << channel << "]";
+  AddSensor("Ungrouped", oss.str(), component);
+  std::shared_ptr<LiveWindowSendable> component_stl(
+      component, NullDeleter<LiveWindowSendable>());
+  if (std::find(m_sensors.begin(), m_sensors.end(), component_stl) ==
+      m_sensors.end())
+    m_sensors.push_back(component_stl);
+}
+
+/**
+ * Meant for internal use in other WPILib classes.
+ */
+void LiveWindow::AddActuator(std::string type, int channel,
+                             LiveWindowSendable* component) {
+  std::ostringstream oss;
+  oss << type << "[" << channel << "]";
+  AddActuator("Ungrouped", oss.str(),
+              std::shared_ptr<LiveWindowSendable>(component,
+                                                  [](LiveWindowSendable*) {}));
+}
+
+/**
+ * Meant for internal use in other WPILib classes.
+ */
+void LiveWindow::AddActuator(std::string type, int module, int channel,
+                             LiveWindowSendable* component) {
+  std::ostringstream oss;
+  oss << type << "[" << module << "," << channel << "]";
+  AddActuator("Ungrouped", oss.str(),
+              std::shared_ptr<LiveWindowSendable>(component,
+                                                  [](LiveWindowSendable*) {}));
+}
+
+/**
+ * Tell all the sensors to update (send) their values.
+ *
+ * Actuators are handled through callbacks on their value changing from the
+ * SmartDashboard widgets.
+ */
+void LiveWindow::UpdateValues() {
+  for (auto& elem : m_sensors) {
+    elem->UpdateTable();
+  }
+}
+
+/**
+ * This method is called periodically to cause the sensors to send new values
+ * to the SmartDashboard.
+ */
+void LiveWindow::Run() {
+  if (m_enabled) {
+    UpdateValues();
+  }
+}
+
+/**
+ * Initialize all the LiveWindow elements the first time we enter LiveWindow
+ * mode. By holding off creating the NetworkTable entries, it allows them to be
+ * redefined before the first time in LiveWindow mode. This allows default
+ * sensor and actuator values to be created that are replaced with the custom
+ * names from users calling addActuator and addSensor.
+ */
+void LiveWindow::InitializeLiveWindowComponents() {
+  for (auto& elem : m_components) {
+    std::shared_ptr<LiveWindowSendable> component = elem.first;
+    LiveWindowComponent c = elem.second;
+    std::string subsystem = c.subsystem;
+    std::string name = c.name;
+    m_liveWindowTable->GetSubTable(subsystem)->PutString("~TYPE~",
+                                                         "LW Subsystem");
+    std::shared_ptr<ITable> table(
+        m_liveWindowTable->GetSubTable(subsystem)->GetSubTable(name));
+    table->PutString("~TYPE~", component->GetSmartDashboardType());
+    table->PutString("Name", name);
+    table->PutString("Subsystem", subsystem);
+    component->InitTable(table);
+    if (c.isSensor) {
+      m_sensors.push_back(component);
+    }
+  }
+}
diff --git a/wpilibc/shared/src/LiveWindow/LiveWindowStatusListener.cpp b/wpilibc/shared/src/LiveWindow/LiveWindowStatusListener.cpp
new file mode 100644
index 0000000..b6807b7
--- /dev/null
+++ b/wpilibc/shared/src/LiveWindow/LiveWindowStatusListener.cpp
@@ -0,0 +1,16 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2012-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "LiveWindow/LiveWindowStatusListener.h"
+
+#include "Commands/Scheduler.h"
+
+using namespace frc;
+
+void LiveWindowStatusListener::ValueChanged(ITable* source, llvm::StringRef key,
+                                            std::shared_ptr<nt::Value> value,
+                                            bool isNew) {}
diff --git a/wpilibc/shared/src/PIDSource.cpp b/wpilibc/shared/src/PIDSource.cpp
new file mode 100644
index 0000000..167a7a2
--- /dev/null
+++ b/wpilibc/shared/src/PIDSource.cpp
@@ -0,0 +1,21 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "PIDSource.h"
+
+using namespace frc;
+
+/**
+ * Set which parameter you are using as a process control variable.
+ *
+ * @param pidSource An enum to select the parameter.
+ */
+void PIDSource::SetPIDSourceType(PIDSourceType pidSource) {
+  m_pidSource = pidSource;
+}
+
+PIDSourceType PIDSource::GetPIDSourceType() const { return m_pidSource; }
diff --git a/wpilibc/shared/src/Resource.cpp b/wpilibc/shared/src/Resource.cpp
new file mode 100644
index 0000000..725d8a4
--- /dev/null
+++ b/wpilibc/shared/src/Resource.cpp
@@ -0,0 +1,106 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "Resource.h"
+
+#include "ErrorBase.h"
+#include "WPIErrors.h"
+
+using namespace frc;
+
+priority_recursive_mutex Resource::m_createLock;
+
+/**
+ * Allocate storage for a new instance of Resource.
+ *
+ * Allocate a bool array of values that will get initialized to indicate that no
+ * resources have been allocated yet. The indicies of the resources are [0 ..
+ * elements - 1].
+ */
+Resource::Resource(uint32_t elements) {
+  std::lock_guard<priority_recursive_mutex> sync(m_createLock);
+  m_isAllocated = std::vector<bool>(elements, false);
+}
+
+/**
+ * Factory method to create a Resource allocation-tracker *if* needed.
+ *
+ * @param r        address of the caller's Resource pointer. If *r == nullptr,
+ *                 this will construct a Resource and make *r point to it. If
+ *                 *r != nullptr, i.e. the caller already has a Resource
+ *                 instance, this won't do anything.
+ * @param elements the number of elements for this Resource allocator to
+ *                 track, that is, it will allocate resource numbers in the
+ *                 range [0 .. elements - 1].
+ */
+/*static*/ void Resource::CreateResourceObject(std::unique_ptr<Resource>& r,
+                                               uint32_t elements) {
+  std::lock_guard<priority_recursive_mutex> sync(m_createLock);
+  if (!r) {
+    r = std::make_unique<Resource>(elements);
+  }
+}
+
+/**
+ * Allocate a resource.
+ *
+ * When a resource is requested, mark it allocated. In this case, a free
+ * resource value within the range is located and returned after it is marked
+ * allocated.
+ */
+uint32_t Resource::Allocate(const std::string& resourceDesc) {
+  std::lock_guard<priority_recursive_mutex> sync(m_allocateLock);
+  for (uint32_t i = 0; i < m_isAllocated.size(); i++) {
+    if (!m_isAllocated[i]) {
+      m_isAllocated[i] = true;
+      return i;
+    }
+  }
+  wpi_setWPIErrorWithContext(NoAvailableResources, resourceDesc);
+  return std::numeric_limits<uint32_t>::max();
+}
+
+/**
+ * Allocate a specific resource value.
+ *
+ * The user requests a specific resource value, i.e. channel number and it is
+ * verified unallocated, then returned.
+ */
+uint32_t Resource::Allocate(uint32_t index, const std::string& resourceDesc) {
+  std::lock_guard<priority_recursive_mutex> sync(m_allocateLock);
+  if (index >= m_isAllocated.size()) {
+    wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, resourceDesc);
+    return std::numeric_limits<uint32_t>::max();
+  }
+  if (m_isAllocated[index]) {
+    wpi_setWPIErrorWithContext(ResourceAlreadyAllocated, resourceDesc);
+    return std::numeric_limits<uint32_t>::max();
+  }
+  m_isAllocated[index] = true;
+  return index;
+}
+
+/**
+ * Free an allocated resource.
+ *
+ * After a resource is no longer needed, for example a destructor is called for
+ * a channel assignment class, Free will release the resource value so it can
+ * be reused somewhere else in the program.
+ */
+void Resource::Free(uint32_t index) {
+  std::unique_lock<priority_recursive_mutex> sync(m_allocateLock);
+  if (index == std::numeric_limits<uint32_t>::max()) return;
+  if (index >= m_isAllocated.size()) {
+    wpi_setWPIError(NotAllocated);
+    return;
+  }
+  if (!m_isAllocated[index]) {
+    wpi_setWPIError(NotAllocated);
+    return;
+  }
+  m_isAllocated[index] = false;
+}
diff --git a/wpilibc/shared/src/RobotState.cpp b/wpilibc/shared/src/RobotState.cpp
new file mode 100644
index 0000000..9ee79e5
--- /dev/null
+++ b/wpilibc/shared/src/RobotState.cpp
@@ -0,0 +1,58 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2016-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "RobotState.h"
+
+#include "Base.h"
+
+using namespace frc;
+
+std::shared_ptr<RobotStateInterface> RobotState::impl;
+
+void RobotState::SetImplementation(RobotStateInterface& i) {
+  impl = std::shared_ptr<RobotStateInterface>(
+      &i, NullDeleter<RobotStateInterface>());
+}
+
+void RobotState::SetImplementation(std::shared_ptr<RobotStateInterface> i) {
+  impl = i;
+}
+
+bool RobotState::IsDisabled() {
+  if (impl != nullptr) {
+    return impl->IsDisabled();
+  }
+  return true;
+}
+
+bool RobotState::IsEnabled() {
+  if (impl != nullptr) {
+    return impl->IsEnabled();
+  }
+  return false;
+}
+
+bool RobotState::IsOperatorControl() {
+  if (impl != nullptr) {
+    return impl->IsOperatorControl();
+  }
+  return true;
+}
+
+bool RobotState::IsAutonomous() {
+  if (impl != nullptr) {
+    return impl->IsAutonomous();
+  }
+  return false;
+}
+
+bool RobotState::IsTest() {
+  if (impl != nullptr) {
+    return impl->IsTest();
+  }
+  return false;
+}
diff --git a/wpilibc/shared/src/SmartDashboard/SendableChooserBase.cpp b/wpilibc/shared/src/SmartDashboard/SendableChooserBase.cpp
new file mode 100644
index 0000000..9552e9b
--- /dev/null
+++ b/wpilibc/shared/src/SmartDashboard/SendableChooserBase.cpp
@@ -0,0 +1,22 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2017. All Rights Reserved.                             */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "SmartDashboard/SendableChooserBase.h"
+
+using namespace frc;
+
+const char* SendableChooserBase::kDefault = "default";
+const char* SendableChooserBase::kOptions = "options";
+const char* SendableChooserBase::kSelected = "selected";
+
+std::shared_ptr<ITable> SendableChooserBase::GetTable() const {
+  return m_table;
+}
+
+std::string SendableChooserBase::GetSmartDashboardType() const {
+  return "String Chooser";
+}
diff --git a/wpilibc/shared/src/SmartDashboard/SmartDashboard.cpp b/wpilibc/shared/src/SmartDashboard/SmartDashboard.cpp
new file mode 100644
index 0000000..0e5878e
--- /dev/null
+++ b/wpilibc/shared/src/SmartDashboard/SmartDashboard.cpp
@@ -0,0 +1,471 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2011-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "SmartDashboard/SmartDashboard.h"
+
+#include "HLUsageReporting.h"
+#include "SmartDashboard/NamedSendable.h"
+#include "WPIErrors.h"
+#include "networktables/NetworkTable.h"
+
+using namespace frc;
+
+std::shared_ptr<ITable> SmartDashboard::m_table;
+std::map<std::shared_ptr<ITable>, Sendable*> SmartDashboard::m_tablesToData;
+
+void SmartDashboard::init() {
+  m_table = NetworkTable::GetTable("SmartDashboard");
+
+  HLUsageReporting::ReportSmartDashboard();
+}
+
+/**
+   * Determines whether the given key is in this table.
+   *
+   * @param key the key to search for
+   * @return true if the table as a value assigned to the given key
+   */
+bool SmartDashboard::ContainsKey(llvm::StringRef key) {
+  return m_table->ContainsKey(key);
+}
+
+/**
+ * @param types bitmask of types; 0 is treated as a "don't care".
+ * @return keys currently in the table
+ */
+std::vector<std::string> SmartDashboard::GetKeys(int types) {
+  return m_table->GetKeys(types);
+}
+
+/**
+ * Makes a key's value persistent through program restarts.
+ *
+ * @param key the key to make persistent
+ */
+void SmartDashboard::SetPersistent(llvm::StringRef key) {
+  m_table->SetPersistent(key);
+}
+
+/**
+ * Stop making a key's value persistent through program restarts.
+ * The key cannot be null.
+ *
+ * @param key the key name
+ */
+void SmartDashboard::ClearPersistent(llvm::StringRef key) {
+  m_table->ClearPersistent(key);
+}
+
+/**
+ * Returns whether the value is persistent through program restarts.
+ * The key cannot be null.
+ *
+ * @param key the key name
+ */
+bool SmartDashboard::IsPersistent(llvm::StringRef key) {
+  return m_table->IsPersistent(key);
+}
+
+/**
+ * Sets flags on the specified key in this table. The key can
+ * not be null.
+ *
+ * @param key the key name
+ * @param flags the flags to set (bitmask)
+ */
+void SmartDashboard::SetFlags(llvm::StringRef key, unsigned int flags) {
+  m_table->SetFlags(key, flags);
+}
+
+/**
+ * Clears flags on the specified key in this table. The key can
+ * not be null.
+ *
+ * @param key the key name
+ * @param flags the flags to clear (bitmask)
+ */
+void SmartDashboard::ClearFlags(llvm::StringRef key, unsigned int flags) {
+  m_table->ClearFlags(key, flags);
+}
+
+/**
+ * Returns the flags for the specified key.
+ *
+ * @param key the key name
+ * @return the flags, or 0 if the key is not defined
+ */
+unsigned int SmartDashboard::GetFlags(llvm::StringRef key) {
+  return m_table->GetFlags(key);
+}
+
+/**
+ * Deletes the specified key in this table.
+ *
+ * @param key the key name
+ */
+void SmartDashboard::Delete(llvm::StringRef key) { m_table->Delete(key); }
+
+/**
+ * Maps the specified key to the specified value in this table.
+ *
+ * The value can be retrieved by calling the get method with a key that is equal
+ * to the original key.
+ *
+ * @param keyName the key
+ * @param value   the value
+ */
+void SmartDashboard::PutData(llvm::StringRef key, Sendable* data) {
+  if (data == nullptr) {
+    wpi_setGlobalWPIErrorWithContext(NullParameter, "value");
+    return;
+  }
+  std::shared_ptr<ITable> dataTable(m_table->GetSubTable(key));
+  dataTable->PutString("~TYPE~", data->GetSmartDashboardType());
+  data->InitTable(dataTable);
+  m_tablesToData[dataTable] = data;
+}
+
+/**
+ * Maps the specified key (where the key is the name of the
+ * {@link SmartDashboardNamedData} to the specified value in this table.
+ *
+ * The value can be retrieved by calling the get method with a key that is equal
+ * to the original key.
+ *
+ * @param value the value
+ */
+void SmartDashboard::PutData(NamedSendable* value) {
+  if (value == nullptr) {
+    wpi_setGlobalWPIErrorWithContext(NullParameter, "value");
+    return;
+  }
+  PutData(value->GetName(), value);
+}
+
+/**
+ * Returns the value at the specified key.
+ *
+ * @param keyName the key
+ * @return the value
+ */
+Sendable* SmartDashboard::GetData(llvm::StringRef key) {
+  std::shared_ptr<ITable> subtable(m_table->GetSubTable(key));
+  Sendable* data = m_tablesToData[subtable];
+  if (data == nullptr) {
+    wpi_setGlobalWPIErrorWithContext(SmartDashboardMissingKey, key);
+    return nullptr;
+  }
+  return data;
+}
+
+/**
+ * Maps the specified key to the specified complex value (such as an array) in
+ * this table.
+ *
+ * The value can be retrieved by calling the RetrieveValue method with a key
+ * that is equal to the original key.
+ *
+ * @param keyName the key
+ * @param value   the value
+ * @return        False if the table key already exists with a different type
+ */
+bool SmartDashboard::PutValue(llvm::StringRef keyName,
+                              std::shared_ptr<nt::Value> value) {
+  return m_table->PutValue(keyName, value);
+}
+
+/**
+   * Gets the current value in the table, setting it if it does not exist.
+   * @param key the key
+   * @param defaultValue the default value to set if key doesn't exist.
+   * @returns False if the table key exists with a different type
+   */
+bool SmartDashboard::SetDefaultValue(llvm::StringRef key,
+                                     std::shared_ptr<nt::Value> defaultValue) {
+  return m_table->SetDefaultValue(key, defaultValue);
+}
+
+/**
+ * Retrieves the complex value (such as an array) in this table into the complex
+ * data object.
+ *
+ * @param keyName the key
+ * @param value   the object to retrieve the value into
+ */
+std::shared_ptr<nt::Value> SmartDashboard::GetValue(llvm::StringRef keyName) {
+  return m_table->GetValue(keyName);
+}
+
+/**
+ * Maps the specified key to the specified value in this table.
+ *
+ * The value can be retrieved by calling the get method with a key that is equal
+ * to the original key.
+ *
+ * @param keyName the key
+ * @param value   the value
+ * @return        False if the table key already exists with a different type
+ */
+bool SmartDashboard::PutBoolean(llvm::StringRef keyName, bool value) {
+  return m_table->PutBoolean(keyName, value);
+}
+
+/**
+   * Gets the current value in the table, setting it if it does not exist.
+   * @param key the key
+   * @param defaultValue the default value to set if key doesn't exist.
+   * @returns False if the table key exists with a different type
+   */
+bool SmartDashboard::SetDefaultBoolean(llvm::StringRef key, bool defaultValue) {
+  return m_table->SetDefaultBoolean(key, defaultValue);
+}
+
+/**
+ * Returns the value at the specified key.
+ *
+ * If the key is not found, returns the default value.
+ *
+ * @param keyName the key
+ * @return the value
+ */
+bool SmartDashboard::GetBoolean(llvm::StringRef keyName, bool defaultValue) {
+  return m_table->GetBoolean(keyName, defaultValue);
+}
+
+/**
+ * Maps the specified key to the specified value in this table.
+ *
+ * The value can be retrieved by calling the get method with a key that is equal
+ * to the original key.
+ *
+ * @param keyName the key
+ * @param value   the value
+ * @return        False if the table key already exists with a different type
+ */
+bool SmartDashboard::PutNumber(llvm::StringRef keyName, double value) {
+  return m_table->PutNumber(keyName, value);
+}
+
+/**
+   * Gets the current value in the table, setting it if it does not exist.
+   * @param key the key
+   * @param defaultValue the default value to set if key doesn't exist.
+   * @returns False if the table key exists with a different type
+   */
+bool SmartDashboard::SetDefaultNumber(llvm::StringRef key,
+                                      double defaultValue) {
+  return m_table->SetDefaultNumber(key, defaultValue);
+}
+
+/**
+ * Returns the value at the specified key.
+ *
+ * If the key is not found, returns the default value.
+ *
+ * @param keyName the key
+ * @return the value
+ */
+double SmartDashboard::GetNumber(llvm::StringRef keyName, double defaultValue) {
+  return m_table->GetNumber(keyName, defaultValue);
+}
+
+/**
+ * Maps the specified key to the specified value in this table.
+ *
+ * The value can be retrieved by calling the get method with a key that is equal
+ * to the original key.
+ *
+ * @param keyName the key
+ * @param value   the value
+ * @return        False if the table key already exists with a different type
+ */
+bool SmartDashboard::PutString(llvm::StringRef keyName, llvm::StringRef value) {
+  return m_table->PutString(keyName, value);
+}
+
+/**
+ * Gets the current value in the table, setting it if it does not exist.
+ * @param key the key
+ * @param defaultValue the default value to set if key doesn't exist.
+ * @returns False if the table key exists with a different type
+ */
+bool SmartDashboard::SetDefaultString(llvm::StringRef key,
+                                      llvm::StringRef defaultValue) {
+  return m_table->SetDefaultString(key, defaultValue);
+}
+
+/**
+ * Returns the value at the specified key.
+ *
+ * If the key is not found, returns the default value.
+ *
+ * @param keyName the key
+ * @return the value
+ */
+std::string SmartDashboard::GetString(llvm::StringRef keyName,
+                                      llvm::StringRef defaultValue) {
+  return m_table->GetString(keyName, defaultValue);
+}
+
+/**
+   * Put a boolean array in the table
+   * @param key the key to be assigned to
+   * @param value the value that will be assigned
+   * @return False if the table key already exists with a different type
+   *
+   * @note The array must be of int's rather than of bool's because
+   *       std::vector<bool> is special-cased in C++.  0 is false, any
+   *       non-zero value is true.
+   */
+bool SmartDashboard::PutBooleanArray(llvm::StringRef key,
+                                     llvm::ArrayRef<int> value) {
+  return m_table->PutBooleanArray(key, value);
+}
+
+/**
+ * Gets the current value in the table, setting it if it does not exist.
+ * @param key the key
+ * @param defaultValue the default value to set if key doesn't exist.
+ * @returns False if the table key exists with a different type
+ */
+bool SmartDashboard::SetDefaultBooleanArray(llvm::StringRef key,
+                                            llvm::ArrayRef<int> defaultValue) {
+  return m_table->SetDefaultBooleanArray(key, defaultValue);
+}
+
+/**
+ * Returns the boolean array the key maps to. If the key does not exist or is
+ * of different type, it will return the default value.
+ * @param key the key to look up
+ * @param defaultValue the value to be returned if no value is found
+ * @return the value associated with the given key or the given default value
+ * if there is no value associated with the key
+ *
+ * @note This makes a copy of the array.  If the overhead of this is a
+ *       concern, use GetValue() instead.
+ *
+ * @note The returned array is std::vector<int> instead of std::vector<bool>
+ *       because std::vector<bool> is special-cased in C++.  0 is false, any
+ *       non-zero value is true.
+ */
+std::vector<int> SmartDashboard::GetBooleanArray(
+    llvm::StringRef key, llvm::ArrayRef<int> defaultValue) {
+  return m_table->GetBooleanArray(key, defaultValue);
+}
+
+/**
+ * Put a number array in the table
+ * @param key the key to be assigned to
+ * @param value the value that will be assigned
+ * @return False if the table key already exists with a different type
+ */
+bool SmartDashboard::PutNumberArray(llvm::StringRef key,
+                                    llvm::ArrayRef<double> value) {
+  return m_table->PutNumberArray(key, value);
+}
+
+/**
+ * Gets the current value in the table, setting it if it does not exist.
+ * @param key the key
+ * @param defaultValue the default value to set if key doesn't exist.
+ * @returns False if the table key exists with a different type
+ */
+bool SmartDashboard::SetDefaultNumberArray(
+    llvm::StringRef key, llvm::ArrayRef<double> defaultValue) {
+  return m_table->SetDefaultNumberArray(key, defaultValue);
+}
+
+/**
+ * Returns the number array the key maps to. If the key does not exist or is
+ * of different type, it will return the default value.
+ * @param key the key to look up
+ * @param defaultValue the value to be returned if no value is found
+ * @return the value associated with the given key or the given default value
+ * if there is no value associated with the key
+ *
+ * @note This makes a copy of the array.  If the overhead of this is a
+ *       concern, use GetValue() instead.
+ */
+std::vector<double> SmartDashboard::GetNumberArray(
+    llvm::StringRef key, llvm::ArrayRef<double> defaultValue) {
+  return m_table->GetNumberArray(key, defaultValue);
+}
+
+/**
+ * Put a string array in the table
+ * @param key the key to be assigned to
+ * @param value the value that will be assigned
+ * @return False if the table key already exists with a different type
+ */
+bool SmartDashboard::PutStringArray(llvm::StringRef key,
+                                    llvm::ArrayRef<std::string> value) {
+  return m_table->PutStringArray(key, value);
+}
+
+/**
+ * Gets the current value in the table, setting it if it does not exist.
+ * @param key the key
+ * @param defaultValue the default value to set if key doesn't exist.
+ * @returns False if the table key exists with a different type
+ */
+bool SmartDashboard::SetDefaultStringArray(
+    llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) {
+  return m_table->SetDefaultStringArray(key, defaultValue);
+}
+
+/**
+ * Returns the string array the key maps to. If the key does not exist or is
+ * of different type, it will return the default value.
+ * @param key the key to look up
+ * @param defaultValue the value to be returned if no value is found
+ * @return the value associated with the given key or the given default value
+ * if there is no value associated with the key
+ *
+ * @note This makes a copy of the array.  If the overhead of this is a
+ *       concern, use GetValue() instead.
+ */
+std::vector<std::string> SmartDashboard::GetStringArray(
+    llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) {
+  return m_table->GetStringArray(key, defaultValue);
+}
+
+/**
+ * Put a raw value (byte array) in the table
+ * @param key the key to be assigned to
+ * @param value the value that will be assigned
+ * @return False if the table key already exists with a different type
+ */
+bool SmartDashboard::PutRaw(llvm::StringRef key, llvm::StringRef value) {
+  return m_table->PutRaw(key, value);
+}
+
+/**
+ * Gets the current value in the table, setting it if it does not exist.
+ * @param key the key
+ * @param defaultValue the default value to set if key doesn't exist.
+ * @returns False if the table key exists with a different type
+ */
+bool SmartDashboard::SetDefaultRaw(llvm::StringRef key,
+                                   llvm::StringRef defaultValue) {
+  return m_table->SetDefaultRaw(key, defaultValue);
+}
+
+/**
+ * Returns the raw value (byte array) the key maps to. If the key does not
+ * exist or is of different type, it will return the default value.
+ * @param key the key to look up
+ * @param defaultValue the value to be returned if no value is found
+ * @return the value associated with the given key or the given default value
+ * if there is no value associated with the key
+ *
+ * @note This makes a copy of the raw contents.  If the overhead of this is a
+ *       concern, use GetValue() instead.
+ */
+std::string SmartDashboard::GetRaw(llvm::StringRef key,
+                                   llvm::StringRef defaultValue) {
+  return m_table->GetRaw(key, defaultValue);
+}
diff --git a/wpilibc/shared/src/interfaces/Potentiometer.cpp b/wpilibc/shared/src/interfaces/Potentiometer.cpp
new file mode 100644
index 0000000..2b9766a
--- /dev/null
+++ b/wpilibc/shared/src/interfaces/Potentiometer.cpp
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2015-2017. All Rights Reserved.                        */
+/* Open Source Software - may be modified and shared by FRC teams. The code   */
+/* must be accompanied by the FIRST BSD license file in the root directory of */
+/* the project.                                                               */
+/*----------------------------------------------------------------------------*/
+
+#include "interfaces/Potentiometer.h"
+
+#include <Utility.h>
+
+using namespace frc;
+
+void Potentiometer::SetPIDSourceType(PIDSourceType pidSource) {
+  if (wpi_assert(pidSource == PIDSourceType::kDisplacement)) {
+    m_pidSource = pidSource;
+  }
+}