Code to let Gr20's BioRobotics2017 robot come to live.

Dependencies:   FastPWM MODSERIAL QEI mbed

Revision:
7:b9a209f889f5
Parent:
5:088917beb5e4
Child:
8:383a0fb48121
--- a/robot.h	Mon Nov 13 09:34:39 2017 +0000
+++ b/robot.h	Mon Nov 13 10:39:55 2017 +0000
@@ -24,13 +24,11 @@
 
 /**
  * Robot
- *
- * Implementation can be found in main.cpp
  */
 namespace robot
 {
 // sample time
-const double kSampleTime = 0.001;
+static const double kSampleTime = 0.001;
 
 // Robot states
 enum State {
@@ -43,7 +41,7 @@
 };
 
 // Robot state description
-const char *StateNames[] = {
+static const char *StateNames[] = {
     "Off",
     "Calibration",
     "Homing",
@@ -60,26 +58,26 @@
 /**
  * Robot properties
  */
-const double kL1 = 0.30;
-const double kL2 = 0.38;
+static const double kL1 = 0.30;
+static const double kL2 = 0.38;
 
-const double kCalibAngleMotor1 = 140;
-const double kCalibAngleMotor2 = -3;
+static const double kCalibAngleMotor1 = 140;
+static const double kCalibAngleMotor2 = -3;
 
 /**
  * Motors and controllers
  */
-Motor m1(M1_PWM, M1_DIR, M1_ENC_A, M1_ENC_B, GEAR_RATIO*COUNTS_PER_REV);
-Motor m2(M2_PWM, M2_DIR, M2_ENC_A, M2_ENC_B, GEAR_RATIO*COUNTS_PER_REV, true);
+extern Motor m1;
+extern Motor m2;
 
-Controller c1(.500,.200,0.070,kSampleTime);
-Controller c2(.400,.200,0.050,kSampleTime);
+extern Controller c1;
+extern Controller c2;
 
 /**
  * Robot state
  */
-State state = OFF;
-bool is_calibrated = false;
+extern State state;
+extern bool is_calibrated;
 
 bool has_power();