Merge "run control loops and write their output on new sensor values"
diff --git a/aos/linux_code/logging/log_displayer.cc b/aos/linux_code/logging/log_displayer.cc
index b2f4d45..861b5cb 100644
--- a/aos/linux_code/logging/log_displayer.cc
+++ b/aos/linux_code/logging/log_displayer.cc
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <getopt.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -10,6 +11,7 @@
 #include <memory>
 #include <string>
 
+#include "aos/linux_code/configuration.h"
 #include "aos/linux_code/logging/binary_log_file.h"
 #include "aos/common/queue_types.h"
 #include "aos/common/logging/logging_impl.h"
@@ -61,8 +63,17 @@
 
   // Get the possible executables from start_list.txt.
   FILE *start_list = fopen("start_list.txt", "r");
-  if (start_list == NULL) {
-    PLOG(FATAL, "Unable to open start_list.txt");
+  if (!start_list) {
+    ::std::string path(::aos::configuration::GetRootDirectory());
+    path += "/start_list.txt";
+    start_list = fopen(path.c_str(), "r");
+    if (!start_list) {
+      printf("\nCannot open start_list.txt. This means that the\n"
+      "possible arguments for the -n option cannot be shown. log_displayer\n"
+      "looks for start_list.txt in the current working directory and in\n"
+      "%s.\n\n", ::aos::configuration::GetRootDirectory());
+      PLOG(FATAL, "Unable to open start_list.txt");
+    }
   }
 
   // Get file size.
diff --git a/aos/linux_code/logging/logging.gyp b/aos/linux_code/logging/logging.gyp
index 52f8b96..65939df 100644
--- a/aos/linux_code/logging/logging.gyp
+++ b/aos/linux_code/logging/logging.gyp
@@ -40,6 +40,7 @@
         '<(AOS)/linux_code/linux_code.gyp:init',
         'binary_log_file',
         '<(AOS)/common/common.gyp:queue_types',
+        '<(AOS)/linux_code/linux_code.gyp:configuration',
       ],
     },
     {
diff --git a/frc971/constants.cc b/frc971/constants.cc
old mode 100755
new mode 100644
diff --git a/frc971/constants.h b/frc971/constants.h
old mode 100755
new mode 100644
diff --git a/frc971/control_loops/shooter/shooter.cc b/frc971/control_loops/shooter/shooter.cc
old mode 100755
new mode 100644
diff --git a/frc971/control_loops/shooter/shooter.gyp b/frc971/control_loops/shooter/shooter.gyp
old mode 100755
new mode 100644
diff --git a/frc971/control_loops/shooter/shooter.h b/frc971/control_loops/shooter/shooter.h
old mode 100755
new mode 100644
diff --git a/frc971/control_loops/shooter/shooter.q b/frc971/control_loops/shooter/shooter.q
old mode 100755
new mode 100644
diff --git a/frc971/control_loops/shooter/shooter_lib_test.cc b/frc971/control_loops/shooter/shooter_lib_test.cc
old mode 100755
new mode 100644
diff --git a/frc971/control_loops/shooter/shooter_main.cc b/frc971/control_loops/shooter/shooter_main.cc
old mode 100755
new mode 100644
diff --git a/frc971/control_loops/shooter/shooter_motor_plant.cc b/frc971/control_loops/shooter/shooter_motor_plant.cc
old mode 100755
new mode 100644
diff --git a/frc971/control_loops/shooter/unaugmented_shooter_motor_plant.cc b/frc971/control_loops/shooter/unaugmented_shooter_motor_plant.cc
old mode 100755
new mode 100644
diff --git a/frc971/wpilib/joystick_sender.cc b/frc971/wpilib/joystick_sender.cc
index 364929a..7115c38 100644
--- a/frc971/wpilib/joystick_sender.cc
+++ b/frc971/wpilib/joystick_sender.cc
@@ -6,6 +6,7 @@
 #include "aos/common/logging/queue_logging.h"
 
 #include "DriverStation.h"
+#include "HAL/HAL.hpp"
 
 namespace frc971 {
 namespace wpilib {
@@ -21,19 +22,17 @@
     ds->WaitForData();
     auto new_state = ::aos::robot_state.MakeMessage();
 
-    new_state->test_mode = ds->IsAutonomous();
-    new_state->fms_attached = ds->IsFMSAttached();
-    new_state->enabled = ds->IsEnabled();
-    new_state->autonomous = ds->IsAutonomous();
+    HALControlWord control_word;
+    HALGetControlWord(&control_word);
+    new_state->test_mode = control_word.test;
+    new_state->fms_attached = control_word.fmsAttached;
+    new_state->enabled = control_word.enabled;
+    new_state->autonomous = control_word.autonomous;
     new_state->team_id = team_id;
     new_state->fake = false;
 
     for (int i = 0; i < 4; ++i) {
-      new_state->joysticks[i].buttons = 0;
-      for (int button = 0; button < 16; ++button) {
-        new_state->joysticks[i].buttons |= ds->GetStickButton(i, button + 1)
-                                           << button;
-      }
+      new_state->joysticks[i].buttons = ds->GetStickButtons(i);
       for (int j = 0; j < 4; ++j) {
         new_state->joysticks[i].axis[j] = ds->GetStickAxis(i, j);
       }