Dave Lu / Mbed 2 deprecated FYDP

Dependencies:   mbed

Fork of FYDP_Final2 by Dave Lu

Control/Sensor.hpp

Committer:
tntmarket
Date:
2015-03-25
Revision:
9:7a8fb72f9a93

File content as of revision 9:7a8fb72f9a93:

#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