Replace use of deprecated C Standard library headers in C++ code.

Change-Id: I9fa6630c7e4bdb2897df34d417635d8c7d8253bc
Signed-off-by: Tyler Chatow <tchatow@gmail.com>
diff --git a/aos/actions/actions.h b/aos/actions/actions.h
index 5d69518..65dc170 100644
--- a/aos/actions/actions.h
+++ b/aos/actions/actions.h
@@ -1,11 +1,11 @@
 #ifndef AOS_ACTIONS_ACTIONS_H_
 #define AOS_ACTIONS_ACTIONS_H_
 
-#include <inttypes.h>
 #include <sys/types.h>
 #include <unistd.h>
 
 #include <atomic>
+#include <cinttypes>
 #include <memory>
 #include <type_traits>
 
@@ -106,8 +106,8 @@
  public:
   // A convenient way to refer to the type of our goals.
   typedef T GoalType;
-  typedef typename std::remove_reference<decltype(
-      *static_cast<GoalType *>(nullptr)->params())>::type ParamType;
+  typedef typename std::remove_reference<
+      decltype(*static_cast<GoalType *>(nullptr)->params())>::type ParamType;
 
   TypedAction(typename ::aos::Fetcher<Status> *status_fetcher,
               typename ::aos::Sender<GoalType> *goal_sender,
@@ -194,8 +194,8 @@
 class TypedActionFactory {
  public:
   typedef T GoalType;
-  typedef typename std::remove_reference<decltype(
-      *static_cast<GoalType *>(nullptr)->params())>::type ParamType;
+  typedef typename std::remove_reference<
+      decltype(*static_cast<GoalType *>(nullptr)->params())>::type ParamType;
 
   explicit TypedActionFactory(::aos::EventLoop *event_loop,
                               const ::std::string &name)
diff --git a/aos/actions/actor.h b/aos/actions/actor.h
index 0478d9a..560e242 100644
--- a/aos/actions/actor.h
+++ b/aos/actions/actor.h
@@ -1,17 +1,16 @@
 #ifndef AOS_ACTIONS_ACTOR_H_
 #define AOS_ACTIONS_ACTOR_H_
 
-#include <inttypes.h>
-#include <stdio.h>
-
 #include <chrono>
+#include <cinttypes>
+#include <cstdio>
 #include <functional>
 
 #include "aos/actions/actions_generated.h"
-#include "frc971/control_loops/control_loop.h"
 #include "aos/logging/logging.h"
 #include "aos/time/time.h"
 #include "aos/util/phased_loop.h"
+#include "frc971/control_loops/control_loop.h"
 
 namespace aos {
 namespace common {
@@ -21,8 +20,8 @@
 class ActorBase {
  public:
   typedef T GoalType;
-  typedef typename std::remove_reference<decltype(
-      *static_cast<GoalType *>(nullptr)->params())>::type ParamType;
+  typedef typename std::remove_reference<
+      decltype(*static_cast<GoalType *>(nullptr)->params())>::type ParamType;
 
   ActorBase(::aos::EventLoop *event_loop, const ::std::string &name)
       : event_loop_(event_loop),
diff --git a/aos/complex_thread_local.h b/aos/complex_thread_local.h
index 224d3b2..5397f2f 100644
--- a/aos/complex_thread_local.h
+++ b/aos/complex_thread_local.h
@@ -1,8 +1,7 @@
 #ifndef AOS_COMPLEX_THREAD_LOCAL_H_
 #define AOS_COMPLEX_THREAD_LOCAL_H_
 
-#include <assert.h>
-
+#include <cassert>
 #include <type_traits>
 #include <utility>
 
@@ -71,7 +70,7 @@
   // already.
   // args are all perfectly forwarded to the constructor.
   template <typename... Args>
-  void Create(Args &&... args) {
+  void Create(Args &&...args) {
     if (initialized) return;
     new (&storage) T(::std::forward<Args>(args)...);
     destructor.function = PlacementDelete;
@@ -93,9 +92,7 @@
   bool created() const { return initialized; }
 
   // Returns the object currently created in this thread or nullptr.
-  T *operator->() const {
-    return get();
-  }
+  T *operator->() const { return get(); }
   T *get() const {
     if (initialized) {
       return static_cast<T *>(static_cast<void *>(&storage));
diff --git a/aos/condition.cc b/aos/condition.cc
index e4276b6..1b0e855 100644
--- a/aos/condition.cc
+++ b/aos/condition.cc
@@ -1,8 +1,8 @@
 #include "aos/condition.h"
 
-#include <assert.h>
-#include <inttypes.h>
-#include <time.h>
+#include <cassert>
+#include <cinttypes>
+#include <ctime>
 
 #include "aos/mutex/mutex.h"
 #include "aos/type_traits/type_traits.h"
@@ -51,8 +51,6 @@
 
 void Condition::Signal() { condition_signal(&impl_, &m_->impl_); }
 
-void Condition::Broadcast() {
-  condition_broadcast(&impl_, &m_->impl_);
-}
+void Condition::Broadcast() { condition_broadcast(&impl_, &m_->impl_); }
 
 }  // namespace aos
diff --git a/aos/configuration.cc b/aos/configuration.cc
index 76704a4..7fad440 100644
--- a/aos/configuration.cc
+++ b/aos/configuration.cc
@@ -3,11 +3,11 @@
 #include <arpa/inet.h>
 #include <ifaddrs.h>
 #include <netinet/in.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <cstdlib>
+#include <cstring>
 #include <map>
 #include <set>
 #include <string>
diff --git a/aos/configuration.h b/aos/configuration.h
index f9b772d..8dd4851 100644
--- a/aos/configuration.h
+++ b/aos/configuration.h
@@ -1,11 +1,11 @@
 #ifndef AOS_CONFIGURATION_H_
 #define AOS_CONFIGURATION_H_
 
-#include <stdint.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
 
+#include <cstdint>
 #include <string_view>
 
 #include "aos/configuration_generated.h"  // IWYU pragma: export
diff --git a/aos/containers/resizeable_buffer.h b/aos/containers/resizeable_buffer.h
index b94f8cc..5eb955f 100644
--- a/aos/containers/resizeable_buffer.h
+++ b/aos/containers/resizeable_buffer.h
@@ -1,8 +1,7 @@
 #ifndef AOS_CONTAINERS_RESIZEABLE_BUFFER_H_
 #define AOS_CONTAINERS_RESIZEABLE_BUFFER_H_
 
-#include <stdlib.h>
-
+#include <cstdlib>
 #include <memory>
 
 #include "glog/logging.h"
diff --git a/aos/die.cc b/aos/die.cc
index ad5f2a8..d1d3d40 100644
--- a/aos/die.cc
+++ b/aos/die.cc
@@ -1,16 +1,16 @@
 #include "aos/die.h"
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <stdint.h>
 
-#include <string>
 #include <atomic>
+#include <cerrno>
+#include <csignal>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <string>
 
 namespace aos {
 
@@ -38,9 +38,10 @@
     free(filename);
     return r;
   } else {
-    fprintf(stderr, "aos fatal: asprintf(%p, \"thingie with %%jd\", %jd)"
-            " failed with %d\n", &filename,
-            static_cast<intmax_t>(getpid()), errno);
+    fprintf(stderr,
+            "aos fatal: asprintf(%p, \"thingie with %%jd\", %jd)"
+            " failed with %d\n",
+            &filename, static_cast<intmax_t>(getpid()), errno);
     return std::string();
   }
 #endif
@@ -78,8 +79,6 @@
   abort();
 }
 
-void SetDieTestMode(bool new_test_mode) {
-  test_mode.store(new_test_mode);
-}
+void SetDieTestMode(bool new_test_mode) { test_mode.store(new_test_mode); }
 
 }  // namespace aos
diff --git a/aos/die.h b/aos/die.h
index 4296881..592fc55 100644
--- a/aos/die.h
+++ b/aos/die.h
@@ -1,23 +1,20 @@
 #ifndef AOS_DIE_H_
 #define AOS_DIE_H_
 
-#include <stdarg.h>
+#include <cstdarg>
 
-#include "aos/macros.h"
 #include "aos/libc/aos_strerror.h"
+#include "aos/macros.h"
 
 namespace aos {
 
 // Terminates the task/process and logs a message (without using the logging
 // framework). Designed for use in code that can't use the logging framework
 // (code that can should LOG(FATAL), which calls this).
-void Die(const char *format, ...)
-    __attribute__((noreturn))
-    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 1, 2)));
-void VDie(const char *format, va_list args)
-    __attribute__((noreturn))
-    __attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 1, 0)));
-
+void Die(const char *format, ...) __attribute__((noreturn))
+__attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 1, 2)));
+void VDie(const char *format, va_list args) __attribute__((noreturn))
+__attribute__((format(GOOD_PRINTF_FORMAT_TYPE, 1, 0)));
 
 // The same as Die except appends " because of %d (%s)" (formatted with errno
 // and aos_strerror(errno)) to the message.
diff --git a/aos/dump_rtprio.cc b/aos/dump_rtprio.cc
index 006b348..5ab402f 100644
--- a/aos/dump_rtprio.cc
+++ b/aos/dump_rtprio.cc
@@ -7,13 +7,13 @@
 // exe,name,cpumask,policy,nice,priority,tid,pid,ppid,sid,cpu
 
 #include <sched.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <sys/resource.h>
 #include <sys/time.h>
 #include <unistd.h>
 
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
 #include <string>
 
 #include "aos/logging/implementations.h"
diff --git a/aos/events/event_loop_tmpl.h b/aos/events/event_loop_tmpl.h
index c509170..698191e 100644
--- a/aos/events/event_loop_tmpl.h
+++ b/aos/events/event_loop_tmpl.h
@@ -1,9 +1,8 @@
 #ifndef AOS_EVENTS_EVENT_LOOP_TMPL_H_
 #define AOS_EVENTS_EVENT_LOOP_TMPL_H_
 
-#include <inttypes.h>
-#include <stdint.h>
-
+#include <cinttypes>
+#include <cstdint>
 #include <type_traits>
 
 #include "aos/events/event_loop.h"
@@ -37,9 +36,8 @@
 
 template <typename Watch>
 void EventLoop::MakeWatcher(const std::string_view channel_name, Watch &&w) {
-  using MessageType =
-      typename event_loop_internal::watch_message_type_trait<decltype(
-          &Watch::operator())>::message_type;
+  using MessageType = typename event_loop_internal::watch_message_type_trait<
+      decltype(&Watch::operator())>::message_type;
   const Channel *channel = configuration::GetChannel(
       configuration_, channel_name, MessageType::GetFullyQualifiedName(),
       name(), node());
diff --git a/aos/events/logging/log_reader.cc b/aos/events/logging/log_reader.cc
index efcb40a..8a8f5af 100644
--- a/aos/events/logging/log_reader.cc
+++ b/aos/events/logging/log_reader.cc
@@ -1,11 +1,11 @@
 #include "aos/events/logging/log_reader.h"
 
 #include <fcntl.h>
-#include <limits.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/uio.h>
 
+#include <climits>
 #include <vector>
 
 #include "absl/strings/escaping.h"
@@ -45,7 +45,7 @@
 // want to re-implement it.
 void HandleMaps(const flatbuffers::Vector<flatbuffers::Offset<aos::Map>> *maps,
                 std::string *name, std::string_view type, const Node *node);
-}
+}  // namespace configuration
 namespace logger {
 namespace {
 
@@ -396,9 +396,9 @@
   // running until the last node.
 
   for (std::unique_ptr<State> &state : states_) {
-    VLOG(1) << "Start time is " << state->monotonic_start_time(0) << " for node "
-            << MaybeNodeName(state->event_loop()->node()) << "now "
-            << state->monotonic_now();
+    VLOG(1) << "Start time is " << state->monotonic_start_time(0)
+            << " for node " << MaybeNodeName(state->event_loop()->node())
+            << "now " << state->monotonic_now();
     if (state->monotonic_start_time(0) == monotonic_clock::min_time) {
       continue;
     }
@@ -459,9 +459,9 @@
       state->SetRealtimeOffset(state->monotonic_start_time(0),
                                state->realtime_start_time(0));
     }
-    VLOG(1) << "Start time is " << state->monotonic_start_time(0) << " for node "
-            << MaybeNodeName(state->event_loop()->node()) << "now "
-            << state->monotonic_now();
+    VLOG(1) << "Start time is " << state->monotonic_start_time(0)
+            << " for node " << MaybeNodeName(state->event_loop()->node())
+            << "now " << state->monotonic_now();
   }
 
   if (FLAGS_timestamps_to_csv) {
@@ -1188,7 +1188,8 @@
     } search;
 
     CHECK_EQ(timestamped_message.monotonic_remote_time.boot, 0u);
-    search.monotonic_event_time = timestamped_message.monotonic_remote_time.time;
+    search.monotonic_event_time =
+        timestamped_message.monotonic_remote_time.time;
     search.queue_index = timestamped_message.remote_queue_index;
 
     // Find the sent time if available.
diff --git a/aos/flatbuffer_merge.cc b/aos/flatbuffer_merge.cc
index da0eb86..18a190f 100644
--- a/aos/flatbuffer_merge.cc
+++ b/aos/flatbuffer_merge.cc
@@ -1,6 +1,6 @@
 #include "aos/flatbuffer_merge.h"
 
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/flatbuffer_utils.h"
 #include "flatbuffers/flatbuffers.h"
diff --git a/aos/ftrace.cc b/aos/ftrace.cc
index af4964c..f159a76 100644
--- a/aos/ftrace.cc
+++ b/aos/ftrace.cc
@@ -1,7 +1,7 @@
 #include "aos/ftrace.h"
 
-#include <stdarg.h>
-#include <stdio.h>
+#include <cstdarg>
+#include <cstdio>
 
 namespace aos {
 
diff --git a/aos/init.cc b/aos/init.cc
index b4036a3..3b298fa 100644
--- a/aos/init.cc
+++ b/aos/init.cc
@@ -1,14 +1,15 @@
 #include "aos/init.h"
 
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <errno.h>
 #include <sched.h>
+#include <sys/mman.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <stdlib.h>
+
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 
 #include "aos/realtime.h"
 #include "gflags/gflags.h"
diff --git a/aos/ipc_lib/aos_sync.cc b/aos/ipc_lib/aos_sync.cc
index 34d9489..39ea4c6 100644
--- a/aos/ipc_lib/aos_sync.cc
+++ b/aos/ipc_lib/aos_sync.cc
@@ -6,18 +6,19 @@
 #include "aos/ipc_lib/aos_sync.h"
 
 #include <linux/futex.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <errno.h>
-#include <stdint.h>
-#include <limits.h>
-#include <string.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <stddef.h>
-#include <assert.h>
 #include <pthread.h>
 #include <sched.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <cassert>
+#include <cerrno>
+#include <cinttypes>
+#include <climits>
+#include <cstddef>
+#include <cstdint>
+#include <cstring>
 
 #ifdef AOS_SANITIZER_thread
 #include <sanitizer/tsan_interface_atomic.h>
@@ -27,16 +28,16 @@
 #include <type_traits>
 
 #include "absl/base/call_once.h"
-#include "glog/logging.h"
-
 #include "aos/macros.h"
 #include "aos/thread_local.h"
 #include "aos/util/compiler_memory_barrier.h"
+#include "glog/logging.h"
 
 using ::aos::linux_code::ipc_lib::FutexAccessorObserver;
 
-// This code was originally based on <https://www.akkadia.org/drepper/futex.pdf>,
-// but is has since evolved a lot. However, that still has useful information.
+// This code was originally based on
+// <https://www.akkadia.org/drepper/futex.pdf>, but is has since evolved a lot.
+// However, that still has useful information.
 //
 // Finding information about actually using futexes is really REALLY hard, so
 //   here's a list of the stuff that I've used:
@@ -171,7 +172,8 @@
 }
 
 inline int sys_futex_cmp_requeue_pi(aos_futex *addr1, int num_wake,
-    int num_requeue, aos_futex *m, uint32_t val) {
+                                    int num_requeue, aos_futex *m,
+                                    uint32_t val) {
 #if ARM_EABI_INLINE_SYSCALL
   register aos_futex *addr1_reg __asm__("r0") = addr1;
   register int op_reg __asm__("r1") = FUTEX_CMP_REQUEUE_PI;
@@ -196,8 +198,7 @@
 #endif
 }
 
-inline int sys_futex_wait_requeue_pi(aos_condition *addr1,
-                                     uint32_t start_val,
+inline int sys_futex_wait_requeue_pi(aos_condition *addr1, uint32_t start_val,
                                      const struct timespec *timeout,
                                      aos_futex *m) {
 #if ARM_EABI_INLINE_SYSCALL
@@ -463,8 +464,8 @@
     // We don't offset the head pointer, so be careful.
     return reinterpret_cast<aos_mutex *>(next);
   }
-  return reinterpret_cast<aos_mutex *>(
-      (next & ~kRobustListOr) - robust_list_offset);
+  return reinterpret_cast<aos_mutex *>((next & ~kRobustListOr) -
+                                       robust_list_offset);
 }
 
 // Sets up the robust list for each thread.
@@ -758,15 +759,11 @@
 
 }  // namespace
 
-int mutex_lock(aos_mutex *m) {
-  return mutex_get(m, true, NULL);
-}
+int mutex_lock(aos_mutex *m) { return mutex_get(m, true, NULL); }
 int mutex_lock_timeout(aos_mutex *m, const struct timespec *timeout) {
   return mutex_get(m, true, timeout);
 }
-int mutex_grab(aos_mutex *m) {
-  return mutex_get(m, false, NULL);
-}
+int mutex_grab(aos_mutex *m) { return mutex_get(m, false, NULL); }
 
 void mutex_unlock(aos_mutex *m) {
   RunObservers run_observers(m, true);
@@ -887,7 +884,7 @@
   if (ret != 0) {
     my_robust_list::robust_head.pending_next = 0;
     errno = -ret;
-    PLOG(FATAL)  << "FUTEX_UNLOCK_PI(" << &m->futex << ") failed";
+    PLOG(FATAL) << "FUTEX_UNLOCK_PI(" << &m->futex << ") failed";
   }
 }
 
@@ -1005,9 +1002,7 @@
   }
 }
 
-int futex_set(aos_futex *m) {
-  return futex_set_value(m, 1);
-}
+int futex_set(aos_futex *m) { return futex_set_value(m, 1); }
 
 int futex_unset(aos_futex *m) {
   return !__atomic_exchange_n(m, 0, __ATOMIC_SEQ_CST);
@@ -1036,9 +1031,7 @@
 
 // Returns true iff there are any mutexes locked by the current thread.
 // This is mainly useful for testing.
-bool HaveLockedMutexes() {
-  return my_robust_list::HaveLockedMutexes();
-}
+bool HaveLockedMutexes() { return my_robust_list::HaveLockedMutexes(); }
 
 }  // namespace ipc_lib
 }  // namespace linux_code
diff --git a/aos/ipc_lib/ipc_comparison.cc b/aos/ipc_lib/ipc_comparison.cc
index af1098d..fd1ff93 100644
--- a/aos/ipc_lib/ipc_comparison.cc
+++ b/aos/ipc_lib/ipc_comparison.cc
@@ -4,7 +4,6 @@
 #include <netinet/tcp.h>
 #include <pthread.h>
 #include <semaphore.h>
-#include <stdint.h>
 #include <sys/eventfd.h>
 #include <sys/msg.h>
 #include <sys/sem.h>
@@ -15,6 +14,7 @@
 
 #include <atomic>
 #include <chrono>
+#include <cstdint>
 #include <memory>
 #include <string>
 #include <thread>
diff --git a/aos/ipc_lib/ipc_stress_test.cc b/aos/ipc_lib/ipc_stress_test.cc
index aa5d9c5..5e72b6e 100644
--- a/aos/ipc_lib/ipc_stress_test.cc
+++ b/aos/ipc_lib/ipc_stress_test.cc
@@ -1,23 +1,23 @@
-#include <errno.h>
 #include <libgen.h>
-#include <stdio.h>
-#include <string.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
 
+#include <cerrno>
 #include <chrono>
+#include <cstdio>
+#include <cstring>
 #include <string>
 
 #include "aos/die.h"
+#include "aos/ipc_lib/core_lib.h"
 #include "aos/libc/aos_strsignal.h"
 #include "aos/libc/dirname.h"
 #include "aos/logging/logging.h"
 #include "aos/mutex/mutex.h"
+#include "aos/testing/test_shm.h"
 #include "aos/time/time.h"
 #include "aos/type_traits/type_traits.h"
-#include "aos/ipc_lib/core_lib.h"
-#include "aos/testing/test_shm.h"
 
 // This runs all of the IPC-related tests in a bunch of parallel processes for a
 // while and makes sure that they don't fail. It also captures the stdout and
@@ -42,17 +42,17 @@
 // Using --gtest_filter is a bad idea because it seems to result in a lot of
 // swapping which causes everything to be disk-bound (at least for me).
 static const size_t kTestMaxArgs = 10;
-static const char * kTests[][kTestMaxArgs] = {
-  {"queue_test"},
-  {"condition_test"},
-  {"mutex_test"},
-  {"raw_queue_test"},
+static const char *kTests[][kTestMaxArgs] = {
+    {"queue_test"},
+    {"condition_test"},
+    {"mutex_test"},
+    {"raw_queue_test"},
 };
 static const size_t kTestsLength = sizeof(kTests) / sizeof(kTests[0]);
 // These arguments get inserted before any per-test arguments.
 static const char *kDefaultArgs[] = {
-  "--gtest_repeat=30",
-  "--gtest_shuffle",
+    "--gtest_repeat=30",
+    "--gtest_shuffle",
 };
 
 // How many test processes to run at a time.
@@ -64,7 +64,7 @@
 // the child processes.
 struct Shared {
   Shared(const monotonic_clock::time_point stop_time)
-    : stop_time(stop_time), total_iterations(0) {}
+      : stop_time(stop_time), total_iterations(0) {}
 
   // Synchronizes access to stdout/stderr to avoid interleaving failure
   // messages.
@@ -84,8 +84,8 @@
               "it's going to get shared between forked processes");
 
 // Gets called after each child forks to run a test.
-void __attribute__((noreturn)) DoRunTest(
-    Shared *shared, const char *(*test)[kTestMaxArgs], int pipes[2]) {
+void __attribute__((noreturn))
+DoRunTest(Shared *shared, const char *(*test)[kTestMaxArgs], int pipes[2]) {
   if (close(pipes[0]) == -1) {
     PDie("close(%d) of read end of pipe failed", pipes[0]);
   }
@@ -173,15 +173,15 @@
     if (WIFEXITED(status)) {
       if (WEXITSTATUS(status) != 0) {
         MutexLocker sync(&shared->output_mutex);
-        fprintf(stderr, "Test %s exited with status %d. output:\n",
-                (*test)[0], WEXITSTATUS(status));
+        fprintf(stderr, "Test %s exited with status %d. output:\n", (*test)[0],
+                WEXITSTATUS(status));
         fputs(output.c_str(), stderr);
       }
     } else if (WIFSIGNALED(status)) {
       MutexLocker sync(&shared->output_mutex);
       fprintf(stderr, "Test %s terminated by signal %d: %s.\n", (*test)[0],
               WTERMSIG(status), aos_strsignal(WTERMSIG(status)));
-        fputs(output.c_str(), stderr);
+      fputs(output.c_str(), stderr);
     } else {
       CHECK(WIFSTOPPED(status));
       Die("Test %s was stopped.\n", (*test)[0]);
@@ -218,8 +218,8 @@
   Shared *shared = static_cast<Shared *>(shm_malloc(sizeof(Shared)));
   new (shared) Shared(monotonic_clock::now() + kTestTime);
 
-  if (asprintf(const_cast<char **>(&shared->path),
-               "%s/../tests", ::aos::libc::Dirname(argv[0]).c_str()) == -1) {
+  if (asprintf(const_cast<char **>(&shared->path), "%s/../tests",
+               ::aos::libc::Dirname(argv[0]).c_str()) == -1) {
     PDie("asprintf failed");
   }
 
@@ -251,6 +251,4 @@
 
 }  // namespace aos
 
-int main(int argc, char **argv) {
-  return ::aos::Main(argc, argv);
-}
+int main(int argc, char **argv) { return ::aos::Main(argc, argv); }
diff --git a/aos/ipc_lib/lockless_queue.h b/aos/ipc_lib/lockless_queue.h
index b0fc425..d6fb72f 100644
--- a/aos/ipc_lib/lockless_queue.h
+++ b/aos/ipc_lib/lockless_queue.h
@@ -1,14 +1,14 @@
 #ifndef AOS_IPC_LIB_LOCKLESS_QUEUE_H_
 #define AOS_IPC_LIB_LOCKLESS_QUEUE_H_
 
-#include <signal.h>
 #include <sys/signalfd.h>
 #include <sys/types.h>
+
+#include <csignal>
 #include <optional>
 #include <vector>
 
 #include "absl/types/span.h"
-
 #include "aos/ipc_lib/aos_sync.h"
 #include "aos/ipc_lib/data_alignment.h"
 #include "aos/ipc_lib/index.h"
diff --git a/aos/ipc_lib/lockless_queue_death_test.cc b/aos/ipc_lib/lockless_queue_death_test.cc
index ae780b8..3ed2ce5 100644
--- a/aos/ipc_lib/lockless_queue_death_test.cc
+++ b/aos/ipc_lib/lockless_queue_death_test.cc
@@ -1,18 +1,18 @@
-#include "aos/ipc_lib/lockless_queue.h"
-
 #include <dlfcn.h>
-#include <inttypes.h>
 #include <linux/futex.h>
 #include <sys/mman.h>
 #include <sys/syscall.h>
 #include <unistd.h>
 #include <wait.h>
+
 #include <chrono>
+#include <cinttypes>
 #include <functional>
 #include <memory>
 #include <thread>
 
 #include "aos/ipc_lib/aos_sync.h"
+#include "aos/ipc_lib/lockless_queue.h"
 #include "aos/ipc_lib/lockless_queue_memory.h"
 #include "aos/libc/aos_strsignal.h"
 #include "aos/realtime.h"
diff --git a/aos/ipc_lib/lockless_queue_test.cc b/aos/ipc_lib/lockless_queue_test.cc
index 57867e4..2b9f49c 100644
--- a/aos/ipc_lib/lockless_queue_test.cc
+++ b/aos/ipc_lib/lockless_queue_test.cc
@@ -1,11 +1,11 @@
 #include "aos/ipc_lib/lockless_queue.h"
 
-#include <inttypes.h>
-#include <signal.h>
 #include <unistd.h>
 #include <wait.h>
 
 #include <chrono>
+#include <cinttypes>
+#include <csignal>
 #include <memory>
 #include <random>
 #include <thread>
diff --git a/aos/ipc_lib/queue_racer.cc b/aos/ipc_lib/queue_racer.cc
index d14a638..b738805 100644
--- a/aos/ipc_lib/queue_racer.cc
+++ b/aos/ipc_lib/queue_racer.cc
@@ -1,8 +1,7 @@
 #include "aos/ipc_lib/queue_racer.h"
 
-#include <inttypes.h>
-#include <string.h>
-
+#include <cinttypes>
+#include <cstring>
 #include <limits>
 
 #include "aos/ipc_lib/event.h"
diff --git a/aos/ipc_lib/queue_racer.h b/aos/ipc_lib/queue_racer.h
index 7e92693..ea0238e 100644
--- a/aos/ipc_lib/queue_racer.h
+++ b/aos/ipc_lib/queue_racer.h
@@ -1,7 +1,7 @@
 #ifndef AOS_IPC_LIB_QUEUE_RACER_H_
 #define AOS_IPC_LIB_QUEUE_RACER_H_
 
-#include <string.h>
+#include <cstring>
 
 #include "aos/ipc_lib/lockless_queue.h"
 
diff --git a/aos/ipc_lib/shared_mem.cc b/aos/ipc_lib/shared_mem.cc
index 461e254..c91bbe9 100644
--- a/aos/ipc_lib/shared_mem.cc
+++ b/aos/ipc_lib/shared_mem.cc
@@ -1,14 +1,15 @@
 #include "aos/ipc_lib/shared_mem.h"
 
-#include <stdio.h>
-#include <string.h>
-#include <sys/mman.h>
 #include <fcntl.h>
-#include <unistd.h>
+#include <sys/mman.h>
 #include <sys/types.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <assert.h>
+#include <unistd.h>
+
+#include <cassert>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 
 #include "aos/ipc_lib/aos_sync.h"
 #include "aos/ipc_lib/core_lib.h"
@@ -21,7 +22,7 @@
 #define SIZEOFSHMSEG (4096 * 0x800)
 
 void init_shared_mem_core(aos_shm_core *shm_core) {
-  memset(&shm_core->time_offset, 0 , sizeof(shm_core->time_offset));
+  memset(&shm_core->time_offset, 0, sizeof(shm_core->time_offset));
   memset(&shm_core->msg_alloc_lock, 0, sizeof(shm_core->msg_alloc_lock));
   shm_core->queues.pointer = NULL;
   memset(&shm_core->queues.lock, 0, sizeof(shm_core->queues.lock));
@@ -30,9 +31,8 @@
 }
 
 ptrdiff_t aos_core_get_mem_usage(void) {
-  return global_core->size -
-      ((ptrdiff_t)global_core->mem_struct->msg_alloc -
-       (ptrdiff_t)global_core->mem_struct);
+  return global_core->size - ((ptrdiff_t)global_core->mem_struct->msg_alloc -
+                              (ptrdiff_t)global_core->mem_struct);
 }
 
 struct aos_core *global_core = NULL;
diff --git a/aos/ipc_lib/signal_stress.cc b/aos/ipc_lib/signal_stress.cc
index 2f2ca41..57a4158 100644
--- a/aos/ipc_lib/signal_stress.cc
+++ b/aos/ipc_lib/signal_stress.cc
@@ -1,8 +1,7 @@
-#include "gflags/gflags.h"
-
-#include <signal.h>
 #include <sys/signalfd.h>
+
 #include <chrono>
+#include <csignal>
 #include <random>
 #include <thread>
 
@@ -13,6 +12,7 @@
 #include "aos/logging/logging.h"
 #include "aos/realtime.h"
 #include "aos/time/time.h"
+#include "gflags/gflags.h"
 
 // This is a demo program which uses Real-Time posix signals to communicate.
 // It measures both latency of a random timer thread, and latency of the
diff --git a/aos/ipc_lib/signalfd.cc b/aos/ipc_lib/signalfd.cc
index 3689b7e..f23d0be 100644
--- a/aos/ipc_lib/signalfd.cc
+++ b/aos/ipc_lib/signalfd.cc
@@ -1,7 +1,8 @@
 #include "aos/ipc_lib/signalfd.h"
 
-#include <signal.h>
 #include <sys/types.h>
+
+#include <csignal>
 #if __has_feature(memory_sanitizer)
 #include <sanitizer/msan_interface.h>
 #endif
diff --git a/aos/json_to_flatbuffer.cc b/aos/json_to_flatbuffer.cc
index f64991d..11ea3a2 100644
--- a/aos/json_to_flatbuffer.cc
+++ b/aos/json_to_flatbuffer.cc
@@ -1,6 +1,7 @@
 #include "aos/json_to_flatbuffer.h"
 
 #include <cstddef>
+#include <cstdio>
 #include <string_view>
 
 #include "aos/flatbuffer_utils.h"
@@ -8,7 +9,6 @@
 #include "flatbuffers/flatbuffers.h"
 #include "flatbuffers/minireflect.h"
 #include "glog/logging.h"
-#include "stdio.h"
 
 // TODO(austin): Can we just do an Offset<void> ?  It doesn't matter, so maybe
 // just say that.
diff --git a/aos/libc/aos_strerror.cc b/aos/libc/aos_strerror.cc
index b045f24..8c087a8 100644
--- a/aos/libc/aos_strerror.cc
+++ b/aos/libc/aos_strerror.cc
@@ -1,10 +1,11 @@
 #include "aos/libc/aos_strerror.h"
 
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
 #include <sys/types.h>
 
+#include <cassert>
+#include <cstdio>
+#include <cstring>
+
 #include "aos/thread_local.h"
 
 // This code uses an overloaded function to handle the result from either
diff --git a/aos/libc/aos_strerror_test.cc b/aos/libc/aos_strerror_test.cc
index 65781bc..abd867e 100644
--- a/aos/libc/aos_strerror_test.cc
+++ b/aos/libc/aos_strerror_test.cc
@@ -1,6 +1,6 @@
 #include "aos/libc/aos_strerror.h"
 
-#include <errno.h>
+#include <cerrno>
 
 #include "gtest/gtest.h"
 
diff --git a/aos/libc/aos_strsignal.cc b/aos/libc/aos_strsignal.cc
index 91c2211..0f9b065 100644
--- a/aos/libc/aos_strsignal.cc
+++ b/aos/libc/aos_strsignal.cc
@@ -1,10 +1,9 @@
 #include "aos/libc/aos_strsignal.h"
 
-#include <signal.h>
-
-#include "glog/logging.h"
+#include <csignal>
 
 #include "aos/thread_local.h"
+#include "glog/logging.h"
 
 const char *aos_strsignal(int signal) {
   AOS_THREAD_LOCAL char buffer[512];
diff --git a/aos/libc/aos_strsignal_test.cc b/aos/libc/aos_strsignal_test.cc
index 7520985..51389af 100644
--- a/aos/libc/aos_strsignal_test.cc
+++ b/aos/libc/aos_strsignal_test.cc
@@ -1,6 +1,6 @@
 #include "aos/libc/aos_strsignal.h"
 
-#include <signal.h>
+#include <csignal>
 #include <thread>
 
 #include "gtest/gtest.h"
diff --git a/aos/logging/context.cc b/aos/logging/context.cc
index 0aa3e71..b0fd32e 100644
--- a/aos/logging/context.cc
+++ b/aos/logging/context.cc
@@ -7,23 +7,22 @@
 #if __has_feature(memory_sanitizer)
 #include <sanitizer/msan_interface.h>
 #endif
-#include <string.h>
 #include <sys/prctl.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <errno.h>
 
+#include <cerrno>
+#include <cstring>
 #include <string>
 
 extern char *program_invocation_name;
 extern char *program_invocation_short_name;
 
-#include "glog/logging.h"
-
 #include "aos/complex_thread_local.h"
 #include "aos/die.h"
 #include "aos/logging/implementations.h"
 #include "aos/thread_local.h"
+#include "glog/logging.h"
 
 namespace aos {
 namespace logging {
diff --git a/aos/logging/context.h b/aos/logging/context.h
index cc770ba..25a7233 100644
--- a/aos/logging/context.h
+++ b/aos/logging/context.h
@@ -1,13 +1,13 @@
 #ifndef AOS_LOGGING_CONTEXT_H_
 #define AOS_LOGGING_CONTEXT_H_
 
-#include <inttypes.h>
-#include <limits.h>
-#include <stddef.h>
 #include <sys/types.h>
-#include <memory>
 
 #include <atomic>
+#include <cinttypes>
+#include <climits>
+#include <cstddef>
+#include <memory>
 
 #include "aos/logging/sizes.h"
 
diff --git a/aos/logging/implementations.cc b/aos/logging/implementations.cc
index be54eec..96d00f9 100644
--- a/aos/logging/implementations.cc
+++ b/aos/logging/implementations.cc
@@ -1,10 +1,9 @@
 #include "aos/logging/implementations.h"
 
-#include <inttypes.h>
-#include <stdarg.h>
-
 #include <algorithm>
 #include <chrono>
+#include <cinttypes>
+#include <cstdarg>
 
 #include "aos/logging/printf_formats.h"
 #include "aos/time/time.h"
diff --git a/aos/logging/implementations.h b/aos/logging/implementations.h
index bcce421..de1a8dd 100644
--- a/aos/logging/implementations.h
+++ b/aos/logging/implementations.h
@@ -1,15 +1,15 @@
 #ifndef AOS_LOGGING_IMPLEMENTATIONS_H_
 #define AOS_LOGGING_IMPLEMENTATIONS_H_
 
-#include <limits.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 
 #include <atomic>
+#include <climits>
+#include <cstdarg>
+#include <cstdint>
+#include <cstdio>
+#include <cstring>
 #include <functional>
 #include <memory>
 #include <string>
diff --git a/aos/logging/implementations_test.cc b/aos/logging/implementations_test.cc
index 6b85358..1bbfacf 100644
--- a/aos/logging/implementations_test.cc
+++ b/aos/logging/implementations_test.cc
@@ -1,13 +1,11 @@
 #include "aos/logging/implementations.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <string>
 
 #include "aos/logging/printf_formats.h"
 #include "aos/time/time.h"
-
 #include "glog/logging.h"
 #include "gtest/gtest.h"
 
diff --git a/aos/logging/interface.cc b/aos/logging/interface.cc
index 0cb0cd8..39492ad 100644
--- a/aos/logging/interface.cc
+++ b/aos/logging/interface.cc
@@ -1,9 +1,8 @@
 #include "aos/logging/interface.h"
 
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
+#include <cstdarg>
+#include <cstdio>
+#include <cstring>
 #include <functional>
 #include <type_traits>
 
diff --git a/aos/logging/interface.h b/aos/logging/interface.h
index 387e55d..f6fa249 100644
--- a/aos/logging/interface.h
+++ b/aos/logging/interface.h
@@ -1,8 +1,7 @@
 #ifndef AOS_LOGGING_INTERFACE_H_
 #define AOS_LOGGING_INTERFACE_H_
 
-#include <stdarg.h>
-
+#include <cstdarg>
 #include <functional>
 #include <string>
 
diff --git a/aos/logging/log_namer.cc b/aos/logging/log_namer.cc
index c1dd30a..707fd08 100644
--- a/aos/logging/log_namer.cc
+++ b/aos/logging/log_namer.cc
@@ -1,16 +1,17 @@
 #include "aos/logging/log_namer.h"
 
 #include <dirent.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <mntent.h>
 #include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/types.h>
-#include <time.h>
 #include <unistd.h>
+
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
 #include <string>
 
 #include "aos/configuration.h"
diff --git a/aos/mutex/mutex.cc b/aos/mutex/mutex.cc
index ef4fbbe..18d233d 100644
--- a/aos/mutex/mutex.cc
+++ b/aos/mutex/mutex.cc
@@ -1,8 +1,8 @@
 #include "aos/mutex/mutex.h"
 
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
+#include <cinttypes>
+#include <cstdio>
+#include <cstring>
 
 #include "aos/type_traits/type_traits.h"
 #include "glog/logging.h"
@@ -24,9 +24,7 @@
   }
 }
 
-void Mutex::Unlock() {
-  mutex_unlock(&impl_);
-}
+void Mutex::Unlock() { mutex_unlock(&impl_); }
 
 Mutex::State Mutex::TryLock() {
   const int ret = mutex_trylock(&impl_);
@@ -43,8 +41,6 @@
   }
 }
 
-bool Mutex::OwnedBySelf() const {
-  return mutex_islocked(&impl_);
-}
+bool Mutex::OwnedBySelf() const { return mutex_islocked(&impl_); }
 
 }  // namespace aos
diff --git a/aos/mutex/mutex_test.cc b/aos/mutex/mutex_test.cc
index c0ec66e..bd8a548 100644
--- a/aos/mutex/mutex_test.cc
+++ b/aos/mutex/mutex_test.cc
@@ -1,14 +1,12 @@
 #include "aos/mutex/mutex.h"
 
-#include <math.h>
 #include <pthread.h>
 #include <sched.h>
 
 #include <chrono>
+#include <cmath>
 #include <thread>
 
-#include "gtest/gtest.h"
-
 #include "aos/die.h"
 #include "aos/ipc_lib/aos_sync.h"
 #include "aos/ipc_lib/core_lib.h"
@@ -16,6 +14,7 @@
 #include "aos/testing/test_shm.h"
 #include "aos/time/time.h"
 #include "aos/util/death_test_log_implementation.h"
+#include "gtest/gtest.h"
 
 namespace aos {
 namespace testing {
diff --git a/aos/network/sctp_client.cc b/aos/network/sctp_client.cc
index 7d86316..9e77a84 100644
--- a/aos/network/sctp_client.cc
+++ b/aos/network/sctp_client.cc
@@ -3,9 +3,10 @@
 #include <arpa/inet.h>
 #include <net/if.h>
 #include <netinet/sctp.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/socket.h>
+
+#include <cstdlib>
+#include <cstring>
 #include <string_view>
 
 #include "aos/network/sctp_lib.h"
diff --git a/aos/network/sctp_client.h b/aos/network/sctp_client.h
index 6b84638..806026c 100644
--- a/aos/network/sctp_client.h
+++ b/aos/network/sctp_client.h
@@ -1,8 +1,8 @@
 #ifndef AOS_NETWORK_SCTP_CLIENT_H_
 #define AOS_NETWORK_SCTP_CLIENT_H_
 
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
 #include <string_view>
 
 #include "aos/network/sctp_lib.h"
diff --git a/aos/network/sctp_server.cc b/aos/network/sctp_server.cc
index 537f3ab..47a5719 100644
--- a/aos/network/sctp_server.cc
+++ b/aos/network/sctp_server.cc
@@ -5,10 +5,11 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #include <netinet/sctp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/socket.h>
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 #include <memory>
 #include <thread>
 
diff --git a/aos/network/sctp_server.h b/aos/network/sctp_server.h
index e18517a..d995c55 100644
--- a/aos/network/sctp_server.h
+++ b/aos/network/sctp_server.h
@@ -6,12 +6,13 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #include <netinet/sctp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <memory>
 #include <sys/socket.h>
 
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <memory>
+
 #include "aos/network/sctp_lib.h"
 #include "aos/unique_malloc_ptr.h"
 #include "glog/logging.h"
@@ -73,7 +74,6 @@
   int ppid_ = 1;
 };
 
-
 }  // namespace message_bridge
 }  // namespace aos
 
diff --git a/aos/network/team_number.cc b/aos/network/team_number.cc
index 0bd0cf7..8885b52 100644
--- a/aos/network/team_number.cc
+++ b/aos/network/team_number.cc
@@ -1,10 +1,11 @@
 #include "aos/network/team_number.h"
 
-#include <inttypes.h>
 #include <netinet/in.h>
-#include <stdlib.h>
 #include <unistd.h>
 
+#include <cinttypes>
+#include <cstdlib>
+
 #include "absl/strings/numbers.h"
 
 DEFINE_string(
diff --git a/aos/network/team_number.h b/aos/network/team_number.h
index 8effc27..b794309 100644
--- a/aos/network/team_number.h
+++ b/aos/network/team_number.h
@@ -1,8 +1,7 @@
 #ifndef AOS_NETWORK_TEAM_NUMBER_H_
 #define AOS_NETWORK_TEAM_NUMBER_H_
 
-#include <stdint.h>
-
+#include <cstdint>
 #include <optional>
 #include <string_view>
 
diff --git a/aos/network/timestamp_filter.h b/aos/network/timestamp_filter.h
index 73c9006..7ef32f4 100644
--- a/aos/network/timestamp_filter.h
+++ b/aos/network/timestamp_filter.h
@@ -1,10 +1,10 @@
 #ifndef AOS_EVENTS_LOGGING_TIMESTAMP_FILTER_H_
 #define AOS_EVENTS_LOGGING_TIMESTAMP_FILTER_H_
 
-#include <stdio.h>
 #include <algorithm>
 #include <chrono>
 #include <cmath>
+#include <cstdio>
 #include <deque>
 
 #include "aos/configuration.h"
diff --git a/aos/print_field_helpers.h b/aos/print_field_helpers.h
index 933ce46..fdfd1c6 100644
--- a/aos/print_field_helpers.h
+++ b/aos/print_field_helpers.h
@@ -1,13 +1,12 @@
 #ifndef AOS_PRINT_FIELD_HELPERS_H_
 #define AOS_PRINT_FIELD_HELPERS_H_
 
-#include <stdint.h>
-
+#include <cstdint>
 #include <type_traits>
 
 namespace aos {
 
-template<typename T>
+template <typename T>
 inline bool PrintInteger(char *buf, T val, size_t *output) {
   static const bool is_signed = ::std::is_signed<T>::value;
   const bool is_negative =
diff --git a/aos/realtime.cc b/aos/realtime.cc
index e277803..cd9ea43 100644
--- a/aos/realtime.cc
+++ b/aos/realtime.cc
@@ -1,18 +1,19 @@
 #include "aos/realtime.h"
 
-#include <errno.h>
 #include <malloc.h>
 #include <sched.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/mman.h>
 #include <sys/prctl.h>
 #include <sys/resource.h>
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <cerrno>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
 #include "aos/thread_local.h"
 #include "glog/logging.h"
 #include "glog/raw_logging.h"
@@ -27,14 +28,15 @@
             "If true, skip locking memory.  Pretend that we did it instead.");
 
 extern "C" {
-typedef void (*MallocHook_NewHook)(const void* ptr, size_t size);
+typedef void (*MallocHook_NewHook)(const void *ptr, size_t size);
 int MallocHook_AddNewHook(MallocHook_NewHook hook) __attribute__((weak));
 int MallocHook_RemoveNewHook(MallocHook_NewHook hook) __attribute__((weak));
 
-typedef void (*MallocHook_DeleteHook)(const void* ptr);
+typedef void (*MallocHook_DeleteHook)(const void *ptr);
 int MallocHook_AddDeleteHook(MallocHook_DeleteHook hook) __attribute__((weak));
-int MallocHook_RemoveDeleteHook(MallocHook_DeleteHook hook) __attribute__((weak));
-}   // extern "C"
+int MallocHook_RemoveDeleteHook(MallocHook_DeleteHook hook)
+    __attribute__((weak));
+}  // extern "C"
 
 namespace FLAG__namespace_do_not_use_directly_use_DECLARE_double_instead {
 extern double FLAGS_tcmalloc_release_rate __attribute__((weak));
@@ -210,7 +212,7 @@
 // Bool to track if malloc hooks have failed to be configured.
 bool has_malloc_hook = true;
 AOS_THREAD_LOCAL bool is_realtime = false;
-}
+}  // namespace
 
 bool MarkRealtime(bool realtime) {
   if (realtime) {
diff --git a/aos/starter/starter_test.cc b/aos/starter/starter_test.cc
index fafeb77..dea27e9 100644
--- a/aos/starter/starter_test.cc
+++ b/aos/starter/starter_test.cc
@@ -1,5 +1,4 @@
-#include <signal.h>
-
+#include <csignal>
 #include <future>
 #include <thread>
 
diff --git a/aos/starter/starterd_lib.h b/aos/starter/starterd_lib.h
index 36109a9..38a11d6 100644
--- a/aos/starter/starterd_lib.h
+++ b/aos/starter/starterd_lib.h
@@ -1,11 +1,11 @@
 #ifndef AOS_STARTER_STARTERD_LIB_H_
 #define AOS_STARTER_STARTERD_LIB_H_
 
-#include <signal.h>
-#include <stdio.h>
 #include <sys/signalfd.h>
 #include <sys/wait.h>
 
+#include <csignal>
+#include <cstdio>
 #include <string>
 #include <unordered_map>
 #include <vector>
diff --git a/aos/testing/prevent_exit.cc b/aos/testing/prevent_exit.cc
index 8624c93..b640fe7 100644
--- a/aos/testing/prevent_exit.cc
+++ b/aos/testing/prevent_exit.cc
@@ -1,23 +1,20 @@
 #include "aos/testing/prevent_exit.h"
 
-#include <stdlib.h>
 #include <unistd.h>
 
+#include <cstdlib>
+
 #include "glog/logging.h"
 
 namespace aos {
 namespace testing {
 namespace {
 
-void TerminateExitHandler() {
-  _exit(EXIT_SUCCESS);
-}
+void TerminateExitHandler() { _exit(EXIT_SUCCESS); }
 
 }  // namespace
 
-void PreventExit() {
-  CHECK_EQ(atexit(TerminateExitHandler), 0);
-}
+void PreventExit() { CHECK_EQ(atexit(TerminateExitHandler), 0); }
 
 }  // namespace testing
 }  // namespace aos
diff --git a/aos/testing/random_seed.cc b/aos/testing/random_seed.cc
index 9e7136f..8f26d07 100644
--- a/aos/testing/random_seed.cc
+++ b/aos/testing/random_seed.cc
@@ -1,6 +1,6 @@
 #include "aos/testing/random_seed.h"
 
-#include <stdlib.h>
+#include <cstdlib>
 
 namespace aos {
 namespace testing {
diff --git a/aos/testing/test_logging.cc b/aos/testing/test_logging.cc
index 74e5790..d0cea26 100644
--- a/aos/testing/test_logging.cc
+++ b/aos/testing/test_logging.cc
@@ -1,16 +1,13 @@
 #include "aos/testing/test_logging.h"
 
-#include <stdio.h>
-
+#include <cstdio>
 #include <vector>
 
-#include "gtest/gtest.h"
-
 #include "absl/base/call_once.h"
-
 #include "aos/logging/implementations.h"
 #include "aos/stl_mutex/stl_mutex.h"
 #include "aos/thread_local.h"
+#include "gtest/gtest.h"
 
 using ::aos::logging::LogMessage;
 
diff --git a/aos/time/time.cc b/aos/time/time.cc
index 89f1c4d..697770c 100644
--- a/aos/time/time.cc
+++ b/aos/time/time.cc
@@ -1,10 +1,9 @@
 #include "aos/time/time.h"
 
-#include <inttypes.h>
-#include <string.h>
-
 #include <algorithm>
 #include <chrono>
+#include <cinttypes>
+#include <cstring>
 #include <ctime>
 #include <iomanip>
 
diff --git a/aos/time/time.h b/aos/time/time.h
index 36c7ad2..37ff3a8 100644
--- a/aos/time/time.h
+++ b/aos/time/time.h
@@ -1,11 +1,11 @@
 #ifndef AOS_TIME_H_
 #define AOS_TIME_H_
 
-#include <stdint.h>
 #include <sys/time.h>
-#include <time.h>
 
 #include <chrono>
+#include <cstdint>
+#include <ctime>
 #include <optional>
 #include <ostream>
 #include <thread>
diff --git a/aos/util/bitpacking.h b/aos/util/bitpacking.h
index df6ad16..f6d1e4e 100644
--- a/aos/util/bitpacking.h
+++ b/aos/util/bitpacking.h
@@ -1,8 +1,7 @@
 #ifndef AOS_UTIL_BITPACKING_H_
 #define AOS_UTIL_BITPACKING_H_
 
-#include <assert.h>
-
+#include <cassert>
 #include <type_traits>
 
 #include "third_party/GSL/include/gsl/gsl"
@@ -68,7 +67,8 @@
 
 template <typename Integer, size_t bits, size_t offset>
 typename std::enable_if<std::is_unsigned<Integer>::value &&
-                        sizeof(Integer) * 8 >= bits, Integer>::type
+                            sizeof(Integer) * 8 >= bits,
+                        Integer>::type
 UnpackBits(const gsl::span<const char> source) {
   Integer result = 0;
   assert(static_cast<size_t>(source.size()) * 8u >= bits + offset);
diff --git a/aos/util/bitpacking_test.cc b/aos/util/bitpacking_test.cc
index 013e911..584804b 100644
--- a/aos/util/bitpacking_test.cc
+++ b/aos/util/bitpacking_test.cc
@@ -1,6 +1,6 @@
 #include "aos/util/bitpacking.h"
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "gtest/gtest.h"
 
diff --git a/aos/util/death_test_log_implementation.h b/aos/util/death_test_log_implementation.h
index f061c61..7065141 100644
--- a/aos/util/death_test_log_implementation.h
+++ b/aos/util/death_test_log_implementation.h
@@ -1,7 +1,7 @@
 #ifndef AOS_UTIL_DEATH_TEST_LOG_IMPLEMENTATION_H_
 #define AOS_UTIL_DEATH_TEST_LOG_IMPLEMENTATION_H_
 
-#include <stdlib.h>
+#include <cstdlib>
 
 #include "aos/logging/implementations.h"
 
@@ -11,7 +11,8 @@
 // Prints all FATAL messages to stderr and then abort(3)s before the regular
 // stuff can print out anything else. Ignores all other messages.
 // This is useful in death tests that expect a LOG(FATAL) to cause the death.
-class DeathTestLogImplementation : public logging::HandleMessageLogImplementation {
+class DeathTestLogImplementation
+    : public logging::HandleMessageLogImplementation {
  public:
   virtual void HandleMessage(const logging::LogMessage &message) override {
     if (message.level == FATAL) {
diff --git a/aos/util/file_test.cc b/aos/util/file_test.cc
index 6851302..7c93fb3 100644
--- a/aos/util/file_test.cc
+++ b/aos/util/file_test.cc
@@ -1,7 +1,6 @@
 #include "aos/util/file.h"
 
-#include <stdlib.h>
-
+#include <cstdlib>
 #include <string>
 
 #include "gtest/gtest.h"
diff --git a/aos/util/run_command.cc b/aos/util/run_command.cc
index 40782da..2711e8b 100644
--- a/aos/util/run_command.cc
+++ b/aos/util/run_command.cc
@@ -1,11 +1,12 @@
 #include "aos/util/run_command.h"
 
-#include <signal.h>
+#include <fcntl.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
+
+#include <csignal>
 
 #include "aos/logging/logging.h"
 
@@ -43,19 +44,19 @@
   const pid_t pid = fork();
   switch (pid) {
     case 0:  // in child
-      {
-        int new_stdin = open("/dev/null", O_RDONLY);
-        if (new_stdin == -1) _exit(127);
-        int new_stdout = open("/dev/null", O_WRONLY);
-        if (new_stdout == -1) _exit(127);
-        int new_stderr = open("/dev/null", O_WRONLY);
-        if (new_stderr == -1) _exit(127);
-        if (dup2(new_stdin, 0) != 0) _exit(127);
-        if (dup2(new_stdout, 1) != 1) _exit(127);
-        if (dup2(new_stderr, 2) != 2) _exit(127);
-        execl("/bin/sh", "sh", "-c", command, nullptr);
-        _exit(127);
-      }
+    {
+      int new_stdin = open("/dev/null", O_RDONLY);
+      if (new_stdin == -1) _exit(127);
+      int new_stdout = open("/dev/null", O_WRONLY);
+      if (new_stdout == -1) _exit(127);
+      int new_stderr = open("/dev/null", O_WRONLY);
+      if (new_stderr == -1) _exit(127);
+      if (dup2(new_stdin, 0) != 0) _exit(127);
+      if (dup2(new_stdout, 1) != 1) _exit(127);
+      if (dup2(new_stderr, 2) != 2) _exit(127);
+      execl("/bin/sh", "sh", "-c", command, nullptr);
+      _exit(127);
+    }
     case -1:
       return -1;
     default:
diff --git a/aos/util/wrapping_counter.h b/aos/util/wrapping_counter.h
index a327dd8..ea79ec6 100644
--- a/aos/util/wrapping_counter.h
+++ b/aos/util/wrapping_counter.h
@@ -1,7 +1,7 @@
 #ifndef AOS_UTIL_WRAPPING_COUNTER_H_
 #define AOS_UTIL_WRAPPING_COUNTER_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 namespace aos {
 namespace util {
diff --git a/aos/util/wrapping_counter_test.cc b/aos/util/wrapping_counter_test.cc
index e5c58f3..3ef503b 100644
--- a/aos/util/wrapping_counter_test.cc
+++ b/aos/util/wrapping_counter_test.cc
@@ -1,6 +1,6 @@
 #include "aos/util/wrapping_counter.h"
 
-#include <limits.h>
+#include <climits>
 
 #include "gtest/gtest.h"
 
@@ -36,7 +36,7 @@
     EXPECT_EQ(i, test_counter.Update(i & 0xFF));
   }
 }
-}
+}  // namespace
 
 // This tests the basic wrapping functionality.
 TEST(WrappingCounterTest, ReasonableWrapping) {
diff --git a/aos/vision/blob/hierarchical_contour_merge.cc b/aos/vision/blob/hierarchical_contour_merge.cc
index ec617ca..c7de4de 100644
--- a/aos/vision/blob/hierarchical_contour_merge.cc
+++ b/aos/vision/blob/hierarchical_contour_merge.cc
@@ -1,6 +1,6 @@
 #include "aos/vision/blob/hierarchical_contour_merge.h"
 
-#include <math.h>
+#include <cmath>
 #include <queue>
 
 #include "aos/vision/blob/disjoint_set.h"
diff --git a/aos/vision/blob/range_image.cc b/aos/vision/blob/range_image.cc
index 81a8c48..bf8d09f 100644
--- a/aos/vision/blob/range_image.cc
+++ b/aos/vision/blob/range_image.cc
@@ -1,7 +1,7 @@
 #include "aos/vision/blob/range_image.h"
 
-#include <math.h>
 #include <algorithm>
+#include <cmath>
 
 namespace aos {
 namespace vision {
@@ -101,8 +101,7 @@
 }
 
 void PrintTo(const RangeImage &range, std::ostream *os) {
-  *os << "{min_y=" << range.min_y()
-      << ", ranges={";
+  *os << "{min_y=" << range.min_y() << ", ranges={";
   bool first_row = true;
   for (const auto &row : range) {
     if (first_row) {
diff --git a/aos/vision/blob/region_alloc.h b/aos/vision/blob/region_alloc.h
index df33fed..3275f3e 100644
--- a/aos/vision/blob/region_alloc.h
+++ b/aos/vision/blob/region_alloc.h
@@ -1,9 +1,9 @@
 #ifndef _AOS_VISION_REGION_ALLOC_H_
 #define _AOS_VISION_REGION_ALLOC_H_
 
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
 #include <memory>
 #include <new>
 #include <utility>
@@ -17,7 +17,7 @@
 class AnalysisAllocator {
  public:
   template <typename T, typename... Args>
-  T *cons_obj(Args &&... args) {
+  T *cons_obj(Args &&...args) {
     uint8_t *ptr = NULL;
     if (sizeof(T) + alignof(T) > block_size_) {
       __builtin_trap();
diff --git a/aos/vision/debug/debug_window.cc b/aos/vision/debug/debug_window.cc
index 4729939..b998c03 100644
--- a/aos/vision/debug/debug_window.cc
+++ b/aos/vision/debug/debug_window.cc
@@ -3,8 +3,9 @@
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gtk/gtk.h>
 #include <poll.h>
-#include <stdio.h>
-#include <stdlib.h>
+
+#include <cstdio>
+#include <cstdlib>
 #include <functional>
 #include <memory>
 #include <vector>
diff --git a/aos/vision/events/epoll_events.cc b/aos/vision/events/epoll_events.cc
index 651579a..e417f0d 100644
--- a/aos/vision/events/epoll_events.cc
+++ b/aos/vision/events/epoll_events.cc
@@ -1,10 +1,11 @@
 #include "aos/vision/events/epoll_events.h"
 
 #include <fcntl.h>
-#include <string.h>
 #include <sys/epoll.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+
+#include <cstring>
 #include <vector>
 
 #include "aos/logging/logging.h"
@@ -48,7 +49,8 @@
         AOS_PCHECK(epoll_wait(epoll_fd(), events, kNumberOfEvents, timeout));
 
     for (int i = 0; i < number_events; i++) {
-      static_cast<EpollEvent *>(events[i].data.ptr)->DirectEvent(events[i].events);
+      static_cast<EpollEvent *>(events[i].data.ptr)
+          ->DirectEvent(events[i].events);
     }
   }
 }
diff --git a/aos/vision/events/epoll_events.h b/aos/vision/events/epoll_events.h
index c7aa1c6..7562f41 100644
--- a/aos/vision/events/epoll_events.h
+++ b/aos/vision/events/epoll_events.h
@@ -1,11 +1,12 @@
 #ifndef AOS_VISION_EVENTS_EPOLL_EVENTS_H_
 #define AOS_VISION_EVENTS_EPOLL_EVENTS_H_
 
-#include <limits.h>
-#include <stdint.h>
+#include <sys/epoll.h>
+
+#include <climits>
+#include <cstdint>
 #include <memory>
 #include <vector>
-#include <sys/epoll.h>
 
 #include "aos/scoped/scoped_fd.h"
 #include "aos/time/time.h"
diff --git a/aos/vision/events/socket_types.h b/aos/vision/events/socket_types.h
index d377214..996edbb 100644
--- a/aos/vision/events/socket_types.h
+++ b/aos/vision/events/socket_types.h
@@ -2,10 +2,11 @@
 #define _AOS_VISION_EVENTS_SOCKET_TYPES_H_
 
 #include <poll.h>
-#include <stdint.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 
+#include <cstdint>
+
 #include "aos/vision/events/tcp_server.h"
 #include "aos/vision/image/image_types.h"
 #include "google/protobuf/message.h"
diff --git a/aos/vision/events/tcp_client.cc b/aos/vision/events/tcp_client.cc
index 94fa3d2..0a926db 100644
--- a/aos/vision/events/tcp_client.cc
+++ b/aos/vision/events/tcp_client.cc
@@ -1,17 +1,17 @@
 #include "aos/vision/events/tcp_client.h"
 
 #include <arpa/inet.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <unistd.h>
+
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 
 #include "aos/logging/logging.h"
 
diff --git a/aos/vision/events/tcp_server.cc b/aos/vision/events/tcp_server.cc
index 535c6b4..cf4dd7f 100644
--- a/aos/vision/events/tcp_server.cc
+++ b/aos/vision/events/tcp_server.cc
@@ -1,18 +1,19 @@
 #include "aos/vision/events/tcp_server.h"
 
 #include <arpa/inet.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/epoll.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
 #include "aos/logging/logging.h"
 
 namespace aos {
diff --git a/aos/vision/events/udp.cc b/aos/vision/events/udp.cc
index 7ac72e8..2aaac82 100644
--- a/aos/vision/events/udp.cc
+++ b/aos/vision/events/udp.cc
@@ -1,6 +1,6 @@
 #include "aos/vision/events/udp.h"
 
-#include <string.h>
+#include <cstring>
 
 #include "glog/logging.h"
 
diff --git a/aos/vision/events/udp.h b/aos/vision/events/udp.h
index 503ead1..3c16b28 100644
--- a/aos/vision/events/udp.h
+++ b/aos/vision/events/udp.h
@@ -2,9 +2,10 @@
 #define AOS_VISION_EVENTS_UDP_H_
 
 #include <arpa/inet.h>
-#include <math.h>
 #include <sys/socket.h>
 #include <unistd.h>
+
+#include <cmath>
 #include <string>
 #include <vector>
 
diff --git a/aos/vision/image/image_types.h b/aos/vision/image/image_types.h
index fba6a10..5214a6f 100644
--- a/aos/vision/image/image_types.h
+++ b/aos/vision/image/image_types.h
@@ -1,11 +1,10 @@
 #ifndef _AOS_VISION_IMAGE_IMAGE_TYPES_H_
 #define _AOS_VISION_IMAGE_IMAGE_TYPES_H_
 
-#include <stdint.h>
-#include <string.h>
+#include <cstdint>
+#include <cstring>
 #include <memory>
 #include <sstream>
-
 #include <string_view>
 
 namespace aos {
diff --git a/aos/vision/image/jpeg_routines.cc b/aos/vision/image/jpeg_routines.cc
index 507fb3b..d641627 100644
--- a/aos/vision/image/jpeg_routines.cc
+++ b/aos/vision/image/jpeg_routines.cc
@@ -1,13 +1,13 @@
 #include "aos/vision/image/jpeg_routines.h"
 
-#include <errno.h>
-#include <setjmp.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
+
+#include <cerrno>
+#include <csetjmp>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
 #include <cstring>
 
 #include "aos/logging/logging.h"
@@ -154,9 +154,10 @@
   cinfo.out_color_space = JCS_RGB;
   jpeg_create_decompress(&cinfo);
 
-  jpeg_mem_src(&cinfo, reinterpret_cast<unsigned char *>(
-                           const_cast<char *>(data.data())),
-               data.size());
+  jpeg_mem_src(
+      &cinfo,
+      reinterpret_cast<unsigned char *>(const_cast<char *>(data.data())),
+      data.size());
 
   jpeg_read_header(&cinfo, TRUE);
   fmt.w = cinfo.image_width;
@@ -204,9 +205,10 @@
   cinfo.out_color_space = JCS_RGB;
   jpeg_create_decompress(&cinfo);
 
-  jpeg_mem_src(&cinfo, reinterpret_cast<unsigned char *>(
-                           const_cast<char *>(data.data())),
-               data.size());
+  jpeg_mem_src(
+      &cinfo,
+      reinterpret_cast<unsigned char *>(const_cast<char *>(data.data())),
+      data.size());
 
   jpeg_read_header(&cinfo, TRUE);
   standard_huff_tables(&cinfo);
diff --git a/aos/vision/image/jpeg_routines.h b/aos/vision/image/jpeg_routines.h
index 7c8fd67..59ad296 100644
--- a/aos/vision/image/jpeg_routines.h
+++ b/aos/vision/image/jpeg_routines.h
@@ -1,9 +1,11 @@
 #ifndef _AOS_VISION_IMAGE_JPEGROUTINES_H_
 #define _AOS_VISION_IMAGE_JPEGROUTINES_H_
 
-#include <stdio.h>
-#include <stdlib.h>
 #include <unistd.h>
+
+#include <cstdio>
+#include <cstdlib>
+
 #include "aos/vision/image/image_types.h"
 
 namespace aos {
diff --git a/aos/vision/image/reader.cc b/aos/vision/image/reader.cc
index 7584369..3fbcd1d 100644
--- a/aos/vision/image/reader.cc
+++ b/aos/vision/image/reader.cc
@@ -1,17 +1,18 @@
 #include "aos/vision/image/reader.h"
 
-#include <errno.h>
 #include <fcntl.h>
 #include <malloc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
 #include "aos/logging/logging.h"
 #include "aos/time/time.h"
 
diff --git a/aos/vision/image/reader.h b/aos/vision/image/reader.h
index 4283224..8f7b6b7 100644
--- a/aos/vision/image/reader.h
+++ b/aos/vision/image/reader.h
@@ -1,7 +1,7 @@
 #ifndef AOS_VISION_IMAGE_READER_H_
 #define AOS_VISION_IMAGE_READER_H_
 
-#include <inttypes.h>
+#include <cinttypes>
 #include <functional>
 #include <string>
 
diff --git a/aos/vision/tools/jpeg_vision_test.cc b/aos/vision/tools/jpeg_vision_test.cc
index 738713b..ef2ec6d 100644
--- a/aos/vision/tools/jpeg_vision_test.cc
+++ b/aos/vision/tools/jpeg_vision_test.cc
@@ -5,9 +5,10 @@
 #include <gtk/gtk.h>
 #include <netdb.h>
 #include <poll.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 #include <fstream>
 #include <memory>
 #include <vector>
diff --git a/build_tests/helloworld.cc b/build_tests/helloworld.cc
index c034e96..f12349e 100644
--- a/build_tests/helloworld.cc
+++ b/build_tests/helloworld.cc
@@ -1,5 +1,3 @@
-#include <stdio.h>
+#include <cstdio>
 
-int main() {
-  printf("Hello, World!\n");
-}
+int main() { printf("Hello, World!\n"); }
diff --git a/build_tests/tcmalloc.cc b/build_tests/tcmalloc.cc
index 7fb9105..bc5f03e 100644
--- a/build_tests/tcmalloc.cc
+++ b/build_tests/tcmalloc.cc
@@ -1,6 +1,7 @@
-#include <stdlib.h>
 #include <unistd.h>
 
+#include <cstdlib>
+
 int main() {
   void *big_chunk = malloc(500000 + read(-1, nullptr, 0));
   if (write(-1, big_chunk, 0) != -1) return 1;
diff --git a/frc971/analysis/py_log_reader.cc b/frc971/analysis/py_log_reader.cc
index 6a6c767..4485cca 100644
--- a/frc971/analysis/py_log_reader.cc
+++ b/frc971/analysis/py_log_reader.cc
@@ -17,8 +17,8 @@
 // Note that Python.h needs to be included before anything else.
 #include <Python.h>
 
+#include <cerrno>
 #include <memory>
-#include <errno.h>
 
 #include "aos/configuration.h"
 #include "aos/events/logging/log_reader.h"
@@ -69,7 +69,7 @@
 }
 
 PyObject *LogReader_new(PyTypeObject *type, PyObject * /*args*/,
-                            PyObject * /*kwds*/) {
+                        PyObject * /*kwds*/) {
   LogReaderType *self;
   self = (LogReaderType *)type->tp_alloc(type, 0);
   if (self != nullptr) {
@@ -117,9 +117,8 @@
   return 0;
 }
 
-PyObject *LogReader_get_data_for_channel(LogReaderType *self,
-                                                PyObject *args,
-                                                PyObject *kwds) {
+PyObject *LogReader_get_data_for_channel(LogReaderType *self, PyObject *args,
+                                         PyObject *kwds) {
   const char *kwlist[] = {"name", "type", nullptr};
 
   const char *name;
@@ -140,8 +139,7 @@
   for (const auto &channel : tools->channel_data) {
     if (channel.name == name && channel.type == type) {
       PyObject *list = PyList_New(channel.messages.size());
-      for (size_t ii = 0; ii < channel.messages.size(); ++ii)
-      {
+      for (size_t ii = 0; ii < channel.messages.size(); ++ii) {
         const auto &message = channel.messages[ii];
         PyObject *monotonic_time = PyLong_FromLongLong(
             std::chrono::duration_cast<std::chrono::nanoseconds>(
@@ -168,7 +166,7 @@
 }
 
 PyObject *LogReader_subscribe(LogReaderType *self, PyObject *args,
-                                     PyObject *kwds) {
+                              PyObject *kwds) {
   const char *kwlist[] = {"name", "type", nullptr};
 
   const char *name;
@@ -192,8 +190,7 @@
     return Py_False;
   }
   const int index = tools->channel_data.size();
-  tools->channel_data.push_back(
-      {.name = name, .type = type, .messages = {}});
+  tools->channel_data.push_back({.name = name, .type = type, .messages = {}});
   tools->event_loop->MakeRawWatcher(
       channel, [channel, index, tools](const aos::Context &context,
                                        const void *message) {
diff --git a/frc971/autonomous/base_autonomous_actor.cc b/frc971/autonomous/base_autonomous_actor.cc
index e691d03..8a5b60e 100644
--- a/frc971/autonomous/base_autonomous_actor.cc
+++ b/frc971/autonomous/base_autonomous_actor.cc
@@ -1,14 +1,12 @@
 #include "frc971/autonomous/base_autonomous_actor.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
+#include "aos/logging/logging.h"
 #include "aos/util/math.h"
 #include "aos/util/phased_loop.h"
-#include "aos/logging/logging.h"
-
 #include "frc971/control_loops/control_loops_generated.h"
 #include "frc971/control_loops/drivetrain/drivetrain_goal_generated.h"
 #include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
@@ -316,8 +314,9 @@
         (Eigen::Matrix<double, 7, 1>()
              << initial_drivetrain_.left -
                     drivetrain_status_fetcher_->profiled_left_position_goal(),
-         0.0, initial_drivetrain_.right -
-                  drivetrain_status_fetcher_->profiled_right_position_goal(),
+         0.0,
+         initial_drivetrain_.right -
+             drivetrain_status_fetcher_->profiled_right_position_goal(),
          0.0, 0.0, 0.0, 0.0)
             .finished();
     const Eigen::Matrix<double, 2, 1> linear_error =
@@ -352,8 +351,9 @@
         (Eigen::Matrix<double, 7, 1>()
              << initial_drivetrain_.left -
                     drivetrain_status_fetcher_->profiled_left_position_goal(),
-         0.0, initial_drivetrain_.right -
-                  drivetrain_status_fetcher_->profiled_right_position_goal(),
+         0.0,
+         initial_drivetrain_.right -
+             drivetrain_status_fetcher_->profiled_right_position_goal(),
          0.0, 0.0, 0.0, 0.0)
             .finished();
     const Eigen::Matrix<double, 2, 1> angular_error =
diff --git a/frc971/control_loops/control_loop-tmpl.h b/frc971/control_loops/control_loop-tmpl.h
index f6fd0af..0db1786 100644
--- a/frc971/control_loops/control_loop-tmpl.h
+++ b/frc971/control_loops/control_loop-tmpl.h
@@ -1,5 +1,5 @@
-#include <stddef.h>
-#include <inttypes.h>
+#include <cinttypes>
+#include <cstddef>
 
 #include "aos/logging/logging.h"
 
@@ -19,7 +19,8 @@
 
 template <class GoalType, class PositionType, class StatusType,
           class OutputType>
-void ControlLoop<GoalType, PositionType, StatusType, OutputType>::ZeroOutputs() {
+void ControlLoop<GoalType, PositionType, StatusType,
+                 OutputType>::ZeroOutputs() {
   typename ::aos::Sender<OutputType>::Builder builder =
       output_sender_.MakeBuilder();
   builder.Send(Zero(&builder));
diff --git a/frc971/control_loops/control_loop.h b/frc971/control_loops/control_loop.h
index 741b32f..80b0bca 100644
--- a/frc971/control_loops/control_loop.h
+++ b/frc971/control_loops/control_loop.h
@@ -1,9 +1,8 @@
 #ifndef AOS_CONTROL_LOOP_CONTROL_LOOP_H_
 #define AOS_CONTROL_LOOP_CONTROL_LOOP_H_
 
-#include <string.h>
-
 #include <atomic>
+#include <cstring>
 
 #include "aos/events/event_loop.h"
 #include "aos/time/time.h"
diff --git a/frc971/control_loops/drivetrain/drivetrain.cc b/frc971/control_loops/drivetrain/drivetrain.cc
index 5242550..2cc9f35 100644
--- a/frc971/control_loops/drivetrain/drivetrain.cc
+++ b/frc971/control_loops/drivetrain/drivetrain.cc
@@ -1,9 +1,9 @@
 #include "frc971/control_loops/drivetrain/drivetrain.h"
 
 #include <sched.h>
-#include <stdio.h>
 
 #include <cmath>
+#include <cstdio>
 #include <memory>
 
 #include "Eigen/Dense"
diff --git a/frc971/control_loops/drivetrain/drivetrain_uc.q.cc b/frc971/control_loops/drivetrain/drivetrain_uc.q.cc
index 5f8bce4..2a2870c 100644
--- a/frc971/control_loops/drivetrain/drivetrain_uc.q.cc
+++ b/frc971/control_loops/drivetrain/drivetrain_uc.q.cc
@@ -1,5 +1,6 @@
 #include "frc971/control_loops/drivetrain/drivetrain_uc.q.h"
-#include <inttypes.h>
+
+#include <cinttypes>
 
 namespace frc971 {
 namespace control_loops {
diff --git a/frc971/control_loops/hall_effect_tracker.h b/frc971/control_loops/hall_effect_tracker.h
index 084c9a7..c18d2af 100644
--- a/frc971/control_loops/hall_effect_tracker.h
+++ b/frc971/control_loops/hall_effect_tracker.h
@@ -1,7 +1,7 @@
 #ifndef FRC971_CONTROL_LOOPS_HALL_EFFECT_H_
 #define FRC971_CONTROL_LOOPS_HALL_EFFECT_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "frc971/control_loops/control_loops_generated.h"
 
diff --git a/frc971/control_loops/hybrid_state_feedback_loop.h b/frc971/control_loops/hybrid_state_feedback_loop.h
index 4dab950..6285024 100644
--- a/frc971/control_loops/hybrid_state_feedback_loop.h
+++ b/frc971/control_loops/hybrid_state_feedback_loop.h
@@ -1,21 +1,19 @@
 #ifndef FRC971_CONTROL_LOOPS_HYBRID_STATE_FEEDBACK_LOOP_H_
 #define FRC971_CONTROL_LOOPS_HYBRID_STATE_FEEDBACK_LOOP_H_
 
-#include <assert.h>
-
+#include <cassert>
 #include <chrono>
 #include <memory>
 #include <utility>
 #include <vector>
 
 #include "Eigen/Dense"
-#include "unsupported/Eigen/MatrixFunctions"
-
-#include "frc971/control_loops/control_loop.h"
 #include "aos/logging/logging.h"
 #include "aos/macros.h"
 #include "frc971/control_loops/c2d.h"
+#include "frc971/control_loops/control_loop.h"
 #include "frc971/control_loops/state_feedback_loop.h"
+#include "unsupported/Eigen/MatrixFunctions"
 
 template <int number_of_states, int number_of_inputs, int number_of_outputs,
           typename Scalar = double>
diff --git a/frc971/control_loops/state_feedback_loop.h b/frc971/control_loops/state_feedback_loop.h
index 50edf0d..4250df2 100644
--- a/frc971/control_loops/state_feedback_loop.h
+++ b/frc971/control_loops/state_feedback_loop.h
@@ -1,8 +1,7 @@
 #ifndef FRC971_CONTROL_LOOPS_STATE_FEEDBACK_LOOP_H_
 #define FRC971_CONTROL_LOOPS_STATE_FEEDBACK_LOOP_H_
 
-#include <assert.h>
-
+#include <cassert>
 #include <chrono>
 #include <memory>
 #include <utility>
diff --git a/frc971/control_loops/voltage_cap/voltage_cap.h b/frc971/control_loops/voltage_cap/voltage_cap.h
index 49aa9e8..ad4e4c6c 100644
--- a/frc971/control_loops/voltage_cap/voltage_cap.h
+++ b/frc971/control_loops/voltage_cap/voltage_cap.h
@@ -1,29 +1,29 @@
 #ifndef FRC971_CONTROL_LOOPS_VOLTAGE_CAP_VOLTAGE_CAP_H_
 #define FRC971_CONTROL_LOOPS_VOLTAGE_CAP_VOLTAGE_CAP_H_
 
-#include <stdio.h>
+#include <cstdio>
 
 namespace frc971 {
 namespace control_loops {
 
-// This function maintains the difference of power between two voltages passed in
-//   that are outside of our range of possible voltage output.
-// This is because we figured that maintaining the difference rather than the ratio
-//   between the voltages would get us to our goal as fast as possible.
+// This function maintains the difference of power between two voltages passed
+// in that are outside of our range of possible voltage output.
+// This is because we figured that maintaining the difference rather than the
+// ratio between the voltages would get us to our goal as fast as possible.
 //
 //
 // The 'box' is a box formed on a graph by the maximum and minimun voltages of
-//   voltage_one and voltage_two with
-//   voltage_one on the y-axis and voltage_two on the x-axis.
+//   voltage_one and voltage_two with voltage_one on the y-axis and voltage_two
+//   on the x-axis.
 // If a line with a slope of one(45degrees) is plotted from the point formed
-//   by graphing voltage_one(y) and voltage_two(x), the first intersecting point of
-//   the box is the maximum voltage that we can output to get to the goal as
+//   by graphing voltage_one(y) and voltage_two(x), the first intersecting point
+//   of the box is the maximum voltage that we can output to get to the goal as
 //   fast as possible.
 // If the line does not intersect the box, then we use the closest corner of
 //   the box to the line in either quadrant two or quadrant four of the graph.
 void VoltageCap(double max_voltage, double voltage_one, double voltage_two,
                 double *out_voltage_one, double *out_voltage_two);
-  // Defaults to 12v if no voltage is specified.
+// Defaults to 12v if no voltage is specified.
 void VoltageCap(double voltage_one, double voltage_two, double *out_voltage_one,
                 double *out_voltage_two);
 
diff --git a/frc971/input/drivetrain_input.cc b/frc971/input/drivetrain_input.cc
index cefb113..b062ceb 100644
--- a/frc971/input/drivetrain_input.cc
+++ b/frc971/input/drivetrain_input.cc
@@ -1,10 +1,8 @@
 #include "frc971/input/drivetrain_input.h"
 
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 
 #include "aos/commonmath.h"
 #include "aos/logging/logging.h"
diff --git a/frc971/input/drivetrain_input.h b/frc971/input/drivetrain_input.h
index 9e450d5..3419ea7 100644
--- a/frc971/input/drivetrain_input.h
+++ b/frc971/input/drivetrain_input.h
@@ -1,11 +1,9 @@
 #ifndef AOS_INPUT_DRIVETRAIN_INPUT_H_
 #define AOS_INPUT_DRIVETRAIN_INPUT_H_
 
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <memory>
 
 #include "aos/logging/logging.h"
diff --git a/frc971/input/joystick_input.cc b/frc971/input/joystick_input.cc
index c92d567..d0d9bc0 100644
--- a/frc971/input/joystick_input.cc
+++ b/frc971/input/joystick_input.cc
@@ -1,8 +1,7 @@
 #include "frc971/input/joystick_input.h"
 
-#include <string.h>
-
 #include <atomic>
+#include <cstring>
 
 #include "aos/logging/logging.h"
 #include "frc971/input/robot_state_generated.h"
diff --git a/frc971/wpilib/ADIS16448.cc b/frc971/wpilib/ADIS16448.cc
index b104840..b479970 100644
--- a/frc971/wpilib/ADIS16448.cc
+++ b/frc971/wpilib/ADIS16448.cc
@@ -3,9 +3,9 @@
 #include "frc971/wpilib/ahal/InterruptableSensorBase.h"
 #undef ERROR
 
-#include <inttypes.h>
-#include <math.h>
 #include <chrono>
+#include <cinttypes>
+#include <cmath>
 
 #include "aos/init.h"
 #include "aos/time/time.h"
@@ -137,9 +137,9 @@
 
   // NI's SPI driver defaults to SCHED_OTHER.  Find it's PID with ps, and change
   // it to a RT priority of 33.
-  AOS_PCHECK(
-      system("busybox ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs chrt -f -p "
-             "33") == 0);
+  AOS_PCHECK(system("busybox ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | "
+                    "xargs chrt -f -p "
+                    "33") == 0);
 
   event_loop->set_name("IMU");
   event_loop_->SetRuntimeRealtimePriority(33);
diff --git a/frc971/wpilib/ADIS16448.h b/frc971/wpilib/ADIS16448.h
index 59f9aa8..6d5eb28 100644
--- a/frc971/wpilib/ADIS16448.h
+++ b/frc971/wpilib/ADIS16448.h
@@ -1,9 +1,8 @@
 #ifndef FRC971_WPILIB_ADIS16448_H_
 #define FRC971_WPILIB_ADIS16448_H_
 
-#include <stdint.h>
-
 #include <atomic>
+#include <cstdint>
 #include <memory>
 
 #include "frc971/wpilib/ahal/DigitalInput.h"
diff --git a/frc971/wpilib/ADIS16470.cc b/frc971/wpilib/ADIS16470.cc
index 8a56d96..151f3e0 100644
--- a/frc971/wpilib/ADIS16470.cc
+++ b/frc971/wpilib/ADIS16470.cc
@@ -1,11 +1,10 @@
 #include "frc971/wpilib/ADIS16470.h"
 
-#include <inttypes.h>
-
-#include "glog/logging.h"
+#include <cinttypes>
 
 #include "aos/containers/sized_array.h"
 #include "aos/time/time.h"
+#include "glog/logging.h"
 #include "hal/HAL.h"
 
 namespace frc971 {
@@ -139,23 +138,39 @@
 // position because we don't care if it's one cycle stale.
 constexpr uint8_t kAutospiPacket[] = {
     // X
-    registers::X_GYRO_OUT, 0,
-    registers::X_ACCL_OUT, 0, registers::X_ACCL_LOW, 0,
+    registers::X_GYRO_OUT,
+    0,
+    registers::X_ACCL_OUT,
+    0,
+    registers::X_ACCL_LOW,
+    0,
     // Y
-    registers::Y_GYRO_OUT, 0,
-    registers::Y_ACCL_OUT, 0, registers::Y_ACCL_LOW, 0,
+    registers::Y_GYRO_OUT,
+    0,
+    registers::Y_ACCL_OUT,
+    0,
+    registers::Y_ACCL_LOW,
+    0,
     // Z
-    registers::Z_GYRO_OUT, 0,
-    registers::Z_ACCL_OUT, 0, registers::Z_ACCL_LOW, 0,
+    registers::Z_GYRO_OUT,
+    0,
+    registers::Z_ACCL_OUT,
+    0,
+    registers::Z_ACCL_LOW,
+    0,
     // Other
-    registers::TEMP_OUT, 0, registers::DIAG_STAT, 0,
+    registers::TEMP_OUT,
+    0,
+    registers::DIAG_STAT,
+    0,
 };
 // clang-format on
 
 static_assert((sizeof(kAutospiPacket) % 2) == 0,
               "Need a whole number of register reads");
 
-static constexpr size_t kAutospiDataSize = sizeof(kAutospiPacket) + 1 /* timestamp */;
+static constexpr size_t kAutospiDataSize =
+    sizeof(kAutospiPacket) + 1 /* timestamp */;
 
 // radian/second/LSB for the gyros (for just the 16-bit value).
 constexpr double kGyroLsbRadianSecond =
@@ -195,12 +210,12 @@
 
   // NI's SPI driver defaults to SCHED_OTHER.  Find it's PID with ps, and change
   // it to a RT priority of 33.
-  PCHECK(
-      system("busybox ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs chrt -f -p "
-             "33") == 0);
-  PCHECK(
-      system("busybox ps -ef | grep '\\[spi1\\]' | awk '{print $1}' | xargs chrt -f -p "
-             "33") == 0);
+  PCHECK(system("busybox ps -ef | grep '\\[spi0\\]' | awk '{print $1}' | xargs "
+                "chrt -f -p "
+                "33") == 0);
+  PCHECK(system("busybox ps -ef | grep '\\[spi1\\]' | awk '{print $1}' | xargs "
+                "chrt -f -p "
+                "33") == 0);
 
   event_loop_->OnRun([this]() { BeginInitialization(); });
 }
@@ -271,8 +286,7 @@
       // margin on top of that.
       initialize_timer_->Setup(event_loop_->monotonic_now() +
                                chrono::milliseconds(250));
-    }
-    break;
+    } break;
 
     case State::kWaitForReset: {
       flatbuffers::Offset<ADIS16470DiagStat> start_diag_stat;
@@ -326,7 +340,7 @@
                 1 /* toggle CS every 2 8-bit bytes */);
 
             // Read any data queued up by the FPGA.
-            while (true){
+            while (true) {
               uint32_t buffer;
               if (spi_->ReadAutoReceivedData(&buffer, 1, 0 /* don't block */) ==
                   0) {
@@ -380,8 +394,7 @@
       } else {
         BeginInitialization();
       }
-    }
-    break;
+    } break;
 
     case State::kRunning:
       LOG(FATAL) << "Not a reset state";
diff --git a/frc971/wpilib/ahal/ControllerPower.cc b/frc971/wpilib/ahal/ControllerPower.cc
index 9637d17..413f324 100644
--- a/frc971/wpilib/ahal/ControllerPower.cc
+++ b/frc971/wpilib/ahal/ControllerPower.cc
@@ -7,11 +7,11 @@
 
 #include "frc971/wpilib/ahal/ControllerPower.h"
 
-#include <stdint.h>
+#include <cstdint>
 
+#include "frc971/wpilib/ahal/ErrorBase.h"
 #include "hal/HAL.h"
 #include "hal/Power.h"
-#include "frc971/wpilib/ahal/ErrorBase.h"
 
 using namespace frc;
 
diff --git a/frc971/wpilib/ahal/CounterBase.h b/frc971/wpilib/ahal/CounterBase.h
index 868dbe6..553575f 100644
--- a/frc971/wpilib/ahal/CounterBase.h
+++ b/frc971/wpilib/ahal/CounterBase.h
@@ -7,7 +7,7 @@
 
 #pragma once
 
-#include <stdint.h>
+#include <cstdint>
 
 namespace frc {
 
diff --git a/frc971/wpilib/ahal/DigitalInput.h b/frc971/wpilib/ahal/DigitalInput.h
index 2053e4e..cd26773 100644
--- a/frc971/wpilib/ahal/DigitalInput.h
+++ b/frc971/wpilib/ahal/DigitalInput.h
@@ -7,8 +7,7 @@
 
 #pragma once
 
-#include <stdint.h>
-
+#include <cstdint>
 #include <memory>
 #include <string>
 
diff --git a/frc971/wpilib/ahal/SPI.h b/frc971/wpilib/ahal/SPI.h
index d7c6b95..1d439b2 100644
--- a/frc971/wpilib/ahal/SPI.h
+++ b/frc971/wpilib/ahal/SPI.h
@@ -7,14 +7,13 @@
 
 #pragma once
 
-#include <stdint.h>
-
-#include <memory>
-
 #include <hal/SPITypes.h>
 #include <wpi/ArrayRef.h>
 #include <wpi/deprecated.h>
 
+#include <cstdint>
+#include <memory>
+
 namespace frc {
 
 class DigitalSource;
@@ -39,8 +38,8 @@
 
   ~SPI();
 
-  SPI(SPI&&) = default;
-  SPI& operator=(SPI&&) = default;
+  SPI(SPI &&) = default;
+  SPI &operator=(SPI &&) = default;
 
   /**
    * Configure the rate of the generated clock signal.
@@ -119,7 +118,7 @@
    * If not running in output only mode, also saves the data received
    * on the MISO input during the transfer into the receive FIFO.
    */
-  virtual int Write(uint8_t* data, int size);
+  virtual int Write(uint8_t *data, int size);
 
   /**
    * Read a word from the receive FIFO.
@@ -134,7 +133,7 @@
    *                 that data is already in the receive FIFO from a previous
    *                 write.
    */
-  virtual int Read(bool initiate, uint8_t* dataReceived, int size);
+  virtual int Read(bool initiate, uint8_t *dataReceived, int size);
 
   /**
    * Perform a simultaneous read/write transaction with the device
@@ -143,7 +142,7 @@
    * @param dataReceived Buffer to receive data from the device
    * @param size         The length of the transaction, in bytes
    */
-  virtual int Transaction(uint8_t* dataToSend, uint8_t* dataReceived, int size);
+  virtual int Transaction(uint8_t *dataToSend, uint8_t *dataReceived, int size);
 
   /**
    * Initialize automatic SPI transfer engine.
@@ -191,7 +190,7 @@
    * @param rising trigger on the rising edge
    * @param falling trigger on the falling edge
    */
-  void StartAutoTrigger(DigitalSource& source, bool rising, bool falling);
+  void StartAutoTrigger(DigitalSource &source, bool rising, bool falling);
 
   /**
    * Stop running the automatic SPI transfer engine.
@@ -222,7 +221,7 @@
    * @param timeout timeout in seconds (ms resolution)
    * @return Number of words remaining to be read
    */
-  int ReadAutoReceivedData(uint32_t* buffer, int numToRead, double timeout);
+  int ReadAutoReceivedData(uint32_t *buffer, int numToRead, double timeout);
 
   /**
    * Get the number of bytes dropped by the automatic SPI transfer engine due
diff --git a/frc971/wpilib/ahal/SensorBase.h b/frc971/wpilib/ahal/SensorBase.h
index 1d95330..a4de9cc 100644
--- a/frc971/wpilib/ahal/SensorBase.h
+++ b/frc971/wpilib/ahal/SensorBase.h
@@ -7,7 +7,7 @@
 
 #pragma once
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "frc971/wpilib/ahal/ErrorBase.h"
 
diff --git a/frc971/wpilib/ahal/Utility.h b/frc971/wpilib/ahal/Utility.h
index be8dc35..196dfce 100644
--- a/frc971/wpilib/ahal/Utility.h
+++ b/frc971/wpilib/ahal/Utility.h
@@ -11,8 +11,7 @@
  * Contains global utility functions
  */
 
-#include <stdint.h>
-
+#include <cstdint>
 #include <string>
 
 #include "wpi/StringRef.h"
diff --git a/frc971/wpilib/ahal/WPIErrors.h b/frc971/wpilib/ahal/WPIErrors.h
index da72d00..482240c 100644
--- a/frc971/wpilib/ahal/WPIErrors.h
+++ b/frc971/wpilib/ahal/WPIErrors.h
@@ -7,7 +7,7 @@
 
 #pragma once
 
-#include <stdint.h>
+#include <cstdint>
 
 #ifdef WPI_ERRORS_DEFINE_STRINGS
 #define S(label, offset, message)            \
diff --git a/frc971/wpilib/buffered_pcm.cc b/frc971/wpilib/buffered_pcm.cc
index 3123add..7f6cb37 100644
--- a/frc971/wpilib/buffered_pcm.cc
+++ b/frc971/wpilib/buffered_pcm.cc
@@ -1,6 +1,6 @@
 #include "frc971/wpilib/buffered_pcm.h"
 
-#include <inttypes.h>
+#include <cinttypes>
 
 #include "aos/logging/logging.h"
 #include "hal/HAL.h"
diff --git a/frc971/wpilib/dma.cc b/frc971/wpilib/dma.cc
index b990532..432b77b 100644
--- a/frc971/wpilib/dma.cc
+++ b/frc971/wpilib/dma.cc
@@ -1,8 +1,7 @@
 #include "frc971/wpilib/dma.h"
 
-#include <string.h>
-
 #include <algorithm>
+#include <cstring>
 #include <type_traits>
 
 #include "frc971/wpilib/ahal/AnalogInput.h"
@@ -333,9 +332,7 @@
 #endif
 }
 
-uint64_t DMASample::GetTime() const {
-  return fpga_timestamp_;
-}
+uint64_t DMASample::GetTime() const { return fpga_timestamp_; }
 
 double DMASample::GetTimestamp() const {
   return static_cast<double>(GetTime()) * 0.000001;
diff --git a/frc971/wpilib/dma.h b/frc971/wpilib/dma.h
index 6d82af8..46e1f71 100644
--- a/frc971/wpilib/dma.h
+++ b/frc971/wpilib/dma.h
@@ -4,9 +4,8 @@
 // Interface to the roboRIO FPGA's DMA features.
 // TODO(Brian): Make this less wpilib-like and more frc971-like.
 
-#include <stdint.h>
-
 #include <array>
+#include <cstdint>
 #include <memory>
 
 #include "hal/ChipObject.h"
diff --git a/frc971/wpilib/gyro_interface.cc b/frc971/wpilib/gyro_interface.cc
index eeacfce..7ed24b7 100644
--- a/frc971/wpilib/gyro_interface.cc
+++ b/frc971/wpilib/gyro_interface.cc
@@ -1,7 +1,7 @@
 #include "frc971/wpilib/gyro_interface.h"
 
-#include <inttypes.h>
 #include <chrono>
+#include <cinttypes>
 
 #include "aos/logging/logging.h"
 #include "aos/time/time.h"
diff --git a/frc971/wpilib/gyro_sender.cc b/frc971/wpilib/gyro_sender.cc
index 3061c3b..9f25d04 100644
--- a/frc971/wpilib/gyro_sender.cc
+++ b/frc971/wpilib/gyro_sender.cc
@@ -1,11 +1,11 @@
 #include "frc971/wpilib/gyro_sender.h"
 
 #include <fcntl.h>
-#include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
 #include <chrono>
+#include <cinttypes>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/frc971/wpilib/gyro_sender.h b/frc971/wpilib/gyro_sender.h
index 91257c9..4abfeaa 100644
--- a/frc971/wpilib/gyro_sender.h
+++ b/frc971/wpilib/gyro_sender.h
@@ -1,9 +1,8 @@
 #ifndef FRC971_WPILIB_GYRO_H_
 #define FRC971_WPILIB_GYRO_H_
 
-#include <stdint.h>
-
 #include <atomic>
+#include <cstdint>
 
 #include "aos/events/event_loop.h"
 #include "aos/events/shm_event_loop.h"
diff --git a/frc971/wpilib/sensor_reader.cc b/frc971/wpilib/sensor_reader.cc
index dea4760..d8377d8 100644
--- a/frc971/wpilib/sensor_reader.cc
+++ b/frc971/wpilib/sensor_reader.cc
@@ -1,8 +1,9 @@
 #include "frc971/wpilib/sensor_reader.h"
 
-#include <inttypes.h>
 #include <unistd.h>
 
+#include <cinttypes>
+
 #include "aos/init.h"
 #include "aos/logging/logging.h"
 #include "aos/util/compiler_memory_barrier.h"
diff --git a/frc971/wpilib/spi_rx_clearer.cc b/frc971/wpilib/spi_rx_clearer.cc
index 245f073..1faa3f6 100644
--- a/frc971/wpilib/spi_rx_clearer.cc
+++ b/frc971/wpilib/spi_rx_clearer.cc
@@ -1,10 +1,11 @@
 #include "frc971/wpilib/spi_rx_clearer.h"
 
 #include <fcntl.h>
-#include <inttypes.h>
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <cinttypes>
+
 #include "aos/logging/logging.h"
 
 namespace frc971 {
diff --git a/frc971/wpilib/spi_rx_clearer.h b/frc971/wpilib/spi_rx_clearer.h
index 17936ab..e385d21 100644
--- a/frc971/wpilib/spi_rx_clearer.h
+++ b/frc971/wpilib/spi_rx_clearer.h
@@ -1,7 +1,7 @@
 #ifndef FRC971_WPILIB_SPI_RX_CLEARER_H_
 #define FRC971_WPILIB_SPI_RX_CLEARER_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 namespace frc971 {
 namespace wpilib {
@@ -38,4 +38,4 @@
 }  // namespace wpilib
 }  // namespace frc971
 
-#endif // FRC971_WPILIB_SPI_RX_CLEARER_H_
+#endif  // FRC971_WPILIB_SPI_RX_CLEARER_H_
diff --git a/frc971/wpilib/wpilib_interface.h b/frc971/wpilib/wpilib_interface.h
index 8ab92ef..b992aa3 100644
--- a/frc971/wpilib/wpilib_interface.h
+++ b/frc971/wpilib/wpilib_interface.h
@@ -1,7 +1,7 @@
 #ifndef FRC971_WPILIB_WPILIB_INTERFACE_H_
 #define FRC971_WPILIB_WPILIB_INTERFACE_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "aos/events/event_loop.h"
 #include "frc971/input/robot_state_generated.h"
diff --git a/frc971/zeroing/averager.h b/frc971/zeroing/averager.h
index 23a1b06..0e15d13 100644
--- a/frc971/zeroing/averager.h
+++ b/frc971/zeroing/averager.h
@@ -3,7 +3,7 @@
 
 #include <algorithm>
 #include <array>
-#include <stdint.h>
+#include <cstdint>
 
 #include "Eigen/Dense"
 #include "glog/logging.h"
diff --git a/y2012/joystick_reader.cc b/y2012/joystick_reader.cc
index 50052c7..eb8c787 100644
--- a/y2012/joystick_reader.cc
+++ b/y2012/joystick_reader.cc
@@ -1,8 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
 #include "aos/actions/actions.h"
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2012/wpilib_interface.cc b/y2012/wpilib_interface.cc
index 15e1bbb..0d861a0 100644
--- a/y2012/wpilib_interface.cc
+++ b/y2012/wpilib_interface.cc
@@ -1,13 +1,13 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <chrono>
+#include <cinttypes>
+#include <cstdio>
+#include <cstring>
 #include <functional>
+#include <memory>
 #include <mutex>
 #include <thread>
-#include <memory>
 
 #include "frc971/wpilib/ahal/AnalogInput.h"
 #include "frc971/wpilib/ahal/Compressor.h"
diff --git a/y2014/actors/autonomous_actor.cc b/y2014/actors/autonomous_actor.cc
index 7d1eb3f..a78ab4b 100644
--- a/y2014/actors/autonomous_actor.cc
+++ b/y2014/actors/autonomous_actor.cc
@@ -1,8 +1,7 @@
 #include "y2014/actors/autonomous_actor.h"
 
-#include <stdio.h>
-
 #include <chrono>
+#include <cstdio>
 #include <memory>
 
 #include "aos/actions/actions.h"
@@ -272,7 +271,8 @@
     const double kSelectorStep = (kSelectorMax - kSelectorMin) / 3.0;
     if (auto_mode_fetcher_->voltage() < kSelectorStep + kSelectorMin) {
       auto_version = AutoVersion::kSingleHot;
-    } else if (auto_mode_fetcher_->voltage() < 2 * kSelectorStep + kSelectorMin) {
+    } else if (auto_mode_fetcher_->voltage() <
+               2 * kSelectorStep + kSelectorMin) {
       auto_version = AutoVersion::kStraight;
     } else {
       auto_version = AutoVersion::kDoubleHot;
@@ -331,7 +331,7 @@
   if (auto_version == AutoVersion::kDoubleHot) {
     if (ShouldCancel()) return true;
     StartDrive(0, first_shot_left ? kTurnAngle : -kTurnAngle,
-                 drive_with_ball_params, kFastTurn);
+               drive_with_ball_params, kFastTurn);
     WaitForDriveProfileDone();
     if (ShouldCancel()) return true;
   } else if (auto_version == AutoVersion::kSingleHot) {
diff --git a/y2014/actors/autonomous_actor_main.cc b/y2014/actors/autonomous_actor_main.cc
index 871933b..1a3b97e 100644
--- a/y2014/actors/autonomous_actor_main.cc
+++ b/y2014/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2014/actors/shoot_actor_main.cc b/y2014/actors/shoot_actor_main.cc
index a28e9a2..ac34356 100644
--- a/y2014/actors/shoot_actor_main.cc
+++ b/y2014/actors/shoot_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2014/constants.cc b/y2014/constants.cc
index 4c4c5cf..d6a8e5d 100644
--- a/y2014/constants.cc
+++ b/y2014/constants.cc
@@ -1,9 +1,8 @@
 #include "y2014/constants.h"
 
-#include <inttypes.h>
-#include <math.h>
-#include <stdint.h>
-
+#include <cinttypes>
+#include <cmath>
+#include <cstdint>
 #include <map>
 
 #if __has_feature(address_sanitizer)
@@ -14,7 +13,6 @@
 #include "aos/logging/logging.h"
 #include "aos/network/team_number.h"
 #include "aos/stl_mutex/stl_mutex.h"
-
 #include "y2014/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
 #include "y2014/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
 
diff --git a/y2014/constants.h b/y2014/constants.h
index 4ce3714..aa4ac26 100644
--- a/y2014/constants.h
+++ b/y2014/constants.h
@@ -1,7 +1,7 @@
 #ifndef Y2014_CONSTANTS_H_
 #define Y2014_CONSTANTS_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "frc971/control_loops/state_feedback_loop.h"
 #include "frc971/shifter_hall_effect.h"
diff --git a/y2014/control_loops/shooter/shooter.cc b/y2014/control_loops/shooter/shooter.cc
index 52f900a..230a048 100644
--- a/y2014/control_loops/shooter/shooter.cc
+++ b/y2014/control_loops/shooter/shooter.cc
@@ -1,9 +1,8 @@
 #include "y2014/control_loops/shooter/shooter.h"
 
-#include <stdio.h>
-
 #include <algorithm>
 #include <chrono>
+#include <cstdio>
 #include <limits>
 
 #include "aos/logging/logging.h"
diff --git a/y2014/hot_goal_reader.cc b/y2014/hot_goal_reader.cc
index 9f5dc87..5972a92 100644
--- a/y2014/hot_goal_reader.cc
+++ b/y2014/hot_goal_reader.cc
@@ -1,11 +1,12 @@
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <string.h>
-#include <netinet/in.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
 #include <unistd.h>
 
+#include <cerrno>
+#include <cstring>
+
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
 #include "aos/logging/logging.h"
diff --git a/y2014/joystick_reader.cc b/y2014/joystick_reader.cc
index d2a7ed9..d1569d7 100644
--- a/y2014/joystick_reader.cc
+++ b/y2014/joystick_reader.cc
@@ -1,8 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
 #include "aos/actions/actions.h"
 #include "aos/init.h"
 #include "aos/logging/logging.h"
diff --git a/y2014/wpilib_interface.cc b/y2014/wpilib_interface.cc
index ea87a18..3e34064 100644
--- a/y2014/wpilib_interface.cc
+++ b/y2014/wpilib_interface.cc
@@ -1,13 +1,13 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <chrono>
+#include <cinttypes>
+#include <cstdio>
+#include <cstring>
 #include <functional>
+#include <memory>
 #include <mutex>
 #include <thread>
-#include <memory>
 
 #include "frc971/wpilib/ahal/AnalogInput.h"
 #include "frc971/wpilib/ahal/Compressor.h"
diff --git a/y2014_bot3/actors/autonomous_actor.cc b/y2014_bot3/actors/autonomous_actor.cc
index 68064a5..2fc9d8b 100644
--- a/y2014_bot3/actors/autonomous_actor.cc
+++ b/y2014_bot3/actors/autonomous_actor.cc
@@ -1,7 +1,7 @@
 #include "y2014_bot3/actors/autonomous_actor.h"
 
-#include <inttypes.h>
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
 #include "aos/events/event_loop.h"
diff --git a/y2014_bot3/actors/autonomous_actor_main.cc b/y2014_bot3/actors/autonomous_actor_main.cc
index 06ff335..d8205cd 100644
--- a/y2014_bot3/actors/autonomous_actor_main.cc
+++ b/y2014_bot3/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2014_bot3/joystick_reader.cc b/y2014_bot3/joystick_reader.cc
index 92fa1e1..3d1159a 100644
--- a/y2014_bot3/joystick_reader.cc
+++ b/y2014_bot3/joystick_reader.cc
@@ -1,8 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
 #include "aos/init.h"
 #include "aos/logging/logging.h"
 #include "aos/time/time.h"
diff --git a/y2014_bot3/output/motor_writer.cc b/y2014_bot3/output/motor_writer.cc
index 53748bc..0b0e17b 100644
--- a/y2014_bot3/output/motor_writer.cc
+++ b/y2014_bot3/output/motor_writer.cc
@@ -1,8 +1,8 @@
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
-#include "frc971/control_loops/output_check.q.h"
+#include <cstdio>
+#include <cstring>
+
 #include "aos/init.h"
 #include "aos/logging/logging.h"
 #include "aos/logging/queue_logging.h"
@@ -11,6 +11,7 @@
 #include "aos/util/log_interval.h"
 #include "bot3/control_loops/drivetrain/drivetrain.q.h"
 #include "bot3/control_loops/rollers/rollers.q.h"
+#include "frc971/control_loops/output_check.q.h"
 
 using ::aos::util::SimpleLogInterval;
 
diff --git a/y2014_bot3/wpilib_interface.cc b/y2014_bot3/wpilib_interface.cc
index cdb85c2..b4de681 100644
--- a/y2014_bot3/wpilib_interface.cc
+++ b/y2014_bot3/wpilib_interface.cc
@@ -1,13 +1,13 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <chrono>
+#include <cinttypes>
+#include <cstdio>
+#include <cstring>
 #include <functional>
+#include <memory>
 #include <mutex>
 #include <thread>
-#include <memory>
 
 #include "frc971/wpilib/ahal/AnalogInput.h"
 #include "frc971/wpilib/ahal/Compressor.h"
@@ -49,13 +49,13 @@
 #define M_PI 3.14159265358979323846
 #endif
 
-using std::make_unique;
 using ::aos::util::SimpleLogInterval;
 using ::frc971::wpilib::BufferedPcm;
 using ::frc971::wpilib::BufferedSolenoid;
 using ::frc971::wpilib::GyroSender;
 using ::frc971::wpilib::JoystickSender;
 using ::frc971::wpilib::LoopOutputHandler;
+using std::make_unique;
 
 namespace y2014_bot3 {
 namespace wpilib {
diff --git a/y2016/actors/autonomous_actor.cc b/y2016/actors/autonomous_actor.cc
index 0b11bdd..c35612f 100644
--- a/y2016/actors/autonomous_actor.cc
+++ b/y2016/actors/autonomous_actor.cc
@@ -1,13 +1,11 @@
 #include "y2016/actors/autonomous_actor.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
 #include "aos/logging/logging.h"
 #include "aos/util/phased_loop.h"
-
 #include "y2016/control_loops/drivetrain/drivetrain_base.h"
 #include "y2016/control_loops/shooter/shooter_goal_generated.h"
 #include "y2016/control_loops/shooter/shooter_status_generated.h"
@@ -63,8 +61,7 @@
       vision_align_actor_factory_(
           actors::VisionAlignActor::MakeFactory(event_loop)),
       vision_status_fetcher_(
-          event_loop->MakeFetcher<::y2016::vision::VisionStatus>(
-              "/vision")),
+          event_loop->MakeFetcher<::y2016::vision::VisionStatus>("/vision")),
       ball_detector_fetcher_(
           event_loop->MakeFetcher<::y2016::sensors::BallDetector>(
               "/superstructure")),
@@ -971,7 +968,7 @@
   if (!WaitForDriveDone()) return true;
 
   AOS_LOG(INFO, "Done %f\n",
-      ::aos::time::DurationInSeconds(monotonic_now() - start_time));
+          ::aos::time::DurationInSeconds(monotonic_now() - start_time));
 
   ::aos::time::PhasedLoop phased_loop(::std::chrono::milliseconds(5),
                                       monotonic_now(),
diff --git a/y2016/actors/autonomous_actor_main.cc b/y2016/actors/autonomous_actor_main.cc
index b422faf..4dc2721 100644
--- a/y2016/actors/autonomous_actor_main.cc
+++ b/y2016/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2016/actors/superstructure_actor_main.cc b/y2016/actors/superstructure_actor_main.cc
index 4cc65a1..46c3b55 100644
--- a/y2016/actors/superstructure_actor_main.cc
+++ b/y2016/actors/superstructure_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2016/actors/vision_align_actor_main.cc b/y2016/actors/vision_align_actor_main.cc
index 518b405..37c3183 100644
--- a/y2016/actors/vision_align_actor_main.cc
+++ b/y2016/actors/vision_align_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2016/constants.cc b/y2016/constants.cc
index 1f4ae9e..363ef26 100644
--- a/y2016/constants.cc
+++ b/y2016/constants.cc
@@ -1,9 +1,8 @@
 #include "y2016/constants.h"
 
-#include <inttypes.h>
-#include <math.h>
-#include <stdint.h>
-
+#include <cinttypes>
+#include <cmath>
+#include <cstdint>
 #include <map>
 
 #if __has_feature(address_sanitizer)
@@ -14,7 +13,6 @@
 #include "aos/logging/logging.h"
 #include "aos/network/team_number.h"
 #include "aos/stl_mutex/stl_mutex.h"
-
 #include "y2016/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
 #include "y2016/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
 
diff --git a/y2016/constants.h b/y2016/constants.h
index 3cbb895..f332e37 100644
--- a/y2016/constants.h
+++ b/y2016/constants.h
@@ -1,17 +1,17 @@
 #ifndef Y2016_CONSTANTS_H_
 #define Y2016_CONSTANTS_H_
 
-#include <stdint.h>
+#include <cstdint>
 
+#include "frc971/constants.h"
 #include "frc971/control_loops/state_feedback_loop.h"
 #include "frc971/shifter_hall_effect.h"
-#include "frc971/constants.h"
 
 namespace y2016 {
 namespace constants {
 
-using ::frc971::constants::ShifterHallEffect;
 using ::frc971::constants::PotAndIndexPulseZeroingConstants;
+using ::frc971::constants::ShifterHallEffect;
 
 // Has all of the numbers that change for both robots and makes it easy to
 // retrieve the values for the current one.
diff --git a/y2016/joystick_reader.cc b/y2016/joystick_reader.cc
index 7a2ce81..974adf7 100644
--- a/y2016/joystick_reader.cc
+++ b/y2016/joystick_reader.cc
@@ -1,8 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
 #include "aos/actions/actions.h"
 #include "aos/init.h"
 #include "aos/logging/logging.h"
diff --git a/y2016/vision/debug_receiver.cc b/y2016/vision/debug_receiver.cc
index d3c527c..e89e9d8 100644
--- a/y2016/vision/debug_receiver.cc
+++ b/y2016/vision/debug_receiver.cc
@@ -1,24 +1,23 @@
-#include <stdio.h>
-#include <stdlib.h>
+#include <gtk/gtk.h>
 #include <netdb.h>
 #include <unistd.h>
 
-#include <vector>
+#include <cstdio>
+#include <cstdlib>
 #include <memory>
+#include <vector>
 
-#include <gtk/gtk.h>
-#include "aos/vision/image/image_types.h"
-#include "aos/vision/image/jpeg_routines.h"
+#include "aos/vision/blob/codec.h"
+#include "aos/vision/blob/range_image.h"
+#include "aos/vision/blob/stream_view.h"
+#include "aos/vision/events/epoll_events.h"
 #include "aos/vision/events/socket_types.h"
 #include "aos/vision/events/tcp_client.h"
-#include "aos/vision/events/epoll_events.h"
-#include "aos/vision/blob/range_image.h"
-#include "aos/vision/blob/codec.h"
-#include "aos/vision/blob/stream_view.h"
-
-#include "y2016/vision/vision_data.pb.h"
-#include "y2016/vision/stereo_geometry.h"
+#include "aos/vision/image/image_types.h"
+#include "aos/vision/image/jpeg_routines.h"
 #include "y2016/vision/blob_filters.h"
+#include "y2016/vision/stereo_geometry.h"
+#include "y2016/vision/vision_data.pb.h"
 
 using namespace aos::vision;
 
@@ -69,9 +68,9 @@
  private:
   void DrawCross(PixelLinesOverlay &overlay, Vector<2> center, PixelRef color) {
     overlay.AddLine(Vector<2>(center.x() - 50, center.y()),
-                     Vector<2>(center.x() + 50, center.y()), color);
+                    Vector<2>(center.x() + 50, center.y()), color);
     overlay.AddLine(Vector<2>(center.x(), center.y() - 50),
-                     Vector<2>(center.x(), center.y() + 50), color);
+                    Vector<2>(center.x(), center.y() + 50), color);
   }
 
   // where we darw for debugging
@@ -128,6 +127,7 @@
       img_read_ = -1;
     }
   }
+
  private:
   data_len len_;
   int num_read_;
diff --git a/y2016/vision/target_receiver.cc b/y2016/vision/target_receiver.cc
index cc9f41b..a762e4f 100644
--- a/y2016/vision/target_receiver.cc
+++ b/y2016/vision/target_receiver.cc
@@ -1,10 +1,10 @@
 #include <netdb.h>
-#include <stdlib.h>
 #include <unistd.h>
 
 #include <array>
 #include <atomic>
 #include <chrono>
+#include <cstdlib>
 #include <limits>
 #include <memory>
 #include <thread>
diff --git a/y2016/vision/target_sender.cc b/y2016/vision/target_sender.cc
index bc2a695..a0a0dc7 100644
--- a/y2016/vision/target_sender.cc
+++ b/y2016/vision/target_sender.cc
@@ -1,6 +1,7 @@
-#include <stdio.h>
-#include <stdlib.h>
 #include <sys/stat.h>
+
+#include <cstdio>
+#include <cstdlib>
 #include <fstream>
 #include <iostream>
 #include <memory>
@@ -19,22 +20,22 @@
 
 namespace y2016 {
 namespace vision {
-using aos::vision::ImageStreamEvent;
-using aos::vision::DataRef;
-using aos::events::TCPServer;
-using aos::vision::BlobLRef;
-using aos::vision::Vector;
-using aos::vision::Int32Codec;
-using aos::vision::BlobList;
-using aos::vision::RangeImage;
-using aos::vision::PixelRef;
-using aos::vision::ImageValue;
-using aos::vision::HistogramBlobFilter;
-using aos::vision::CornerFinder;
-using aos::vision::Int64Codec;
-using aos::events::TXUdpSocket;
 using aos::events::DataSocket;
+using aos::events::TCPServer;
+using aos::events::TXUdpSocket;
+using aos::vision::BlobList;
+using aos::vision::BlobLRef;
+using aos::vision::CornerFinder;
+using aos::vision::DataRef;
+using aos::vision::HistogramBlobFilter;
 using aos::vision::ImageFormat;
+using aos::vision::ImageStreamEvent;
+using aos::vision::ImageValue;
+using aos::vision::Int32Codec;
+using aos::vision::Int64Codec;
+using aos::vision::PixelRef;
+using aos::vision::RangeImage;
+using aos::vision::Vector;
 
 ::aos::vision::CameraParams GetCameraParams(const Calibration &calibration) {
   ::aos::vision::CameraParams params;
diff --git a/y2016/vision/tools/blob_stream_replay.cc b/y2016/vision/tools/blob_stream_replay.cc
index acf4d4b..847f654 100644
--- a/y2016/vision/tools/blob_stream_replay.cc
+++ b/y2016/vision/tools/blob_stream_replay.cc
@@ -1,20 +1,20 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <vector>
-#include <memory>
 #include <endian.h>
-#include <sys/stat.h>
-#include <fstream>
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
+#include <sys/stat.h>
 
-#include "aos/vision/image/reader.h"
-#include "aos/vision/image/jpeg_routines.h"
-#include "aos/vision/image/image_stream.h"
+#include <cstdio>
+#include <cstdlib>
+#include <fstream>
+#include <memory>
+#include <vector>
+
+#include "aos/vision/blob/stream_view.h"
 #include "aos/vision/events/epoll_events.h"
 #include "aos/vision/events/tcp_server.h"
-#include "aos/vision/blob/stream_view.h"
+#include "aos/vision/image/image_stream.h"
+#include "aos/vision/image/jpeg_routines.h"
+#include "aos/vision/image/reader.h"
 #include "y2016/vision/blob_filters.h"
 // #include "y2016/vision/process_targets.h"
 
@@ -22,7 +22,8 @@
 namespace vision {
 using namespace aos::vision;
 
-::aos::vision::Vector<2> CreateCenterFromTarget(double lx, double ly, double rx, double ry) {
+::aos::vision::Vector<2> CreateCenterFromTarget(double lx, double ly, double rx,
+                                                double ry) {
   return ::aos::vision::Vector<2>((lx + rx) / 2.0, (ly + ry) / 2.0);
 }
 
@@ -32,8 +33,8 @@
   return ::std::hypot(dx, dy);
 }
 
-void SelectTargets(std::vector<std::pair<Vector<2>, Vector<2>>>& left_target,
-                   std::vector<std::pair<Vector<2>, Vector<2>>>&right_target,
+void SelectTargets(std::vector<std::pair<Vector<2>, Vector<2>>> &left_target,
+                   std::vector<std::pair<Vector<2>, Vector<2>>> &right_target,
                    ::aos::vision::Vector<2> *center_left,
                    ::aos::vision::Vector<2> *center_right) {
   // No good targets. Let the caller decide defaults.
@@ -43,12 +44,12 @@
 
   // Only one option, we have to go with it.
   if (right_target.size() == 1 && left_target.size() == 1) {
-    *center_left =
-        CreateCenterFromTarget(left_target[0].first.x(), left_target[0].first.y(),
-                               left_target[0].second.x(), left_target[0].second.y());
+    *center_left = CreateCenterFromTarget(
+        left_target[0].first.x(), left_target[0].first.y(),
+        left_target[0].second.x(), left_target[0].second.y());
     *center_right = CreateCenterFromTarget(
-        right_target[0].first.x(), right_target[0].first.y(), right_target[0].second.x(),
-        right_target[0].second.y());
+        right_target[0].first.x(), right_target[0].first.y(),
+        right_target[0].second.x(), right_target[0].second.y());
     return;
   }
 
@@ -57,12 +58,10 @@
   int left_index = 0;
   // First pick the widest target from the left.
   for (size_t i = 0; i < left_target.size(); i++) {
-    const double h = left_target[i].first.y() -
-                     left_target[i].second.y();
-    const double wid1 = TargetWidth(left_target[i].first.x(),
-                                    left_target[i].first.y(),
-                                    left_target[i].second.x(),
-                                    left_target[i].second.y());
+    const double h = left_target[i].first.y() - left_target[i].second.y();
+    const double wid1 =
+        TargetWidth(left_target[i].first.x(), left_target[i].first.y(),
+                    left_target[i].second.x(), left_target[i].second.y());
     const double angle = h / wid1;
     if (min_angle == -1.0 || ::std::abs(angle) < ::std::abs(min_angle)) {
       min_angle = angle;
@@ -70,21 +69,20 @@
     }
   }
   // Calculate the angle of the bottom edge for the left.
-  double h = left_target[left_index].first.y() -
-             left_target[left_index].second.y();
+  double h =
+      left_target[left_index].first.y() - left_target[left_index].second.y();
 
   double good_ang = min_angle;
   double min_ang_err = -1.0;
   int right_index = -1;
-  // Now pick the bottom edge angle from the right that lines up best with the left.
+  // Now pick the bottom edge angle from the right that lines up best with the
+  // left.
   for (size_t j = 0; j < right_target.size(); j++) {
-    double wid2 = TargetWidth(right_target[j].first.x(),
-                                right_target[j].first.y(),
-                                right_target[j].second.x(),
-                                right_target[j].second.y());
-    h = right_target[j].first.y() -
-        right_target[j].second.y();
-    double ang = h/ wid2;
+    double wid2 =
+        TargetWidth(right_target[j].first.x(), right_target[j].first.y(),
+                    right_target[j].second.x(), right_target[j].second.y());
+    h = right_target[j].first.y() - right_target[j].second.y();
+    double ang = h / wid2;
     double ang_err = ::std::abs(good_ang - ang);
     if (min_ang_err == -1.0 || min_ang_err > ang_err) {
       min_ang_err = ang_err;
@@ -92,19 +90,15 @@
     }
   }
 
-  *center_left =
-      CreateCenterFromTarget(left_target[left_index].first.x(),
-                             left_target[left_index].first.y(),
-                             left_target[left_index].second.x(),
-                             left_target[left_index].second.y());
-  *center_right =
-      CreateCenterFromTarget(right_target[right_index].first.x(),
-                             right_target[right_index].first.y(),
-                             right_target[right_index].second.x(),
-                             right_target[right_index].second.y());
+  *center_left = CreateCenterFromTarget(
+      left_target[left_index].first.x(), left_target[left_index].first.y(),
+      left_target[left_index].second.x(), left_target[left_index].second.y());
+  *center_right = CreateCenterFromTarget(right_target[right_index].first.x(),
+                                         right_target[right_index].first.y(),
+                                         right_target[right_index].second.x(),
+                                         right_target[right_index].second.y());
 }
 
-
 long GetFileSize(std::string filename) {
   struct stat stat_buf;
   int rc = stat(filename.c_str(), &stat_buf);
@@ -152,9 +146,10 @@
     prev_ = buf_;
     buf_ += sizeof(uint32_t);
     *timestamp = Int64Codec::Read(&buf_);
-//    auto* buf_tmp = buf_;
+    //    auto* buf_tmp = buf_;
     buf_ = ParseBlobList(blob_list, buf_);
-//    fprintf(stderr, "read frame: %lu, buf_size: %lu\n", *timestamp, buf_ - buf_tmp);
+    //    fprintf(stderr, "read frame: %lu, buf_size: %lu\n", *timestamp, buf_ -
+    //    buf_tmp);
     return true;
   }
 
@@ -217,8 +212,8 @@
         ifs2_(fname2),
         blob_filt_(fmt, 40, 750, 250000),
         finder_(0.25, 35) {
-    text_overlay_.draw_fn =
-        [this](RenderInterface *render, double /*width*/, double /*height*/) {
+    text_overlay_.draw_fn = [this](RenderInterface *render, double /*width*/,
+                                   double /*height*/) {
       render->SetSourceRGB(1.0, 1.0, 1.0);
       if (hud_text) render->Text(20, 20, 0, 0, kHudText);
     };
@@ -418,12 +413,14 @@
   void UpdateNewTime(int new_delta) {
     if (new_delta != ms_event_delta_) {
       ms_event_delta_ = new_delta;
-      SetTime(::std::chrono::milliseconds(ms_event_delta_) + aos::monotonic_clock::now());
+      SetTime(::std::chrono::milliseconds(ms_event_delta_) +
+              aos::monotonic_clock::now());
     }
   }
 
   void Done() override {
-    SetTime(::std::chrono::milliseconds(ms_event_delta_) + aos::monotonic_clock::now());
+    SetTime(::std::chrono::milliseconds(ms_event_delta_) +
+            aos::monotonic_clock::now());
     if (paused && !single_step) return;
     single_step = false;
     frame_count_++;
@@ -481,7 +478,8 @@
 
       if (seeking_target_) {
         if (play_forward) {
-          // Go back to the last time we didn't see a target and play from there.
+          // Go back to the last time we didn't see a target and play from
+          // there.
           TickBackFrame(nano_step);
           seeking_target_ = false;
         } else if (seeking_target_) {
@@ -525,9 +523,9 @@
 
   void DrawCross(PixelLinesOverlay &overlay, Vector<2> center, PixelRef color) {
     overlay.AddLine(Vector<2>(center.x() - 25, center.y()),
-                     Vector<2>(center.x() + 25, center.y()), color);
+                    Vector<2>(center.x() + 25, center.y()), color);
     overlay.AddLine(Vector<2>(center.x(), center.y() - 25),
-                     Vector<2>(center.x(), center.y() + 25), color);
+                    Vector<2>(center.x(), center.y() + 25), color);
   }
 
   void AddTo(aos::events::EpollLoop *loop) {
@@ -542,6 +540,7 @@
 
  private:
   int ms_event_delta_ = 200;
+
  public:
   // basic image size
   ImageFormat fmt_;
@@ -574,8 +573,8 @@
   // count how many frames we miss in a row.
   int missed_count_ = 16;
 };
-}
-}  // namespace y2016::vision
+}  // namespace vision
+}  // namespace y2016
 
 int main(int argc, char *argv[]) {
   using namespace y2016::vision;
@@ -597,8 +596,8 @@
   printf("file (%s) dbg_lvl (%d)\n", file.c_str(), dbg);
 
   std::string fname_path = file;
-  NetworkForwardingImageStream strm1(
-      fmt, dbg, fname_path + "_0.dat", fname_path + "_1.dat");
+  NetworkForwardingImageStream strm1(fmt, dbg, fname_path + "_0.dat",
+                                     fname_path + "_1.dat");
   fprintf(stderr, "staring main\n");
   strm1.AddTo(&loop);
 
diff --git a/y2016/wpilib_interface.cc b/y2016/wpilib_interface.cc
index e8ad2f6..e3d367c 100644
--- a/y2016/wpilib_interface.cc
+++ b/y2016/wpilib_interface.cc
@@ -1,10 +1,10 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <array>
 #include <chrono>
+#include <cinttypes>
+#include <cstdio>
+#include <cstring>
 #include <functional>
 #include <mutex>
 #include <thread>
@@ -53,8 +53,8 @@
 #include "y2016/control_loops/superstructure/superstructure_position_generated.h"
 #include "y2016/queues/ball_detector_generated.h"
 
-using std::make_unique;
 using ::frc971::wpilib::LoopOutputHandler;
+using std::make_unique;
 namespace shooter = ::y2016::control_loops::shooter;
 namespace superstructure = ::y2016::control_loops::superstructure;
 
diff --git a/y2017/actors/autonomous_actor.cc b/y2017/actors/autonomous_actor.cc
index 1124780..b683f51 100644
--- a/y2017/actors/autonomous_actor.cc
+++ b/y2017/actors/autonomous_actor.cc
@@ -1,8 +1,7 @@
 #include "y2017/actors/autonomous_actor.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
 #include "aos/logging/logging.h"
diff --git a/y2017/actors/autonomous_actor_main.cc b/y2017/actors/autonomous_actor_main.cc
index 436902c..ae13d15 100644
--- a/y2017/actors/autonomous_actor_main.cc
+++ b/y2017/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2017/constants.cc b/y2017/constants.cc
index ab062e2..654edf8 100644
--- a/y2017/constants.cc
+++ b/y2017/constants.cc
@@ -1,9 +1,8 @@
 #include "y2017/constants.h"
 
-#include <inttypes.h>
-#include <math.h>
-#include <stdint.h>
-
+#include <cinttypes>
+#include <cmath>
+#include <cstdint>
 #include <map>
 
 #if __has_feature(address_sanitizer)
@@ -14,7 +13,6 @@
 #include "aos/logging/logging.h"
 #include "aos/network/team_number.h"
 #include "aos/stl_mutex/stl_mutex.h"
-
 #include "y2017/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
 #include "y2017/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
 
diff --git a/y2017/constants.h b/y2017/constants.h
index b8bf70a..9c0f3c2 100644
--- a/y2017/constants.h
+++ b/y2017/constants.h
@@ -1,12 +1,11 @@
 #ifndef Y2017_CONSTANTS_H_
 #define Y2017_CONSTANTS_H_
 
-#include <stdint.h>
-#include <math.h>
+#include <cmath>
+#include <cstdint>
 
 #include "frc971/constants.h"
 #include "frc971/shooter_interpolation/interpolation.h"
-
 #include "y2017/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
 #include "y2017/control_loops/superstructure/column/column_plant.h"
 #include "y2017/control_loops/superstructure/hood/hood_plant.h"
@@ -90,8 +89,8 @@
       control_loops::superstructure::hood::kOutputRatio /
       constants::Values::kHoodEncoderRatio * kHoodEncoderCountsPerRevolution;
   static constexpr ::frc971::constants::Range kHoodRange{
-      -0.39 * M_PI / 180.0 - 0.01, 37.11 * M_PI / 180.0, (-0.39 + 1.0) * M_PI / 180.0,
-      (37.11 - 1.0) * M_PI / 180.0};
+      -0.39 * M_PI / 180.0 - 0.01, 37.11 * M_PI / 180.0,
+      (-0.39 + 1.0) * M_PI / 180.0, (37.11 - 1.0) * M_PI / 180.0};
 
   static constexpr double kTurretEncoderCountsPerRevolution = 256 * 4;
   static constexpr double kTurretEncoderRatio = 11.0 / 94.0;
diff --git a/y2017/control_loops/superstructure/vision_distance_average.h b/y2017/control_loops/superstructure/vision_distance_average.h
index 7af2a9b..5f81586 100644
--- a/y2017/control_loops/superstructure/vision_distance_average.h
+++ b/y2017/control_loops/superstructure/vision_distance_average.h
@@ -1,8 +1,8 @@
 #ifndef Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_VISION_DISTANCE_AVERAGE_H_
 #define Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_VISION_DISTANCE_AVERAGE_H_
 
-#include <stdint.h>
 #include <chrono>
+#include <cstdint>
 
 #include "aos/containers/ring_buffer.h"
 #include "aos/time/time.h"
diff --git a/y2017/control_loops/superstructure/vision_time_adjuster.h b/y2017/control_loops/superstructure/vision_time_adjuster.h
index 3c873f7..45dd8bb 100644
--- a/y2017/control_loops/superstructure/vision_time_adjuster.h
+++ b/y2017/control_loops/superstructure/vision_time_adjuster.h
@@ -1,7 +1,7 @@
 #ifndef Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_VISION_TIME_ADJUSTER_H_
 #define Y2017_CONTROL_LOOPS_SUPERSTRUCTURE_VISION_TIME_ADJUSTER_H_
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "aos/containers/ring_buffer.h"
 #include "aos/events/event_loop.h"
diff --git a/y2017/joystick_reader.cc b/y2017/joystick_reader.cc
index 628de2a..13b8720 100644
--- a/y2017/joystick_reader.cc
+++ b/y2017/joystick_reader.cc
@@ -1,8 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
 #include "aos/actions/actions.h"
 #include "aos/init.h"
 #include "aos/logging/logging.h"
diff --git a/y2017/vision/target_finder.cc b/y2017/vision/target_finder.cc
index 91e801e..f7a958c 100644
--- a/y2017/vision/target_finder.cc
+++ b/y2017/vision/target_finder.cc
@@ -1,6 +1,6 @@
 #include "y2017/vision/target_finder.h"
 
-#include <math.h>
+#include <cmath>
 
 namespace y2017 {
 namespace vision {
@@ -248,7 +248,7 @@
   *ry = vec.x() * sin_ang + vec.y() * cos_ang;
 }
 
-void TargetFinder::GetAngleDist(const aos::vision::Vector<2>& target,
+void TargetFinder::GetAngleDist(const aos::vision::Vector<2> &target,
                                 double down_angle, double *dist,
                                 double *angle) {
   // TODO(ben): Will put all these numbers in a config file before
diff --git a/y2017/vision/target_sender.cc b/y2017/vision/target_sender.cc
index 7a24d37..397eb04 100644
--- a/y2017/vision/target_sender.cc
+++ b/y2017/vision/target_sender.cc
@@ -1,8 +1,9 @@
 #include <google/protobuf/io/zero_copy_stream_impl.h>
 #include <google/protobuf/text_format.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <sys/stat.h>
+
+#include <cstdio>
+#include <cstdlib>
 #include <fstream>
 #include <iostream>
 #include <memory>
@@ -28,15 +29,15 @@
 namespace y2017 {
 namespace vision {
 
-using aos::events::TCPServer;
-using aos::vision::DataRef;
-using aos::vision::Int32Codec;
-using aos::vision::ImageValue;
-using aos::vision::Int64Codec;
-using aos::events::TXUdpSocket;
 using aos::events::DataSocket;
+using aos::events::TCPServer;
+using aos::events::TXUdpSocket;
+using aos::vision::DataRef;
 using aos::vision::ImageFormat;
 using aos::vision::ImageStreamEvent;
+using aos::vision::ImageValue;
+using aos::vision::Int32Codec;
+using aos::vision::Int64Codec;
 
 int64_t Nanos(aos::monotonic_clock::duration time_diff) {
   return std::chrono::duration_cast<std::chrono::nanoseconds>(time_diff)
diff --git a/y2017/wpilib_interface.cc b/y2017/wpilib_interface.cc
index e43bdb1..04e19b6 100644
--- a/y2017/wpilib_interface.cc
+++ b/y2017/wpilib_interface.cc
@@ -1,15 +1,15 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <array>
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <functional>
+#include <memory>
 #include <mutex>
 #include <thread>
-#include <memory>
 
 #include "frc971/wpilib/ahal/AnalogInput.h"
 #include "frc971/wpilib/ahal/Compressor.h"
diff --git a/y2018/actors/autonomous_actor.cc b/y2018/actors/autonomous_actor.cc
index 89082df..cee84d8 100644
--- a/y2018/actors/autonomous_actor.cc
+++ b/y2018/actors/autonomous_actor.cc
@@ -1,13 +1,11 @@
 #include "y2018/actors/autonomous_actor.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
 #include "aos/logging/logging.h"
 #include "aos/util/phased_loop.h"
-
 #include "y2018/control_loops/drivetrain/drivetrain_base.h"
 
 namespace y2018 {
diff --git a/y2018/actors/autonomous_actor_main.cc b/y2018/actors/autonomous_actor_main.cc
index bce375c..71f115e 100644
--- a/y2018/actors/autonomous_actor_main.cc
+++ b/y2018/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2018/constants.cc b/y2018/constants.cc
index 156bc5b..e6951cc 100644
--- a/y2018/constants.cc
+++ b/y2018/constants.cc
@@ -1,9 +1,8 @@
 #include "y2018/constants.h"
 
-#include <inttypes.h>
-#include <math.h>
-#include <stdint.h>
-
+#include <cinttypes>
+#include <cmath>
+#include <cstdint>
 #include <map>
 
 #if __has_feature(address_sanitizer)
@@ -13,7 +12,6 @@
 #include "aos/logging/logging.h"
 #include "aos/network/team_number.h"
 #include "aos/stl_mutex/stl_mutex.h"
-
 #include "y2018/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
 #include "y2018/control_loops/drivetrain/polydrivetrain_dog_motor_plant.h"
 
diff --git a/y2018/constants.h b/y2018/constants.h
index 44f0726..16f1f8c 100644
--- a/y2018/constants.h
+++ b/y2018/constants.h
@@ -1,11 +1,10 @@
 #ifndef Y2018_CONSTANTS_H_
 #define Y2018_CONSTANTS_H_
 
-#include <stdint.h>
-#include <math.h>
+#include <cmath>
+#include <cstdint>
 
 #include "frc971/constants.h"
-
 #include "y2018/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
 #include "y2018/control_loops/superstructure/arm/dynamics.h"
 #include "y2018/control_loops/superstructure/intake/intake_plant.h"
@@ -43,7 +42,9 @@
   static constexpr double kDrivetrainShifterPotMaxVoltage() { return 3.63; }
   static constexpr double kDrivetrainShifterPotMinVoltage() { return 1.94; }
 
-  static constexpr double kProximalEncoderCountsPerRevolution() { return 4096.0; }
+  static constexpr double kProximalEncoderCountsPerRevolution() {
+    return 4096.0;
+  }
   static constexpr double kProximalEncoderRatio() {
     return (12.0 / 60.0) * (18.0 / 84.0);
   }
@@ -84,8 +85,7 @@
 
   static constexpr ::frc971::constants::Range kIntakeRange() {
     // TODO(austin) Sort this out.
-    return ::frc971::constants::Range{-3.7, (1.25 * M_PI),
-                                      -3.3, M_PI};
+    return ::frc971::constants::Range{-3.7, (1.25 * M_PI), -3.3, M_PI};
   }
 
   struct IntakeSide {
diff --git a/y2018/control_loops/python/arm_bounds.cc b/y2018/control_loops/python/arm_bounds.cc
index 2c7b94c..1515192 100644
--- a/y2018/control_loops/python/arm_bounds.cc
+++ b/y2018/control_loops/python/arm_bounds.cc
@@ -3,7 +3,8 @@
 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
 #include <CGAL/Polygon_2_algorithms.h>
 #include <CGAL/squared_distance_2.h>
-#include <math.h>
+
+#include <cmath>
 #include <iostream>
 
 namespace y2018 {
diff --git a/y2018/control_loops/superstructure/arm/graph.cc b/y2018/control_loops/superstructure/arm/graph.cc
index 54ec79d..ad6f982 100644
--- a/y2018/control_loops/superstructure/arm/graph.cc
+++ b/y2018/control_loops/superstructure/arm/graph.cc
@@ -1,7 +1,7 @@
 #include "y2018/control_loops/superstructure/arm/graph.h"
 
-#include <assert.h>
 #include <algorithm>
+#include <cassert>
 
 namespace y2018 {
 namespace control_loops {
diff --git a/y2018/control_loops/superstructure/arm/graph.h b/y2018/control_loops/superstructure/arm/graph.h
index 6724eac..5d49dd0 100644
--- a/y2018/control_loops/superstructure/arm/graph.h
+++ b/y2018/control_loops/superstructure/arm/graph.h
@@ -1,9 +1,9 @@
 #ifndef Y2018_CONTROL_LOOPS_SUPERSTRUCTURE_ARM_GRAPH_H_
 #define Y2018_CONTROL_LOOPS_SUPERSTRUCTURE_ARM_GRAPH_H_
 
-#include <assert.h>
-#include <stdlib.h>
 #include <algorithm>
+#include <cassert>
+#include <cstdlib>
 #include <limits>
 #include <memory>
 #include <vector>
diff --git a/y2018/control_loops/superstructure/intake/intake.h b/y2018/control_loops/superstructure/intake/intake.h
index 7bc3986..09a7e4d 100644
--- a/y2018/control_loops/superstructure/intake/intake.h
+++ b/y2018/control_loops/superstructure/intake/intake.h
@@ -1,7 +1,7 @@
 #ifndef Y2018_CONTROL_LOOPS_SUPERSTRUCTURE_INTAKE_INTAKE_H_
 #define Y2018_CONTROL_LOOPS_SUPERSTRUCTURE_INTAKE_INTAKE_H_
 
-#include <math.h>
+#include <cmath>
 
 #include "aos/commonmath.h"
 #include "frc971/control_loops/control_loop.h"
diff --git a/y2018/joystick_reader.cc b/y2018/joystick_reader.cc
index b5df79a..42620ff 100644
--- a/y2018/joystick_reader.cc
+++ b/y2018/joystick_reader.cc
@@ -1,9 +1,9 @@
 #include <google/protobuf/stubs/stringprintf.h>
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <mutex>
 
 #include "aos/actions/actions.h"
diff --git a/y2018/wpilib_interface.cc b/y2018/wpilib_interface.cc
index e3175af..8c8560a 100644
--- a/y2018/wpilib_interface.cc
+++ b/y2018/wpilib_interface.cc
@@ -1,15 +1,16 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <array>
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <functional>
-#include <thread>
 #include <memory>
+#include <thread>
 
+#include "ctre/phoenix/CANifier.h"
 #include "frc971/wpilib/ahal/AnalogInput.h"
 #include "frc971/wpilib/ahal/Counter.h"
 #include "frc971/wpilib/ahal/DigitalGlitchFilter.h"
@@ -18,7 +19,6 @@
 #include "frc971/wpilib/ahal/Relay.h"
 #include "frc971/wpilib/ahal/Servo.h"
 #include "frc971/wpilib/ahal/VictorSP.h"
-#include "ctre/phoenix/CANifier.h"
 #undef ERROR
 
 #include "aos/commonmath.h"
@@ -55,8 +55,8 @@
 #define M_PI 3.14159265358979323846
 #endif
 
-using std::make_unique;
 using ::aos::monotonic_clock;
+using std::make_unique;
 using ::y2018::constants::Values;
 namespace chrono = ::std::chrono;
 namespace superstructure = ::y2018::control_loops::superstructure;
@@ -262,7 +262,8 @@
     box_back_beambreak_ = ::std::move(input);
   }
 
-  void set_lidar_lite_input(::std::unique_ptr<frc::DigitalInput> lidar_lite_input) {
+  void set_lidar_lite_input(
+      ::std::unique_ptr<frc::DigitalInput> lidar_lite_input) {
     lidar_lite_input_ = ::std::move(lidar_lite_input);
     lidar_lite_.set_input(lidar_lite_input_.get());
   }
@@ -277,17 +278,17 @@
 
       drivetrain_builder.add_left_encoder(
           drivetrain_translate(drivetrain_left_encoder_->GetRaw()));
-      drivetrain_builder.add_left_speed (
+      drivetrain_builder.add_left_speed(
           drivetrain_velocity_translate(drivetrain_left_encoder_->GetPeriod()));
-      drivetrain_builder.add_left_shifter_position (
+      drivetrain_builder.add_left_shifter_position(
           drivetrain_shifter_pot_translate(
               left_drivetrain_shifter_->GetVoltage()));
 
-      drivetrain_builder.add_right_encoder (
+      drivetrain_builder.add_right_encoder(
           -drivetrain_translate(drivetrain_right_encoder_->GetRaw()));
-      drivetrain_builder.add_right_speed (
-          -drivetrain_velocity_translate(drivetrain_right_encoder_->GetPeriod()));
-      drivetrain_builder.add_right_shifter_position (
+      drivetrain_builder.add_right_speed(-drivetrain_velocity_translate(
+          drivetrain_right_encoder_->GetPeriod()));
+      drivetrain_builder.add_right_shifter_position(
           drivetrain_shifter_pot_translate(
               right_drivetrain_shifter_->GetVoltage()));
 
@@ -299,8 +300,7 @@
     const auto values = constants::GetValues();
 
     {
-      auto builder =
-          superstructure_position_sender_.MakeBuilder();
+      auto builder = superstructure_position_sender_.MakeBuilder();
 
       // Proximal arm
       frc971::PotAndAbsolutePositionT arm_proximal;
@@ -330,8 +330,7 @@
 
       // Left intake
       frc971::PotAndAbsolutePositionT left_intake_motor_position;
-      CopyPosition(left_intake_encoder_,
-                   &left_intake_motor_position,
+      CopyPosition(left_intake_encoder_, &left_intake_motor_position,
                    Values::kIntakeMotorEncoderCountsPerRevolution(),
                    Values::kIntakeMotorEncoderRatio(), intake_pot_translate,
                    false, values.left_intake.potentiometer_offset);
@@ -342,15 +341,14 @@
 
       // Right intake
       frc971::PotAndAbsolutePositionT right_intake_motor_position;
-      CopyPosition(right_intake_encoder_,
-                   &right_intake_motor_position,
+      CopyPosition(right_intake_encoder_, &right_intake_motor_position,
                    Values::kIntakeMotorEncoderCountsPerRevolution(),
                    Values::kIntakeMotorEncoderRatio(), intake_pot_translate,
                    true, values.right_intake.potentiometer_offset);
       flatbuffers::Offset<frc971::PotAndAbsolutePosition>
           right_intake_motor_position_offset =
-              frc971::PotAndAbsolutePosition::Pack(*builder.fbb(),
-                                                   &right_intake_motor_position);
+              frc971::PotAndAbsolutePosition::Pack(
+                  *builder.fbb(), &right_intake_motor_position);
 
       superstructure::IntakeElasticSensors::Builder
           left_intake_sensors_builder =
@@ -780,8 +778,8 @@
     // Thread 4.
     ::aos::ShmEventLoop imu_event_loop(&config.message());
     auto imu_trigger = make_unique<frc::DigitalInput>(5);
-    ::frc971::wpilib::ADIS16448 imu(&imu_event_loop, frc::SPI::Port::kOnboardCS1,
-                                    imu_trigger.get());
+    ::frc971::wpilib::ADIS16448 imu(
+        &imu_event_loop, frc::SPI::Port::kOnboardCS1, imu_trigger.get());
     imu.SetDummySPI(frc::SPI::Port::kOnboardCS2);
     auto imu_reset = make_unique<frc::DigitalOutput>(6);
     imu.set_reset(imu_reset.get());
diff --git a/y2019/actors/autonomous_actor.cc b/y2019/actors/autonomous_actor.cc
index 078ad64..7622a64 100644
--- a/y2019/actors/autonomous_actor.cc
+++ b/y2019/actors/autonomous_actor.cc
@@ -1,13 +1,11 @@
 #include "y2019/actors/autonomous_actor.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
 #include "aos/logging/logging.h"
 #include "aos/util/phased_loop.h"
-
 #include "frc971/control_loops/drivetrain/localizer_generated.h"
 #include "y2019/actors/auto_splines.h"
 #include "y2019/control_loops/drivetrain/drivetrain_base.h"
@@ -15,8 +13,8 @@
 namespace y2019 {
 namespace actors {
 
-using ::frc971::ProfileParametersT;
 using ::aos::monotonic_clock;
+using ::frc971::ProfileParametersT;
 using frc971::control_loops::drivetrain::LocalizerControl;
 namespace chrono = ::std::chrono;
 
diff --git a/y2019/actors/autonomous_actor_main.cc b/y2019/actors/autonomous_actor_main.cc
index ec5234b..d04a806 100644
--- a/y2019/actors/autonomous_actor_main.cc
+++ b/y2019/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2019/constants.cc b/y2019/constants.cc
index 0a56ca5..f86110c 100644
--- a/y2019/constants.cc
+++ b/y2019/constants.cc
@@ -1,7 +1,6 @@
 #include "y2019/constants.h"
 
-#include <inttypes.h>
-
+#include <cinttypes>
 #include <map>
 
 #if __has_feature(address_sanitizer)
diff --git a/y2019/constants.h b/y2019/constants.h
index d1d0c7c..b6c1b55 100644
--- a/y2019/constants.h
+++ b/y2019/constants.h
@@ -2,18 +2,18 @@
 #define Y2019_CONSTANTS_H_
 
 #include <array>
-#include <math.h>
-#include <stdint.h>
+#include <cmath>
+#include <cstdint>
 
 #include "frc971/constants.h"
 #include "frc971/control_loops/drivetrain/camera.h"
+#include "frc971/control_loops/pose.h"
 #include "frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h"
 #include "y2019/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
 #include "y2019/control_loops/superstructure/elevator/elevator_plant.h"
 #include "y2019/control_loops/superstructure/intake/intake_plant.h"
 #include "y2019/control_loops/superstructure/stilts/stilts_plant.h"
 #include "y2019/control_loops/superstructure/wrist/wrist_plant.h"
-#include "frc971/control_loops/pose.h"
 
 namespace y2019 {
 namespace constants {
@@ -28,7 +28,6 @@
 //
 // All ratios are from the encoder shaft to the output units.
 
-
 class Field {
  public:
   typedef ::frc971::control_loops::TypedPose<double> Pose;
diff --git a/y2019/image_streamer/flip_image.h b/y2019/image_streamer/flip_image.h
index 7c31774..6837fb7 100644
--- a/y2019/image_streamer/flip_image.h
+++ b/y2019/image_streamer/flip_image.h
@@ -1,8 +1,9 @@
 #ifndef Y2019_IMAGE_STREAMER_FLIP_IMAGE_H_
 #define Y2019_IMAGE_STREAMER_FLIP_IMAGE_H_
 
-#include <stddef.h>
-#include <stdio.h>
+#include <cstddef>
+#include <cstdio>
+
 #include "third_party/libjpeg/jerror.h"
 #include "third_party/libjpeg/jpeglib.h"
 
diff --git a/y2019/jevois/camera/reader.cc b/y2019/jevois/camera/reader.cc
index 14faa24..259e650 100644
--- a/y2019/jevois/camera/reader.cc
+++ b/y2019/jevois/camera/reader.cc
@@ -1,17 +1,18 @@
 #include "y2019/jevois/camera/reader.h"
 
-#include <errno.h>
 #include <fcntl.h>
 #include <malloc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
 #include "aos/time/time.h"
 #include "glog/logging.h"
 
diff --git a/y2019/jevois/camera/reader.h b/y2019/jevois/camera/reader.h
index c5498fe..ef4f34d 100644
--- a/y2019/jevois/camera/reader.h
+++ b/y2019/jevois/camera/reader.h
@@ -1,7 +1,7 @@
 #ifndef AOS_VISION_IMAGE_READER_H_
 #define AOS_VISION_IMAGE_READER_H_
 
-#include <inttypes.h>
+#include <cinttypes>
 #include <functional>
 #include <string>
 
diff --git a/y2019/jevois/cobs.h b/y2019/jevois/cobs.h
index 0e92ed6..75761c9 100644
--- a/y2019/jevois/cobs.h
+++ b/y2019/jevois/cobs.h
@@ -1,10 +1,9 @@
 #ifndef Y2019_JEVOIS_COBS_H_
 #define Y2019_JEVOIS_COBS_H_
 
-#include <stdint.h>
-
 #include <algorithm>
 #include <array>
+#include <cstdint>
 
 #include "third_party/GSL/include/gsl/gsl"
 
diff --git a/y2019/jevois/spi.h b/y2019/jevois/spi.h
index 8b16d5c..59e321a 100644
--- a/y2019/jevois/spi.h
+++ b/y2019/jevois/spi.h
@@ -1,12 +1,11 @@
 #ifndef Y2019_JEVOIS_SPI_H_
 #define Y2019_JEVOIS_SPI_H_
 
-#include <stdint.h>
-
 #include <array>
+#include <cstdint>
+#include <optional>
 
 #include "third_party/GSL/include/gsl/gsl"
-#include <optional>
 #include "y2019/jevois/structures.h"
 
 // This file manages serializing and deserializing the various structures for
diff --git a/y2019/jevois/spi_test.cc b/y2019/jevois/spi_test.cc
index 84938f0..c600869 100644
--- a/y2019/jevois/spi_test.cc
+++ b/y2019/jevois/spi_test.cc
@@ -1,6 +1,6 @@
 #include "y2019/jevois/spi.h"
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "gtest/gtest.h"
 
diff --git a/y2019/jevois/structures.h b/y2019/jevois/structures.h
index fcf1ebe..b4bd755 100644
--- a/y2019/jevois/structures.h
+++ b/y2019/jevois/structures.h
@@ -1,14 +1,12 @@
 #ifndef Y2019_JEVOIS_STRUCTURES_H_
 #define Y2019_JEVOIS_STRUCTURES_H_
 
-#include <stdint.h>
-
 #include <array>
 #include <bitset>
 #include <chrono>
+#include <cstdint>
 
 #include "Eigen/Dense"
-
 #include "aos/containers/sized_array.h"
 #include "aos/time/time.h"
 #include "third_party/GSL/include/gsl/gsl"
@@ -58,9 +56,7 @@
     }
     return true;
   }
-  bool operator!=(const Target &other) const {
-    return !(*this == other);
-  }
+  bool operator!=(const Target &other) const { return !(*this == other); }
 
   // Distance to the target in meters. Specifically, the distance from the
   // center of the camera's image plane to the center of the target.
@@ -95,9 +91,7 @@
     }
     return true;
   }
-  bool operator!=(const CameraFrame &other) const {
-    return !(*this == other);
-  }
+  bool operator!=(const CameraFrame &other) const { return !(*this == other); }
 
   // The top most interesting targets found in this frame.
   aos::SizedArray<Target, 3> targets;
@@ -120,9 +114,7 @@
     }
     return true;
   }
-  bool operator!=(const RoborioFrame &other) const {
-    return !(*this == other);
-  }
+  bool operator!=(const RoborioFrame &other) const { return !(*this == other); }
 
   // The top most interesting targets found in this frame.
   aos::SizedArray<Target, 3> targets;
diff --git a/y2019/jevois/teensy.cc b/y2019/jevois/teensy.cc
index 4da89a8..038ece9 100644
--- a/y2019/jevois/teensy.cc
+++ b/y2019/jevois/teensy.cc
@@ -1,6 +1,5 @@
-#include <inttypes.h>
-#include <stdio.h>
-
+#include <cinttypes>
+#include <cstdio>
 #include <optional>
 
 #include "aos/time/time.h"
@@ -17,8 +16,8 @@
 #include "y2019/jevois/uart.h"
 #include "y2019/vision/constants.h"
 
-using frc971::teensy::InterruptBufferedUart;
 using frc971::teensy::InterruptBufferedSpi;
+using frc971::teensy::InterruptBufferedUart;
 
 // All indices here refer to the ports as numbered on the PCB.
 
@@ -126,7 +125,8 @@
     }
     const auto now = aos::monotonic_clock::now();
     if (TransferTimedOut(now)) {
-      printf("SPI timeout with %d left\n", static_cast<int>(to_receive_.size()));
+      printf("SPI timeout with %d left\n",
+             static_cast<int>(to_receive_.size()));
       WaitForNextTransfer();
       return std::nullopt;
     }
@@ -138,7 +138,8 @@
       }
     }
     if (DeassertHappened(now)) {
-      printf("CS deasserted with %d left\n", static_cast<int>(to_receive_.size()));
+      printf("CS deasserted with %d left\n",
+             static_cast<int>(to_receive_.size()));
       WaitForNextTransfer();
       return std::nullopt;
     }
@@ -441,9 +442,7 @@
   global_spi_instance->HandleInterrupt(disable_interrupts);
 }
 
-void porta_isr(void) {
-  SpiQueue::global_instance->HandleInterrupt();
-}
+void porta_isr(void) { SpiQueue::global_instance->HandleInterrupt(); }
 
 }  // extern "C"
 
@@ -1016,9 +1015,7 @@
 
 extern "C" {
 
-int main(void) {
-  return Main();
-}
+int main(void) { return Main(); }
 
 }  // extern "C"
 
diff --git a/y2019/jevois/uart_test.cc b/y2019/jevois/uart_test.cc
index 4f58e73..ff02f08 100644
--- a/y2019/jevois/uart_test.cc
+++ b/y2019/jevois/uart_test.cc
@@ -1,6 +1,6 @@
 #include "y2019/jevois/uart.h"
 
-#include <stdint.h>
+#include <cstdint>
 
 #include "gtest/gtest.h"
 
diff --git a/y2019/joystick_reader.cc b/y2019/joystick_reader.cc
index 7351130..a92dd90 100644
--- a/y2019/joystick_reader.cc
+++ b/y2019/joystick_reader.cc
@@ -1,9 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <chrono>
+#include <cmath>
+#include <cstdio>
+#include <cstring>
 
 #include "aos/actions/actions.h"
 #include "aos/init.h"
diff --git a/y2019/vision/constants.h b/y2019/vision/constants.h
index b61bff7..8510f4c 100644
--- a/y2019/vision/constants.h
+++ b/y2019/vision/constants.h
@@ -1,8 +1,8 @@
 #ifndef _Y2019_VISION_CONSTANTS_H_
 #define _Y2019_VISION_CONSTANTS_H_
 
-#include <math.h>
 #include <array>
+#include <cmath>
 #include <string>
 
 namespace y2019 {
diff --git a/y2019/vision/target_geometry.cc b/y2019/vision/target_geometry.cc
index 212759a..86ead34 100644
--- a/y2019/vision/target_geometry.cc
+++ b/y2019/vision/target_geometry.cc
@@ -1,16 +1,14 @@
-#include "y2019/vision/target_finder.h"
-
-#include "ceres/ceres.h"
-
-#include <math.h>
+#include <cmath>
 
 #include "aos/util/math.h"
+#include "ceres/ceres.h"
+#include "y2019/vision/target_finder.h"
 
 using ceres::CENTRAL;
 using ceres::CostFunction;
 using ceres::Problem;
-using ceres::Solver;
 using ceres::Solve;
+using ceres::Solver;
 
 namespace y2019 {
 namespace vision {
@@ -75,7 +73,7 @@
 // Used at runtime on a single image given camera parameters.
 struct PointCostFunctor {
   PointCostFunctor(Vector<2> result, Vector<2> template_pt,
-                     IntrinsicParams intrinsics)
+                   IntrinsicParams intrinsics)
       : result(result), template_pt(template_pt), intrinsics(intrinsics) {}
 
   template <typename T>
@@ -110,7 +108,7 @@
     // Distance from line(P1, P2) to point result
     T dx = p2.x() - p1.x();
     T dy = p2.y() - p1.y();
-    T denom = (p2-p1).norm();
+    T denom = (p2 - p1).norm();
     residual[0] = ceres::abs(dy * result.x() - dx * result.y() +
                              p2.x() * p1.y() - p2.y() * p1.x()) /
                   denom;
@@ -147,8 +145,7 @@
     down_axis.normalize();
 
     // Positive means out.
-    const T component =
-        down_axis.transpose() * (bottom_point_ - p1);
+    const T component = down_axis.transpose() * (bottom_point_ - p1);
 
     if (component > T(0)) {
       residual[0] = component * 1.0;
@@ -187,7 +184,7 @@
     aos::vision::Vector<2> b = target_value[i];
 
     if (i % 2 == 1) {
-      aos::vision::Vector<2> a2 = template_value[i-1];
+      aos::vision::Vector<2> a2 = template_value[i - 1];
       aos::vision::Segment<2> line = Segment<2>(a, a2);
 
       problem_4point.AddResidualBlock(
@@ -212,8 +209,8 @@
   Solver::Summary summary_8point;
   Solve(options, &problem_8point, &summary_8point);
 
-
-  // So, let's sneak up on it.  Start by warm-starting it with where we got on the 8 point solution.
+  // So, let's sneak up on it.  Start by warm-starting it with where we got on
+  // the 8 point solution.
   ExtrinsicParams::get(&params_8point[0]).set(&params_4point[0]);
   // Then solve without the bottom constraint.
   Solver::Summary summary_4point1;
@@ -334,7 +331,6 @@
     std::cout << "r1 = " << IR.backup_extrinsics.r1 * 180 / M_PI << ";\n";
     std::cout << "r2 = " << IR.backup_extrinsics.r2 * 180 / M_PI << ";\n";
 
-
     printf("left upper outer corner angle: %f, top (%f, %f), outer (%f, %f)\n",
            (outer_left_vector.transpose() * top_left_vector)(0),
            top_left_vector(0, 0), top_left_vector(1, 0),
diff --git a/y2019/wpilib_interface.cc b/y2019/wpilib_interface.cc
index 891031a..885bc12 100644
--- a/y2019/wpilib_interface.cc
+++ b/y2019/wpilib_interface.cc
@@ -1,15 +1,15 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <array>
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <functional>
+#include <memory>
 #include <mutex>
 #include <thread>
-#include <memory>
 
 #include "ctre/phoenix/CANifier.h"
 #include "frc971/wpilib/ahal/AnalogInput.h"
diff --git a/y2020/actors/autonomous_actor.cc b/y2020/actors/autonomous_actor.cc
index da64408..794d1e7 100644
--- a/y2020/actors/autonomous_actor.cc
+++ b/y2020/actors/autonomous_actor.cc
@@ -1,8 +1,7 @@
 #include "y2020/actors/autonomous_actor.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
 #include "aos/logging/logging.h"
@@ -89,10 +88,9 @@
                              std::placeholders::_1),
                    SplineDirection::kForward);
   } else if (FLAGS_spline_auto) {
-    test_spline_ =
-        PlanSpline(std::bind(&AutonomousSplines::TestSpline, &auto_splines_,
-                             std::placeholders::_1),
-                   SplineDirection::kForward);
+    test_spline_ = PlanSpline(std::bind(&AutonomousSplines::TestSpline,
+                                        &auto_splines_, std::placeholders::_1),
+                              SplineDirection::kForward);
   }
 }
 
@@ -305,16 +303,16 @@
   }
 
   superstructure::Goal::Builder superstructure_builder =
-        builder.MakeBuilder<superstructure::Goal>();
+      builder.MakeBuilder<superstructure::Goal>();
 
   superstructure_builder.add_intake(intake_offset);
   superstructure_builder.add_roller_voltage(roller_voltage_);
-  superstructure_builder.add_roller_speed_compensation(kRollerSpeedCompensation);
+  superstructure_builder.add_roller_speed_compensation(
+      kRollerSpeedCompensation);
 
   if (!builder.Send(superstructure_builder.Finish())) {
     AOS_LOG(ERROR, "Sending superstructure goal failed.\n");
   }
-
 }
 
 void AutonomousActor::RetractIntake() {
diff --git a/y2020/actors/autonomous_actor_main.cc b/y2020/actors/autonomous_actor_main.cc
index dcd0133..f9decd6 100644
--- a/y2020/actors/autonomous_actor_main.cc
+++ b/y2020/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2020/constants.cc b/y2020/constants.cc
index 07d10ee..893613a 100644
--- a/y2020/constants.cc
+++ b/y2020/constants.cc
@@ -1,7 +1,6 @@
 #include "y2020/constants.h"
 
-#include <inttypes.h>
-
+#include <cinttypes>
 #include <map>
 
 #if __has_feature(address_sanitizer)
diff --git a/y2020/constants.h b/y2020/constants.h
index 85f9768..77f78f4 100644
--- a/y2020/constants.h
+++ b/y2020/constants.h
@@ -1,10 +1,9 @@
 #ifndef y2020_CONSTANTS_H_
 #define y2020_CONSTANTS_H_
 
-#include <math.h>
-#include <stdint.h>
-
 #include <array>
+#include <cmath>
+#include <cstdint>
 
 #include "frc971/constants.h"
 #include "frc971/control_loops/static_zeroing_single_dof_profiled_subsystem.h"
@@ -191,10 +190,11 @@
   struct ShotParams {
     // Measured in radians
     double hood_angle;
-    // Angular velocity in radians per second of the slowest (lowest) wheel in the kicker.
-    // Positive is shooting the ball.
+    // Angular velocity in radians per second of the slowest (lowest) wheel in
+    // the kicker. Positive is shooting the ball.
     double accelerator_power;
-    // Angular velocity in radians per seconds of the flywheel. Positive is shooting.
+    // Angular velocity in radians per seconds of the flywheel. Positive is
+    // shooting.
     double finisher_power;
 
     static ShotParams BlendY(double coefficient, ShotParams a1, ShotParams a2) {
@@ -207,8 +207,7 @@
   };
 
   // { distance_to_target, { hood_angle, accelerator_power, finisher_power }}
-  InterpolationTable<ShotParams>
-      shot_interpolation_table;
+  InterpolationTable<ShotParams> shot_interpolation_table;
 };
 
 // Creates (once) a Values instance for ::aos::network::GetTeamNumber() and
diff --git a/y2020/joystick_reader.cc b/y2020/joystick_reader.cc
index 3e828cf..44d8a42 100644
--- a/y2020/joystick_reader.cc
+++ b/y2020/joystick_reader.cc
@@ -1,8 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
 #include "aos/actions/actions.h"
 #include "aos/init.h"
 #include "aos/logging/logging.h"
diff --git a/y2020/vision/sift/sift971.cc b/y2020/vision/sift/sift971.cc
index 93d71e4..788ae23 100644
--- a/y2020/vision/sift/sift971.cc
+++ b/y2020/vision/sift/sift971.cc
@@ -106,13 +106,13 @@
 
 #include "y2020/vision/sift/sift971.h"
 
+#include <cstdarg>
 #include <iostream>
 #include <mutex>
-#include <stdarg.h>
 #include <opencv2/core/hal/hal.hpp>
 #include <opencv2/imgproc.hpp>
-#include "glog/logging.h"
 
+#include "glog/logging.h"
 #include "y2020/vision/sift/fast_gaussian.h"
 
 using namespace cv;
diff --git a/y2020/wpilib_interface.cc b/y2020/wpilib_interface.cc
index 4e623d6..914c9c6 100644
--- a/y2020/wpilib_interface.cc
+++ b/y2020/wpilib_interface.cc
@@ -1,15 +1,15 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <array>
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <functional>
+#include <memory>
 #include <mutex>
 #include <thread>
-#include <memory>
 
 #include "frc971/wpilib/ahal/AnalogInput.h"
 #include "frc971/wpilib/ahal/Counter.h"
diff --git a/y2021_bot3/actors/autonomous_actor.cc b/y2021_bot3/actors/autonomous_actor.cc
index 39174d3..c6ea7c5 100644
--- a/y2021_bot3/actors/autonomous_actor.cc
+++ b/y2021_bot3/actors/autonomous_actor.cc
@@ -1,8 +1,7 @@
 #include "y2021_bot3/actors/autonomous_actor.h"
 
-#include <inttypes.h>
-
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
 
 #include "aos/logging/logging.h"
diff --git a/y2021_bot3/actors/autonomous_actor_main.cc b/y2021_bot3/actors/autonomous_actor_main.cc
index cd71dc8..daf68e0 100644
--- a/y2021_bot3/actors/autonomous_actor_main.cc
+++ b/y2021_bot3/actors/autonomous_actor_main.cc
@@ -1,4 +1,4 @@
-#include <stdio.h>
+#include <cstdio>
 
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
diff --git a/y2021_bot3/constants.cc b/y2021_bot3/constants.cc
index 984b844..707ecd6 100644
--- a/y2021_bot3/constants.cc
+++ b/y2021_bot3/constants.cc
@@ -1,7 +1,6 @@
 #include "y2021_bot3/constants.h"
 
-#include <inttypes.h>
-
+#include <cinttypes>
 #include <map>
 
 #if __has_feature(address_sanitizer)
diff --git a/y2021_bot3/constants.h b/y2021_bot3/constants.h
index fa95550..02c08bc 100644
--- a/y2021_bot3/constants.h
+++ b/y2021_bot3/constants.h
@@ -1,10 +1,9 @@
 #ifndef Y2021_BOT3_CONSTANTS_H_
 #define Y2021_BOT3_CONSTANTS_H_
 
-#include <math.h>
-#include <stdint.h>
-
 #include <array>
+#include <cmath>
+#include <cstdint>
 
 #include "frc971/constants.h"
 #include "frc971/control_loops/pose.h"
diff --git a/y2021_bot3/joystick_reader.cc b/y2021_bot3/joystick_reader.cc
index 88d16b2..7cdb296 100644
--- a/y2021_bot3/joystick_reader.cc
+++ b/y2021_bot3/joystick_reader.cc
@@ -1,8 +1,9 @@
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
 #include "aos/actions/actions.h"
 #include "aos/init.h"
 #include "aos/logging/logging.h"
diff --git a/y2021_bot3/wpilib_interface.cc b/y2021_bot3/wpilib_interface.cc
index 6f427ce..3b6b691 100644
--- a/y2021_bot3/wpilib_interface.cc
+++ b/y2021_bot3/wpilib_interface.cc
@@ -1,15 +1,15 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 
 #include <array>
 #include <chrono>
+#include <cinttypes>
 #include <cmath>
+#include <cstdio>
+#include <cstring>
 #include <functional>
+#include <memory>
 #include <mutex>
 #include <thread>
-#include <memory>
 
 #include "ctre/phoenix/CANifier.h"
 #include "frc971/wpilib/ahal/AnalogInput.h"