added butterworth filter \n added activity rec for baro using butter \n added moduel for walker with activity
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "../../../sensors/pressure/RelativePressure.h"
|
||||
#include "../../../sensors/pressure/PressureTendence.h"
|
||||
#include "../../../sensors/pressure/ActivityButterPressure.h"
|
||||
|
||||
#include <random>
|
||||
|
||||
@@ -121,5 +122,51 @@ TEST(Barometer, LIVE_tendence2) {
|
||||
|
||||
}
|
||||
|
||||
TEST(Barometer, Activity) {
|
||||
ActivityButterPressure act;
|
||||
|
||||
//read file
|
||||
std::string line;
|
||||
std::string filename = getDataFile("baro/logfile_UAH_R2_S3_baro.dat");
|
||||
std::ifstream infile(filename);
|
||||
|
||||
while (std::getline(infile, line))
|
||||
{
|
||||
std::istringstream iss(line);
|
||||
int ts;
|
||||
double value;
|
||||
|
||||
while (iss >> ts >> value) {
|
||||
ActivityButterPressure::Activity currentAct = act.add(Timestamp::fromMS(ts), BarometerData(value));
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<float> sum = act.getSumHistory();
|
||||
std::vector<float> interpolated = act.getInterpolatedHistory();
|
||||
std::vector<float> raw = act.getSensorHistory();
|
||||
std::vector<float> butter = act.getOutputHistory();
|
||||
std::vector<ActivityButterPressure::History> actHist = act.getActHistory();
|
||||
|
||||
K::Gnuplot gp;
|
||||
K::GnuplotPlot plot;
|
||||
K::GnuplotPlotElementLines rawLines;
|
||||
|
||||
for(int i=0; i < actHist.size()-1; ++i){
|
||||
|
||||
K::GnuplotPoint2 input_p1(actHist[i].ts.sec(), actHist[i].data.hPa);
|
||||
K::GnuplotPoint2 input_p2(actHist[i+1].ts.sec(), actHist[i+1].data.hPa);
|
||||
|
||||
rawLines.addSegment(input_p1, input_p2);
|
||||
}
|
||||
|
||||
plot.add(&rawLines);
|
||||
|
||||
gp.draw(plot);
|
||||
gp.flush();
|
||||
|
||||
sleep(1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user