Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of FYDP_Final2 by
PaceDetector.cpp
00001 #include "PaceDetector.hpp" 00002 00003 void PaceDetector::process(float time, float thigh, float shin) { 00004 kneeSmoother.insert(time, shin-thigh); 00005 00006 if(atPeak()) { 00007 lastPeak = currentPeak; 00008 currentPeak = time; 00009 peakDetected = true; 00010 } 00011 00012 lastSmoothKnee = smoothKnee; 00013 smoothKnee = kneeSmoother.get(); 00014 00015 if(lastDSmoothKnee > 0) { 00016 plusDSmoothKneeCount += 1; 00017 } else { 00018 plusDSmoothKneeCount = 0; 00019 } 00020 lastDSmoothKnee = dSmoothKnee; 00021 dSmoothKnee = smoothKnee-lastSmoothKnee; 00022 } 00023 00024 bool PaceDetector::atPeak() { 00025 return 00026 plusDSmoothKneeCount > 4 && 00027 lastDSmoothKnee > 0 && 00028 dSmoothKnee < 0 && 00029 !peakDetected; 00030 } 00031 00032 float PaceDetector::pace() { 00033 if(currentPeak != -1 && lastPeak != -1) { 00034 return currentPeak - lastPeak; 00035 } else { 00036 return 1.0; 00037 } 00038 } 00039 00040 void PaceDetector::lookForPeak() { 00041 peakDetected = false; 00042 } 00043
Generated on Wed Jul 13 2022 20:00:58 by
1.7.2
