Dave Lu / Mbed 2 deprecated FYDP

Dependencies:   mbed

Fork of FYDP_Final2 by Dave Lu

Revision:
9:7a8fb72f9a93
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Control/Sensor.hpp	Wed Mar 25 14:34:23 2015 +0000
@@ -0,0 +1,25 @@
+#ifndef SENSOR_HPP
+#define SENSOR_HPP
+
+#include "robot.h"
+
+class Sensor {
+   float thighOffset;
+   float shinOffset;
+
+   float thighRaw() { return imu_data.ypr[1]; }
+   float shinRaw() { return imu2_data.ypr[1]; }
+
+   public:
+      Sensor() : thighOffset(0), shinOffset(0) {}
+      void calibrate() {
+         thighOffset = thighRaw();
+         shinOffset = shinRaw();
+      }
+      float time() { return getTime(); }
+      float thigh() { return imu_data.ypr[1] - thighOffset; }
+      float shin() { return imu2_data.ypr[1] - shinOffset; }
+};
+
+#endif // SENSOR_HPP
+