Dave Lu
/
FYDP
IMU and knee angle. No servo yet
Fork of FYDP_Final2 by
Diff: Control/control.cpp
- Revision:
- 11:425dff6a4af9
- Parent:
- 10:22c44650c7c1
--- a/Control/control.cpp Wed Mar 25 16:36:11 2015 +0000 +++ b/Control/control.cpp Wed Mar 25 18:11:09 2015 +0000 @@ -10,17 +10,17 @@ PaceDetector paceDetector; Actuator actuator; -Sensor _sensor; +Sensor* _sensor; void onStopToSwing() { paceDetector.lookForPeak(); -// actuator.startHeelStrike(_sensor.time()); + actuator.startHeelStrike(_sensor->time()); } void onStopToMaybe() { -// actuator.startMidStance(_sensor.time()); + actuator.startMidStance(_sensor->time()); } -void setup(Sensor &s) { +void setup(Sensor* s) { _sensor = s; state.state = State::UNCALIBRATED; state.onSwing(&onStopToSwing); @@ -29,9 +29,9 @@ } void process() { - state.next(_sensor.thigh()); - paceDetector.process(_sensor.time(), _sensor.thigh(), _sensor.shin()); -// actuator.setPeriod(paceDetector.pace()); + state.next(_sensor->thigh()); + paceDetector.process(_sensor->time(), _sensor->thigh(), _sensor->shin()); + actuator.setPeriod(paceDetector.pace()); /* -actuator.getHip(_sensor.time()); */ /* actuator.getKneeDiff(_sensor.time()); */ @@ -50,10 +50,10 @@ } float getHip() { - return -actuator.getHip(_sensor.time()); + return -actuator.getHip(_sensor->time()); } float getKneeDiff() { - return actuator.getKneeDiff(_sensor.time()); + return actuator.getKneeDiff(_sensor->time()); }