Skip to content

Commit

Permalink
fixes to callibration manager - allow post recording time to fight wh…
Browse files Browse the repository at this point in the history
…en people move eyes away too soon
  • Loading branch information
ofTheo committed Oct 20, 2010
1 parent ec4b80e commit 2c5d7a9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
5 changes: 4 additions & 1 deletion eyeWriterTrackerCK/bin/data/Settings/calibrationSettings.xml
Expand Up @@ -8,7 +8,7 @@
<val_0>0.562778</val_0>
</PRE_RECORD_TIME>
<RECORD_TIME>
<val_0>0.400000</val_0>
<val_0>0.496667</val_0>
</RECORD_TIME>
<START_AUTO>
<val_0>0.000000</val_0>
Expand Down Expand Up @@ -67,3 +67,6 @@
<B_MOUSE_SIMULATION>
<val_0>0.000000</val_0>
</B_MOUSE_SIMULATION>
<POST_TIME>
<val_0>0.197778</val_0>
</POST_TIME>
33 changes: 27 additions & 6 deletions eyeWriterTrackerCK/src/calibration/calibrationManager.cpp
Expand Up @@ -17,10 +17,12 @@ void calibrationManager::setup(){
bAutomatic = false;
bPreAutomatic = false;
bAmInAutodrive = false;

bShowAutoRecording = false;

startTime = ofGetElapsedTimef();
preTimePerDot = 10.0;
recordTimePerDot = 0.4;
postTimePerDot = 0.1;
totalTimePerDot = preTimePerDot + recordTimePerDot;
bInAutoRecording = false;
autoPct = 0;
Expand Down Expand Up @@ -48,7 +50,7 @@ void calibrationManager::setup(){

//--------------------------------------------------------------
void calibrationManager::start(){

bAutomatic = true;
bAmInAutodrive = true;
startTime = ofGetElapsedTimef();
Expand Down Expand Up @@ -105,6 +107,8 @@ void calibrationManager::update(){
menuEnergy = 0.94f * menuEnergy + 0.06f * 1.0f;
}

bShowAutoRecording = bInAutoRecording;

// do the auto:
if (bAutomatic == true && bAmInAutodrive == true){
int nPts = nDivisionsWidth * nDivisionsHeight;
Expand All @@ -115,7 +119,7 @@ void calibrationManager::update(){
bInAutoRecording = false;
bPreAutomatic = false;
fitter.calculate(calibrationRectangle);

bShowAutoRecording = bInAutoRecording;
} else {

float diffTime = ofGetElapsedTimef() - startTime ;
Expand All @@ -126,10 +130,21 @@ void calibrationManager::update(){

autoPct = (diffDotTime / preTimePerDot);
bInAutoRecording = false;
bShowAutoRecording = bInAutoRecording;

} else {
autoPct = (diffDotTime - preTimePerDot) / recordTimePerDot;
bInAutoRecording = true;

if( diffDotTime > (totalTimePerDot-postTimePerDot) ){
bInAutoRecording = false;

//here we say still show it even though we are not recording
//trick people!!
bShowAutoRecording = true;
}else{
bInAutoRecording = true;
bShowAutoRecording = bInAutoRecording;
}
}
pos = pt;
}
Expand Down Expand Up @@ -201,9 +216,13 @@ void calibrationManager::draw(){
// TODO: do some animation stuff here:
if (bAutomatic == true && bAmInAutodrive == true){

if (bInAutoRecording){
if (bShowAutoRecording){

ofSetColor(255, 0, 0, 200);
if( bInAutoRecording ){
ofSetColor(255, 0, 0, 200);
}else{
ofSetColor(180, 70, 30, 200);
}
ofCircle(xp, yp, 14);

ofSetColor(255, 255,255);
Expand Down Expand Up @@ -288,6 +307,8 @@ void calibrationManager::keyPressed(int key) {
if (bPreAutomatic == true){
if (key == ' '){
bPreAutomatic = false;
clear();
stop();
start();
}
}else if (bPreAutomatic == false && !bAmInAutodrive) {
Expand Down
2 changes: 2 additions & 0 deletions eyeWriterTrackerCK/src/calibration/calibrationManager.h
Expand Up @@ -44,10 +44,12 @@ class calibrationManager {
bool bPreAutomatic;
bool bAutomatic;
bool bAmInAutodrive;
bool bShowAutoRecording;
float startTime;
float preTimePerDot;
float recordTimePerDot;
float totalTimePerDot;
float postTimePerDot;
bool bInAutoRecording;
bool bRemovePointsFarFromAverage;

Expand Down
Expand Up @@ -15,8 +15,9 @@ void calibrationManager::setupControlPanel(){
panel.addSlider("num divisions horiz", "N_DIV_W", nDivisionsWidth, 2, 15, true);
panel.addSlider("num divisions vert", "N_DIV_H", nDivisionsHeight, 2, 15, true);

panel.addSlider("(auto) time to pre-record", "PRE_RECORD_TIME", preTimePerDot, 0.1, 5, false);
panel.addSlider("(auto) time for record", "RECORD_TIME", recordTimePerDot, 0.1, 1.5, false);
panel.addSlider("time to pre-record", "PRE_RECORD_TIME", preTimePerDot, 0.1, 5, false);
panel.addSlider("time for record", "RECORD_TIME", recordTimePerDot, 0.1, 1.5, false);
panel.addSlider("time for post-record", "POST_TIME", 0.0, 0.05, 1.0, false);

panel.addToggle("remove points far from each average", "B_REMOVE_FAR_AVERAGE", false);
panel.addSlider("threshold distance(multiplier to avrage)", "THRESHOLD_DIST", 1.7, 0, 4, false);
Expand Down Expand Up @@ -55,8 +56,9 @@ void calibrationManager::updateControlPanel(){

panel.update();

preTimePerDot = panel.getValueF("PRE_RECORD_TIME");;
recordTimePerDot = panel.getValueF("RECORD_TIME");;
preTimePerDot = panel.getValueF("PRE_RECORD_TIME");
recordTimePerDot = panel.getValueF("RECORD_TIME");
postTimePerDot = panel.getValueF("POST_TIME");
smoothing = panel.getValueF("AMOUNT_SMOOTHING");

fitter.removeOutliersf = panel.getValueF("REMOVE_OUTLIERS");
Expand Down

0 comments on commit 2c5d7a9

Please sign in to comment.