From: Thomas Pietrzak Date: Tue, 14 Jun 2011 19:27:51 +0000 (+0000) Subject: Tacton experiments initial import X-Git-Url: https://git.thomaspietrzak.com/?a=commitdiff_plain;h=89e4f71dfb1e5f2b59b509b4f36cab730ad9f6bf;p=tactonexperiment.git Tacton experiments initial import git-svn-id: svn+ssh://thomaspietrzak.com/var/svn/rep@31 47cf9a05-e0a8-4ed5-9e9b-101a649bc004 --- 89e4f71dfb1e5f2b59b509b4f36cab730ad9f6bf diff --git a/Tactons Experiment.sdf b/Tactons Experiment.sdf new file mode 100644 index 0000000..f82932c Binary files /dev/null and b/Tactons Experiment.sdf differ diff --git a/Tactons Experiment.sln b/Tactons Experiment.sln new file mode 100644 index 0000000..4f417b4 --- /dev/null +++ b/Tactons Experiment.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tactons Experiment", "Tactons Experiment\Tactons Experiment.vcxproj", "{06E5475F-42FF-4D43-84C8-1C2DE2D8AE5E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tactons JND", "Tactons JND\Tactons JND.vcxproj", "{454A6651-24D2-4DBA-A579-FDACD5CAC68C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TactonPlayer", "TactonPlayer\TactonPlayer.vcxproj", "{6D5C62C0-562D-4B2A-9AAC-806372810CBF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {06E5475F-42FF-4D43-84C8-1C2DE2D8AE5E}.Debug|Win32.ActiveCfg = Debug|Win32 + {06E5475F-42FF-4D43-84C8-1C2DE2D8AE5E}.Debug|Win32.Build.0 = Debug|Win32 + {06E5475F-42FF-4D43-84C8-1C2DE2D8AE5E}.Release|Win32.ActiveCfg = Release|Win32 + {06E5475F-42FF-4D43-84C8-1C2DE2D8AE5E}.Release|Win32.Build.0 = Release|Win32 + {454A6651-24D2-4DBA-A579-FDACD5CAC68C}.Debug|Win32.ActiveCfg = Debug|Win32 + {454A6651-24D2-4DBA-A579-FDACD5CAC68C}.Debug|Win32.Build.0 = Debug|Win32 + {454A6651-24D2-4DBA-A579-FDACD5CAC68C}.Release|Win32.ActiveCfg = Release|Win32 + {454A6651-24D2-4DBA-A579-FDACD5CAC68C}.Release|Win32.Build.0 = Release|Win32 + {6D5C62C0-562D-4B2A-9AAC-806372810CBF}.Debug|Win32.ActiveCfg = Debug|Win32 + {6D5C62C0-562D-4B2A-9AAC-806372810CBF}.Debug|Win32.Build.0 = Debug|Win32 + {6D5C62C0-562D-4B2A-9AAC-806372810CBF}.Release|Win32.ActiveCfg = Release|Win32 + {6D5C62C0-562D-4B2A-9AAC-806372810CBF}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Tactons Experiment.suo b/Tactons Experiment.suo new file mode 100644 index 0000000..a4343e8 Binary files /dev/null and b/Tactons Experiment.suo differ diff --git a/Tactons Experiment/-Amplitudes-Rest- b/Tactons Experiment/-Amplitudes-Rest- new file mode 100644 index 0000000..3082a14 --- /dev/null +++ b/Tactons Experiment/-Amplitudes-Rest- @@ -0,0 +1,15 @@ +2,4,1 +0,2,1 +1,1,1 +1,3,1 +0,0,1 +2,2,1 +0,1,1 +3,4,1 +0,3,1 +0,4,1 +2,3,1 +3,3,1 +1,4,1 +4,4,1 +1,2,1 diff --git a/Tactons Experiment/-Durations-Rest- b/Tactons Experiment/-Durations-Rest- new file mode 100644 index 0000000..e69de29 diff --git a/Tactons Experiment/-Frequencies-Rest- b/Tactons Experiment/-Frequencies-Rest- new file mode 100644 index 0000000..0a02f74 --- /dev/null +++ b/Tactons Experiment/-Frequencies-Rest- @@ -0,0 +1,20 @@ +1,3,1 +1,4,1 +1,2,1 +2,5,1 +3,5,1 +0,2,1 +0,3,1 +0,1,1 +0,5,1 +1,1,1 +3,4,1 +4,5,1 +2,2,1 +0,4,1 +0,0,1 +2,4,1 +2,3,1 +4,4,1 +1,5,1 +3,3,1 diff --git a/Tactons Experiment/Amplitudes.txt b/Tactons Experiment/Amplitudes.txt new file mode 100644 index 0000000..0ece0ac --- /dev/null +++ b/Tactons Experiment/Amplitudes.txt @@ -0,0 +1,5 @@ +1;1111;200;250;20 +1;1111;200;250;40 +1;1111;200;250;60 +1;1111;200;250;80 +1;1111;200;250;100 \ No newline at end of file diff --git a/Tactons Experiment/Durations.txt b/Tactons Experiment/Durations.txt new file mode 100644 index 0000000..ffe28c8 --- /dev/null +++ b/Tactons Experiment/Durations.txt @@ -0,0 +1,8 @@ +1;1111;50;250;100 +1;1111;100;250;100 +1;1111;150;250;100 +1;1111;200;250;100 +1;1111;250;250;100 +1;1111;300;250;100 +1;1111;350;250;100 +1;1111;400;250;100 diff --git a/Tactons Experiment/Experiments.txt b/Tactons Experiment/Experiments.txt new file mode 100644 index 0000000..48e8098 --- /dev/null +++ b/Tactons Experiment/Experiments.txt @@ -0,0 +1,5 @@ +Frequencies +Amplitudes +Locations +Durations +All \ No newline at end of file diff --git a/Tactons Experiment/Frequencies.txt b/Tactons Experiment/Frequencies.txt new file mode 100644 index 0000000..b5b045f --- /dev/null +++ b/Tactons Experiment/Frequencies.txt @@ -0,0 +1,6 @@ +1;1111;200;50;100 +1;1111;200;100;100 +1;1111;200;150;100 +1;1111;200;200;100 +1;1111;200;250;100 +1;1111;200;300;100 diff --git a/Tactons Experiment/Gestures.txt b/Tactons Experiment/Gestures.txt new file mode 100644 index 0000000..9664aa6 --- /dev/null +++ b/Tactons Experiment/Gestures.txt @@ -0,0 +1,7 @@ +Rest +Arm up +Arm right +Arm left +Arm down +Circle side +Circle front \ No newline at end of file diff --git a/Tactons Experiment/Locations.txt b/Tactons Experiment/Locations.txt new file mode 100644 index 0000000..3004e75 --- /dev/null +++ b/Tactons Experiment/Locations.txt @@ -0,0 +1,15 @@ +1;0001;200;250;100 +1;0010;200;250;100 +1;0011;200;250;100 +1;0100;200;250;100 +1;0101;200;250;100 +1;0110;200;250;100 +1;0111;200;250;100 +1;1000;200;250;100 +1;1001;200;250;100 +1;1010;200;250;100 +1;1011;200;250;100 +1;1100;200;250;100 +1;1101;200;250;100 +1;1110;200;250;100 +1;1111;200;250;100 diff --git a/Tactons Experiment/Tactons Experiment.vcxproj b/Tactons Experiment/Tactons Experiment.vcxproj new file mode 100644 index 0000000..e26b635 --- /dev/null +++ b/Tactons Experiment/Tactons Experiment.vcxproj @@ -0,0 +1,172 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {06E5475F-42FF-4D43-84C8-1C2DE2D8AE5E} + Qt4VSv1.0 + + + + Application + + + Application + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + AllRules.ruleset + + + AllRules.ruleset + + + $(SolutionDir)$(ConfigurationName) + $(SolutionDir)$(ConfigurationName) + $(IncludePath) + $(IncludePath) + $(LibraryPath) + $(LibraryPath) + + + + UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;.\;%(AdditionalIncludeDirectories) + Disabled + ProgramDatabase + MultiThreadedDebugDLL + false + + + Windows + $(OutDir)\$(ProjectName).exe + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + true + qtmaind.lib;QtCored4.lib;QtGuid4.lib;%(AdditionalDependencies);TactonPlayer.lib + + + + + UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;.\;%(AdditionalIncludeDirectories) + + + MultiThreadedDLL + false + + + Windows + $(OutDir)\$(ProjectName).exe + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + false + qtmain.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies);TactonPlayer.lib + + + + + + true + + + true + + + true + + + true + + + + + + + $(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." + $(QTDIR)\bin\moc.exe;%(FullPath);%(AdditionalInputs) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." + + + + + Document + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + + + + Document + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp + + + + + Document + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." + + + + + + + + + + + + \ No newline at end of file diff --git a/Tactons Experiment/Tactons Experiment.vcxproj.filters b/Tactons Experiment/Tactons Experiment.vcxproj.filters new file mode 100644 index 0000000..dc0bb60 --- /dev/null +++ b/Tactons Experiment/Tactons Experiment.vcxproj.filters @@ -0,0 +1,82 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;cxx;c;def + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} + moc;h;cpp + False + + + {4be88096-af23-4867-b021-d81a3fab99b9} + cpp;moc + False + + + {772e3daf-faf0-4cd0-bb45-9c36d2fcf77a} + cpp;moc + False + + + + + Source Files + + + Source Files + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + + + + + Header Files + + + Form Files + + + Resource Files + + + Form Files + + + Header Files + + + + + Generated Files + + + \ No newline at end of file diff --git a/Tactons Experiment/answerform.cpp b/Tactons Experiment/answerform.cpp new file mode 100644 index 0000000..36bcb57 --- /dev/null +++ b/Tactons Experiment/answerform.cpp @@ -0,0 +1,131 @@ +#include "answerform.h" + +#include + #include + +AnswerForm::AnswerForm(QWidget *parent, Qt::WFlags flags) + : QDialog(parent, flags), _logfile(NULL), _tactonPlayer("COM3"), _current(0) +{ + //init the window + setupUi(this); + this->layout()->setSizeConstraint(QLayout::SetFixedSize); + + //init buttons + QObject::connect(buttonSame, SIGNAL(clicked()), this, SLOT(pressSame())); + QObject::connect(buttonDifferent, SIGNAL(clicked()), this, SLOT(pressDifferent())); + +} + +AnswerForm::~AnswerForm() +{ + if (_logfile) + fclose(_logfile); + //reset the wristband + _tactonPlayer.stop(); +} + +void AnswerForm::init(QString user, int repetitions, QString experiment, QString gesture) +{ + _user = user; + _repetitions = repetitions; + _experiment = experiment; + _gesture = gesture; + + //create log file + QString logfilename = user + "-" + experiment + "-" + gesture + "-"; + _logfile = fopen(logfilename.toStdString().c_str(), "w"); + + //load icons + _nbtactons = _tactonPlayer.registFile((experiment + ".txt").toAscii().data()); + + //init the wristband + //_tactonPlayer.start(); + + //generate the block + for (int i = 0 ; i < _repetitions ; i++) + { + QList > temp; + //generate the block + for (int j = 0 ; j < _nbtactons ; j++) + for (int k = j ; k < _nbtactons ; k++) + temp.push_back(QPair(j, k)); + //shuffle + for (int j = 0; j < temp.count(); j++) + temp.swap(j, (rand() % (temp.count() - j)) + j); + //add the block to the trial + _trials.append(temp); + } + + //run first trial + runTrial(); +} + +void AnswerForm::setLabel() +{ + if (_current >= _trials.count()) + label->setText("Finished!"); + else + label->setText(QString::number(_current + 1) + "/" + QString::number(_trials.count())); +} + +void AnswerForm::pressSame() +{ + setAnswer(true); +} + +void AnswerForm::pressDifferent() +{ + setAnswer(false); +} + +void AnswerForm::setAnswer(bool same) +{ + //write answer in the log file + log(same); + + _current++; + + //run next trial + runTrial(); +} + +void AnswerForm::runTrial() +{ + //change label with progress + setLabel(); + + //disable buttons + toggleButtons(); + + if (_current >= _trials.count()) + return; + + //play next tacton 1 + _tactonPlayer.play(_trials.at(_current).first); + + //pause + //play next tacton 2 + QTimer::singleShot(1000, this, SLOT(playSecond())); + + //pause + //enable buttons + QTimer::singleShot(2000, this, SLOT(toggleButtons())); +} + +void AnswerForm::playSecond() +{ + _tactonPlayer.play(_trials.at(_current).second); +} + +void AnswerForm::toggleButtons() +{ + buttonDifferent->setEnabled(!buttonDifferent->isEnabled()); + buttonSame->setEnabled(!buttonSame->isEnabled()); +} + +void AnswerForm::log(bool answer) +{ + if (_logfile == NULL) + return; + fprintf(_logfile, "%d,%d,%d\n", _trials.at(_current).first, _trials.at(_current).second, answer); +} diff --git a/Tactons Experiment/answerform.h b/Tactons Experiment/answerform.h new file mode 100644 index 0000000..e35772f --- /dev/null +++ b/Tactons Experiment/answerform.h @@ -0,0 +1,43 @@ +#ifndef _ANSWERFORM_ +#define _ANSWERFORM_ + +#include + +#include +#include "ui_answerform.h" + + +class AnswerForm : public QDialog, Ui::AnswerFormClass +{ + Q_OBJECT + +public: + AnswerForm(QWidget *parent = 0, Qt::WFlags flags = 0); + ~AnswerForm(); + + void init(QString user, int repetitions, QString experiment, QString gesture); + + void setAnswer(bool same); + +private: + void setLabel(); + void log(bool answer); + void runTrial(); + + FILE *_logfile; + TactonPlayer _tactonPlayer; + QString _user; + int _repetitions; + QString _experiment; + QString _gesture; + unsigned int _nbtactons; + QList > _trials; + int _current; +private slots: + void pressSame(); + void pressDifferent(); + void toggleButtons(); + void playSecond(); +}; + +#endif diff --git a/Tactons Experiment/answerform.ui b/Tactons Experiment/answerform.ui new file mode 100644 index 0000000..d783973 --- /dev/null +++ b/Tactons Experiment/answerform.ui @@ -0,0 +1,76 @@ + + + AnswerFormClass + + + + 0 + 0 + 420 + 107 + + + + Tactons Experiment + + + + + + + + + 400 + 40 + + + + + 20 + + + + + + + + + + Qt::AlignCenter + + + + + + + true + + + + 20 + + + + Same + + + + + + + + 20 + + + + Different + + + + + + + + + + diff --git a/Tactons Experiment/answers.ui b/Tactons Experiment/answers.ui new file mode 100644 index 0000000..c788afd --- /dev/null +++ b/Tactons Experiment/answers.ui @@ -0,0 +1,68 @@ + + + AnswerWindow + + + + 0 + 0 + 373 + 98 + + + + Tacton Study + + + + + + + + + + + 20 + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + 20 + + + + Same + + + + + + + + 20 + + + + Different + + + + + + + + + diff --git a/Tactons Experiment/example.ui b/Tactons Experiment/example.ui new file mode 100644 index 0000000..d7e4572 --- /dev/null +++ b/Tactons Experiment/example.ui @@ -0,0 +1,100 @@ + + + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 20 + 250 + 351 + 33 + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 131 + 31 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + okButton + clicked() + Dialog + accept() + + + 278 + 253 + + + 96 + 254 + + + + + cancelButton + clicked() + Dialog + reject() + + + 369 + 253 + + + 179 + 282 + + + + + diff --git a/Tactons Experiment/main.cpp b/Tactons Experiment/main.cpp new file mode 100644 index 0000000..3f7b12b --- /dev/null +++ b/Tactons Experiment/main.cpp @@ -0,0 +1,10 @@ +#include "tactonsexperiment.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + TactonsExperiment w; + w.show(); + return a.exec(); +} diff --git a/Tactons Experiment/main.ui b/Tactons Experiment/main.ui new file mode 100644 index 0000000..14efe0b --- /dev/null +++ b/Tactons Experiment/main.ui @@ -0,0 +1,70 @@ + + + MainWindow + + + + 0 + 0 + 384 + 226 + + + + Tacton Study + + + + + + + User: + + + + + + + Repetitions: + + + + + + + Experiment: + + + + + + + + + + 1 + + + 100 + + + 1 + + + + + + + + + + Start experiment + + + + + + + + + diff --git a/Tactons Experiment/tactonsexperiment.cpp b/Tactons Experiment/tactonsexperiment.cpp new file mode 100644 index 0000000..879bc41 --- /dev/null +++ b/Tactons Experiment/tactonsexperiment.cpp @@ -0,0 +1,50 @@ +#include "tactonsexperiment.h" + +TactonsExperiment::TactonsExperiment(QWidget *parent, Qt::WFlags flags) + : QMainWindow(parent, flags) +{ + setupUi(this); + + this->layout()->setSizeConstraint(QLayout::SetFixedSize); + + FILE *f = fopen("Experiments.txt", "r"); + if (f) + { + char buffer[256]; + while ((fgets(buffer, 256, f)) != NULL) + { + while((buffer[strlen(buffer) - 1] == '\r') || (buffer[strlen(buffer) - 1] == '\n')) + buffer[strlen(buffer) - 1] = '\0'; + experiment->addItem(buffer); + } + fclose(f); + } + + f = fopen("Gestures.txt", "r"); + if (f) + { + char buffer[256]; + while ((fgets(buffer, 256, f)) != NULL) + { + while((buffer[strlen(buffer) - 1] == '\r') || (buffer[strlen(buffer) - 1] == '\n')) + buffer[strlen(buffer) - 1] = '\0'; + gesture->addItem(buffer); + } + fclose(f); + } + + QObject::connect(buttonstart, SIGNAL(clicked()), this, SLOT(runBlock())); +} + +TactonsExperiment::~TactonsExperiment() +{ + +} + +void TactonsExperiment::runBlock(void) +{ + this->hide(); + w.init(username->text(), repetitions->value(), experiment->currentText(), gesture->currentText()); + w.show(); +} + diff --git a/Tactons Experiment/tactonsexperiment.h b/Tactons Experiment/tactonsexperiment.h new file mode 100644 index 0000000..8ef50ac --- /dev/null +++ b/Tactons Experiment/tactonsexperiment.h @@ -0,0 +1,24 @@ +#ifndef TACTONSEXPERIMENT_H +#define TACTONSEXPERIMENT_H + +#include +#include "ui_tactonsexperiment.h" + +#include "answerform.h" + +class TactonsExperiment : public QMainWindow, Ui::TactonsExperimentClass +{ + Q_OBJECT + +public: + TactonsExperiment(QWidget *parent = 0, Qt::WFlags flags = 0); + ~TactonsExperiment(); + +private: + AnswerForm w; + +private slots: + void runBlock(void); +}; + +#endif // TACTONSEXPERIMENT_H diff --git a/Tactons Experiment/tactonsexperiment.qrc b/Tactons Experiment/tactonsexperiment.qrc new file mode 100644 index 0000000..8c70707 --- /dev/null +++ b/Tactons Experiment/tactonsexperiment.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/Tactons Experiment/tactonsexperiment.ui b/Tactons Experiment/tactonsexperiment.ui new file mode 100644 index 0000000..ba21a39 --- /dev/null +++ b/Tactons Experiment/tactonsexperiment.ui @@ -0,0 +1,96 @@ + + + TactonsExperimentClass + + + Qt::NonModal + + + + 0 + 0 + 324 + 180 + + + + Tactons Experiment + + + + + + + + + + + + User: + + + + + + + + + + Repetitions: + + + + + + + 1 + + + 100 + + + 1 + + + + + + + Experiment: + + + + + + + + + + Gesture: + + + + + + + + + + + + + + + Start experiment + + + + + + + + + + + + diff --git a/Tactons JND/Tactons JND.vcxproj b/Tactons JND/Tactons JND.vcxproj new file mode 100644 index 0000000..83c587d --- /dev/null +++ b/Tactons JND/Tactons JND.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {454A6651-24D2-4DBA-A579-FDACD5CAC68C} + Qt4VSv1.0 + + + + Application + + + Application + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + AllRules.ruleset + + + AllRules.ruleset + + + $(SolutionDir)$(ConfigurationName) + $(SolutionDir)$(ConfigurationName) + + + + UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;.\;%(AdditionalIncludeDirectories) + Disabled + ProgramDatabase + MultiThreadedDebugDLL + false + + + Windows + $(OutDir)\$(ProjectName).exe + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + true + TactonPlayer.lib;qtmaind.lib;QtCored4.lib;QtGuid4.lib;%(AdditionalDependencies) + + + + + UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;.\;%(AdditionalIncludeDirectories) + + + MultiThreadedDLL + false + + + Windows + $(OutDir)\$(ProjectName).exe + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + false + TactonPlayer.lib;qtmain.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies) + + + + + + true + + + true + + + + + + + + + true + + + true + + + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "tactonsjnd.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." "tactonsjnd.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + + + Document + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I." "-I." "-I." + + + + + + + Document + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp + + + + + Document + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + + + + + + + + + + \ No newline at end of file diff --git a/Tactons JND/Tactons JND.vcxproj.filters b/Tactons JND/Tactons JND.vcxproj.filters new file mode 100644 index 0000000..3725302 --- /dev/null +++ b/Tactons JND/Tactons JND.vcxproj.filters @@ -0,0 +1,88 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;cxx;c;def + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} + moc;h;cpp + False + + + {46d85dc4-0c7e-48d5-bd55-7a10b0960449} + cpp;moc + False + + + {12076a94-7630-4742-8658-e16a03d8f379} + cpp;moc + False + + + + + Source Files + + + Source Files + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + + + + + Header Files + + + Form Files + + + Resource Files + + + Form Files + + + Header Files + + + + + Generated Files + + + Generated Files + + + \ No newline at end of file diff --git a/Tactons JND/answer3AFC.cpp b/Tactons JND/answer3AFC.cpp new file mode 100644 index 0000000..58ea3b1 --- /dev/null +++ b/Tactons JND/answer3AFC.cpp @@ -0,0 +1,58 @@ +#include "answer3AFC.h" + +#include + #include + +Answer3AFC::Answer3AFC(QWidget *parent, Qt::WFlags flags) + : QDialog(parent, flags), _logfile(NULL), _tactonPlayer("COM3"), _current(0) +{ + //init the window + setupUi(this); + this->layout()->setSizeConstraint(QLayout::SetFixedSize); + + //init buttons + QObject::connect(play1, SIGNAL(clicked()), this, SLOT(play(1))); + QObject::connect(play2, SIGNAL(clicked()), this, SLOT(play(2))); + QObject::connect(play3, SIGNAL(clicked()), this, SLOT(play(3))); + QObject::connect(answer1, SIGNAL(clicked()), this, SLOT(answer(1))); + QObject::connect(answer2, SIGNAL(clicked()), this, SLOT(answer(2))); + QObject::connect(answer3, SIGNAL(clicked()), this, SLOT(answer(3))); +} + +void Answer3AFC::toggleButtons() +{ + bool ok = _tplayed[0] && _tplayed[1] && _tplayed[2]; + play1->setEnabled(ok); + play2->setEnabled(ok); + play3->setEnabled(ok); +} + +void Answer3AFC::play(int tacton) +{ + if (tacton == _goodanswer) + _tactonPlayer.play(Tacton( + + (...[tacton]); + _tplayed[tacton]++; + toggleButtons(); +} + +void Answer3AFC::answer(int rep) +{ + log(rep); + _tplayed[0] = _tplayed[1] = _tplayed[2] = 0; + toggleButtons(); + + runTrial(); +} + +void Answer3AFC::log(bool answer) +{ + if (_logfile == NULL) + return; + fprintf(_logfile, "%d,%d,%d,%d,%d,%d,%d\n", _currentval, _currenttest, _goodanswer, answer, _tplayed[0], _tplayed[1], _tplayed[2]); +} + +void Answer3AFC::runTrial() +{ +} \ No newline at end of file diff --git a/Tactons JND/answer3AFC.h b/Tactons JND/answer3AFC.h new file mode 100644 index 0000000..58ffd2a --- /dev/null +++ b/Tactons JND/answer3AFC.h @@ -0,0 +1,44 @@ +#ifndef _ANSWER3AFC_ +#define _ANSWER3AFC_ + +#include + +#include +#include "ui_answer3AFC.h" + + +class Answer3AFC : public QDialog, Ui::Answer3AFCClass +{ + Q_OBJECT + +public: + Answer3AFC(QWidget *parent = 0, Qt::WFlags flags = 0); + ~Answer3AFC(); + + void init(QString user, int repetitions, QString experiment, QString gesture); + + void setAnswer(bool same); + +private: + void log(bool answer); + void runTrial(); + + FILE *_logfile; + TactonPlayer _tactonPlayer; + QString _user; + int _reversals, tseries, _fseries; + double _tinc, _finc; + QString _experiment; + QString _gesture; + + int _currentval, _currenttest, _goodanswer; + + int _tplayed[3]; + +private slots: + void toggleButtons(); + void play(int tacton); + void answer(int rep); +}; + +#endif diff --git a/Tactons JND/answer3AFC.ui b/Tactons JND/answer3AFC.ui new file mode 100644 index 0000000..177f8c5 --- /dev/null +++ b/Tactons JND/answer3AFC.ui @@ -0,0 +1,112 @@ + + + Answer3AFCClass + + + + 0 + 0 + 392 + 122 + + + + Tactons JND experiment + + + + + 0 + 0 + 391 + 121 + + + + + 10 + + + 10 + + + 20 + + + 10 + + + + + Play + + + + + + + Play + + + + + + + Play + + + + + + + + 20 + + + + + + + Which one is different? + + + Qt::AlignCenter + + + + + + + false + + + This one + + + + + + + false + + + This one + + + + + + + false + + + This one + + + + + + + + + diff --git a/Tactons JND/main.cpp b/Tactons JND/main.cpp new file mode 100644 index 0000000..d0c1492 --- /dev/null +++ b/Tactons JND/main.cpp @@ -0,0 +1,10 @@ +#include "tactonsjnd.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + TactonsJND w; + w.show(); + return a.exec(); +} diff --git a/Tactons JND/tactonsjnd.cpp b/Tactons JND/tactonsjnd.cpp new file mode 100644 index 0000000..6fedb8c --- /dev/null +++ b/Tactons JND/tactonsjnd.cpp @@ -0,0 +1,42 @@ +#include "tactonsjnd.h" + +TactonsJND::TactonsJND(QWidget *parent, Qt::WFlags flags) + : QMainWindow(parent, flags) +{ + setupUi(this); + + this->layout()->setSizeConstraint(QLayout::SetFixedSize); + + FILE *f = fopen("Experiments.txt", "r"); + if (f) + { + char buffer[256]; + while ((fgets(buffer, 256, f)) != NULL) + { + while((buffer[strlen(buffer) - 1] == '\r') || (buffer[strlen(buffer) - 1] == '\n')) + buffer[strlen(buffer) - 1] = '\0'; + experiment->addItem(buffer); + } + fclose(f); + } + + f = fopen("Gestures.txt", "r"); + if (f) + { + char buffer[256]; + while ((fgets(buffer, 256, f)) != NULL) + { + while((buffer[strlen(buffer) - 1] == '\r') || (buffer[strlen(buffer) - 1] == '\n')) + buffer[strlen(buffer) - 1] = '\0'; + gesture->addItem(buffer); + } + fclose(f); + } + + QObject::connect(buttonstart, SIGNAL(clicked()), this, SLOT(runBlock())); +} + +TactonsJND::~TactonsJND() +{ + +} diff --git a/Tactons JND/tactonsjnd.h b/Tactons JND/tactonsjnd.h new file mode 100644 index 0000000..1d26d4d --- /dev/null +++ b/Tactons JND/tactonsjnd.h @@ -0,0 +1,24 @@ +#ifndef TACTONSJND_H +#define TACTONSJND_H + +#include +#include "ui_tactonsjnd.h" + +#include "Answer3AFC.h" + +class TactonsJND : public QMainWindow, Ui::TactonsJNDClass +{ + Q_OBJECT + +public: + TactonsJND(QWidget *parent = 0, Qt::WFlags flags = 0); + ~TactonsJND(); + +private: + Answer3AFC w; + +private slots: + void runBlock(void); +}; + +#endif // TACTONSJND_H diff --git a/Tactons JND/tactonsjnd.qrc b/Tactons JND/tactonsjnd.qrc new file mode 100644 index 0000000..0bd2350 --- /dev/null +++ b/Tactons JND/tactonsjnd.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/Tactons JND/tactonsjnd.ui b/Tactons JND/tactonsjnd.ui new file mode 100644 index 0000000..35226d9 --- /dev/null +++ b/Tactons JND/tactonsjnd.ui @@ -0,0 +1,174 @@ + + + TactonsJNDClass + + + + 0 + 0 + 461 + 270 + + + + Tactons JND experiment + + + + + + + + + + + + + + User: + + + + + + + + + + Reversals: + + + + + + + 2 + + + 20 + + + 5 + + + + + + + Experiment: + + + + + + + + + + Gesture: + + + + + + + + + + T Inc + + + + + + + F Inc + + + + + + + T Series + + + + + + + F Series + + + + + + + 1 + + + 20 + + + + + + + 1 + + + 20 + + + + + + + 10.000000000000000 + + + 0.250000000000000 + + + 1.000000000000000 + + + + + + + 0.000000000000000 + + + 10.000000000000000 + + + 0.250000000000000 + + + 1.000000000000000 + + + + + + + + + + + + Start experiment + + + + + + + + + + + + + +