copied everything over from 2012 and removed all of the actual robot code except the drivetrain stuff
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4078 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/aos/crio/controls/ControlsManager.cpp b/aos/crio/controls/ControlsManager.cpp
new file mode 100644
index 0000000..a37ec6f
--- /dev/null
+++ b/aos/crio/controls/ControlsManager.cpp
@@ -0,0 +1,53 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "WPILib/Compressor.h"
+
+#include "aos/aos_core.h"
+#include "aos/crio/controls/ControlsManager.h"
+#include "aos/common/Configuration.h"
+#include "aos/crio/aos_ctdt.h"
+#include "aos/crio/motor_server/CRIOControlLoopRunner.h"
+#include "aos/crio/motor_server/MotorServer.h"
+
+namespace aos {
+namespace crio {
+
+// Everything gets an explicit Start call here before calling all of the init
+// functions because it means that all static variables will be initialized
+// before anything actually starts running. It also means that everything will
+// be initialized before any of the init functions start trying to register
+// themselves etc.
+void ControlsManager::StartCompetition() {
+ printf("aos::ControlsManager::RobotMain\n");
+ (new Compressor(14, 1))->Start();
+
+ logging::Start();
+ LOG(INFO, "logging started\n");
+
+ GetWatchdog().SetEnabled(false);
+ LOG(INFO, "disabled watchdog\n");
+
+ RegisterControlLoops();
+ LOG(INFO, "registered control loops\n");
+
+ // CRIOControlLoopRunner calls part of MotorServer, so MotorServer has to get
+ // initialized first.
+ MotorServer::Start();
+ LOG(INFO, "MotorServer started\n");
+ CRIOControlLoopRunner::Start();
+ LOG(INFO, "cRIO control loops started\n");
+
+ LOG(INFO, "calling init functions\n");
+ aos_call_init_functions();
+ LOG(INFO, "initialized\n");
+
+ // Wait forever so that this task doesn't end to avoid confusing any brittle
+ // FIRST code that might be hiding somewhere.
+ while (true) {
+ select(0, NULL, NULL, NULL, NULL);
+ }
+}
+
+} // namespace crio
+} // namespace aos