Dave Lu / Mbed 2 deprecated FYDP

Dependencies:   mbed

Fork of FYDP_Final2 by Dave Lu

Committer:
tntmarket
Date:
Wed Mar 25 18:11:09 2015 +0000
Revision:
11:425dff6a4af9
Parent:
9:7a8fb72f9a93
Working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tntmarket 9:7a8fb72f9a93 1 #ifndef SENSOR_HPP
tntmarket 9:7a8fb72f9a93 2 #define SENSOR_HPP
tntmarket 9:7a8fb72f9a93 3
tntmarket 9:7a8fb72f9a93 4 #include "robot.h"
tntmarket 9:7a8fb72f9a93 5
tntmarket 9:7a8fb72f9a93 6 class Sensor {
tntmarket 9:7a8fb72f9a93 7 float thighOffset;
tntmarket 9:7a8fb72f9a93 8 float shinOffset;
tntmarket 9:7a8fb72f9a93 9
tntmarket 9:7a8fb72f9a93 10 float thighRaw() { return imu_data.ypr[1]; }
tntmarket 9:7a8fb72f9a93 11 float shinRaw() { return imu2_data.ypr[1]; }
tntmarket 9:7a8fb72f9a93 12
tntmarket 9:7a8fb72f9a93 13 public:
tntmarket 9:7a8fb72f9a93 14 Sensor() : thighOffset(0), shinOffset(0) {}
tntmarket 9:7a8fb72f9a93 15 void calibrate() {
tntmarket 9:7a8fb72f9a93 16 thighOffset = thighRaw();
tntmarket 9:7a8fb72f9a93 17 shinOffset = shinRaw();
tntmarket 9:7a8fb72f9a93 18 }
tntmarket 9:7a8fb72f9a93 19 float time() { return getTime(); }
tntmarket 9:7a8fb72f9a93 20 float thigh() { return imu_data.ypr[1] - thighOffset; }
tntmarket 9:7a8fb72f9a93 21 float shin() { return imu2_data.ypr[1] - shinOffset; }
tntmarket 9:7a8fb72f9a93 22 };
tntmarket 9:7a8fb72f9a93 23
tntmarket 9:7a8fb72f9a93 24 #endif // SENSOR_HPP
tntmarket 9:7a8fb72f9a93 25