Skip to content

Commit

Permalink
added countertrack.sensor C project
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorcamblor committed Nov 6, 2013
1 parent 9ab4e45 commit a7ffc7a
Show file tree
Hide file tree
Showing 9 changed files with 563 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ Thumbs.db
#Eclipse files
##############
.project
.cproject
.classpath
.settings/
Debug/
build.properties

#VAADIN files
Expand Down
56 changes: 56 additions & 0 deletions .gitignore~
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
*.war
*.ear

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db

#Eclipse files
##############
.project
.classpath
.settings/
build.properties

#VAADIN files
#############
konekti.countertrack.workbench/src/main/webapp/VAADIN/widgetsets/*

#MANIFEST files
###############
MANIFEST.MF

#Maven binaries
###############
target/

39 changes: 39 additions & 0 deletions countertrack.sensor/Gait/Gait.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Gait.cpp
*
* Created on: 22/10/2013
* Author: miguel
*/
#include "Gait.h"
#include <cstdlib>

Gait::Gait() {
direction = 0;
gaitDate = time(0);
sequence.push_back(0);
}

Gait::Gait(int currentDirection, vector<int>currentSequence) {
direction = currentDirection;
sequence = currentSequence;
gaitDate = time(0);
}

bool Gait::sameGait(Gait lastGait) {
bool sameGait = false;

if (abs(gaitDate - lastGait.getGaitDate() < 500) ) {
if (direction == 1 && lastGait.getDirection() == 1 &&
sequence[sequence.size()-1] > lastGait.getSequence()[lastGait.getSequence().size() -1]
) {
sameGait = true;
} else if (direction == 0 && lastGait.getDirection() == 0 &&
sequence[sequence.size()-1] < lastGait.getSequence()[lastGait.getSequence().size() -1]
) {
sameGait = true;
}
}
return sameGait;
}


39 changes: 39 additions & 0 deletions countertrack.sensor/Gait/Gait.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Gait.h
*
* Created on: 22/10/2013
* Author: miguel
*/
#include <vector>
#include <ctime>

using namespace std;

#ifndef GAIT_H_
#define GAIT_H_

class Gait {
public:
Gait();
Gait(int currentDirection, vector<int> currentSequence);
bool sameGait(Gait lastGait);

int getDirection() const {
return direction;
}

time_t getGaitDate() const {
return gaitDate;
}

vector<int> getSequence() const {
return sequence;
}
private:
int direction;
vector<int> sequence;
time_t gaitDate;
};


#endif /* GAIT_H_ */
Loading

0 comments on commit a7ffc7a

Please sign in to comment.