Example #1
0
/**
 * @brief advanceTrial
 * @param response
 */
void advanceTrial(int response)
{
	responseFile << 
		parameters.find("SubjectName") << "\t" << 
		trialNumber << "\t" <<  
		focalDistance << "\t" << 
		response << "\t" << 
		trialTimer.getElapsedTimeInMilliSec() << "\t" <<
		trial.getCurrent().at("ZWidth") << "\t" << 
		trial.getCurrent().at("Slant") << "\t" << 
		trial.getCurrent().at("Tilt") << "\t" << 
		trial.getCurrent().at("StimulusAnchored") << " " << endl;
 	if ( trial.isEmpty() )
	{
		exit(0);
	}
    trial.next();

    updateStimulus();
    beepOk();
	trialMode=BLACK_MODE;
	trialNumber++;
	trialTimer.start();
	frame=0.0;
}
void advanceTrial()
{
	double timeElapsed = timer.getElapsedTimeInMilliSec();
	responseFile.precision(3);
    responseFile << 
					parameters.find("SubjectName") << "\t" <<
					//interoculardistance << "\t" <<
					trialNumber << "\t" <<
					stimPosn << "\t" <<
					"-420" << "\t" <<//trial.getCurrent()["AbsDepth"] <<"\t" <<
                    "50" << "\t" <<//trial.getCurrent()["ObjHeight"] <<"\t" <<
                    timer.getElapsedTimeInMilliSec() << "\t" <<
					//trial.getCurrent()["HapticFB"] << "\t" <<
					//randCond << "\t" <<
					//randIncrement << "\t" <<
					stimCond << "\t" <<
					pulsingColors << "\t" <<
					endl;
	
	trialFile.close();

	trialNumber++;

	if( !trial.isEmpty() )
	{
		trial.next();
		initTrial();
	}
	else
	{
		exit(0);
	}

}
/**
 * @brief advanceTrial: This function to the next trial
 */
void advanceTrial()
{
    fingersTimer.start(); // Here we change trial mode

    if (trialMode == HANDONSTARTMODE )
    {
        // Wait to show the stimulus that the fingers points are projected in the screen
        trialMode = STIMULUSMODE;
    }
    else // trialMode == STIMULUSMODE
    {
		trialMode = HANDONSTARTMODE;
		paintGL();
		beepTrial();
		double oldDistance = factors.getCurrent().at("Distances");
        // Reinsert the trial if too much occluded frames
		double maxInvisibleFramesPercent = util::str2num<double>(parameters.find("MaxPercentOccludedFrames"))/100.0;
		if ( (invisibleIndexFrames / ((double)drawingTrialFrame) > maxInvisibleFramesPercent ) ||
			(invisibleThumbFrames / ((double)drawingTrialFrame) > maxInvisibleFramesPercent )||
			(invisibleWristFrames / ((double)drawingTrialFrame) > maxInvisibleFramesPercent ) )
		{
			map<string,double> currentFactorsList = factors.getCurrent();
            beepBad();
            cerr << "Reinserted current trial (InvIndex,InvThumb,drawingTrialFrame,totTrialFrame)" << invisibleIndexFrames << " " << invisibleThumbFrames << " " << drawingTrialFrame << " " << trialFrame << endl;
            factors.reinsert(currentFactorsList);
		}
		if (factors.isEmpty())
        {
            beepLong();
            beepLong();
            beepLong();
            plato_stop();
			exit(0);
        }
        invisibleIndexFrames = invisibleThumbFrames = invisibleWristFrames = trialFrame = drawingTrialFrame = 0;
        totalTrialNumber++;
		factors.next();
		
		if (oldDistance == factors.getCurrent().at("Distances"))
		{
			Timer sleepTimer; sleepTimer.sleep(1000);
		}
		
		double marker5z = markers.at(5).p.z();
		generateSphereStimulus( factors.getCurrent().at("StimulusRadius") );
        initProjectionScreen(factors.getCurrent().at("Distances"));
        moveStimulusObject(visualStimCenter,3500);
    }
}
Example #4
0
void advanceTrial()
{
	double timeElapsed = timer.getElapsedTimeInMilliSec();
	responseFile.precision(3);
    responseFile << 
					parameters.find("SubjectName") << "\t" <<
					//interoculardistance << "\t" <<
					trialNumber << "\t" <<
					stimPosn << "\t" <<
					trial.getCurrent()["RodVisibleTime"] << "\t" <<
					trial.getCurrent()["AbsDepth"] <<"\t" <<
                    //"50" << "\t" <<//trial.getCurrent()["ObjHeight"] <<"\t" <<
                    timer.getElapsedTimeInMilliSec() << "\t" <<
					//trial.getCurrent()["HapticFB"] << "\t" <<
					//randCond << "\t" <<
					//randIncrement << "\t" <<
					stimCond << "\t" <<
					BG_WHITE << "\t" <<
					endl;
	
	trialFile.close();

	double percent_occluded_frames = num_lost_frames/TGA_frame;
	bool not_enough_frames = percent_occluded_frames > 0.20;
	cout << num_lost_frames << "_" << frameN << "_" << percent_occluded_frames << endl;
	int overwrite = 0;

	if (training || !reachedObject || not_enough_frames ) {
		cout << training << "_" << !reachedObject << "_" << not_enough_frames << endl;
		map<std::string,double> currentFactorsList = trial.getCurrent();
		trial.reinsert(currentFactorsList);
		beepOk(1);
		overwrite = 1;
	}

	if( !trial.isEmpty() )
	{
		if (!overwrite)
			trialNumber++;
		cout << trialNumber << endl;
		factors = trial.getNext();
		initTrial();
	}
	else
	{
		exit(0);
	}

}
Example #5
0
void mouseFunc(int button, int state, int _x , int _y)
{
    if ( trialMode == PROBEMODE )
    {
        glutWarpPointer(SCREEN_WIDTH/2,SCREEN_HEIGHT/2);

        if ( button == GLUT_LEFT_BUTTON && (state==GLUT_DOWN) )
            mouseButton=1;
        if ( button == GLUT_RIGHT_BUTTON && (state==GLUT_DOWN) )
            mouseButton=-1;

        if( (button== GLUT_LEFT_BUTTON || button==GLUT_RIGHT_BUTTON) && (state==GLUT_UP) && (mouseButton!=0) )
        {
            double responseTime=responseTimer.getElapsedTimeInMilliSec();
            double clickDelay=100;	//milliseconds before the click is valid
            if ( responseTime > clickDelay )
            {
                timeFrame=0.0; //this put the stimulus in the center each central time mouse is clicked in
                if ( trial.isEmpty() )
                {
                    responseFile << setw(6) << left <<  trialNumber << " " << factors["Def"] <<" " << factors["Tilt"] <<" " << factors["Slant"] << " " << factors["Anchored"] << " " << factors["RotationSpeed"] << " " << factors["FollowingSpeed"] << " " << factors["Onset"] << " " << (focalDistance - eyeCalibration.z()) << " " << mouseButton << " " << responseTime << endl;
                    cleanup();
                    exit(0);
                }
                else
                {
                    responseFile << setw(6) << left <<  trialNumber << " " << factors["Def"] <<" " << factors["Tilt"] <<" " << factors["Slant"] << " " << factors["Anchored"] << " " << factors["RotationSpeed"] << " " << factors["FollowingSpeed"] << " " << factors["Onset"] << " " << (focalDistance - eyeCalibration.z()) << " " << mouseButton << " " << responseTime << endl;
                    factors = trial.getNext();
                    trialNumber++;

                }
                advanceTrial();
                redDotsPlane.setDimensions(50,50,0.1);
                redDotsPlane.setSlantTilt(factors["Slant"], factors["Tilt"] );
                redDotsPlane.compute();
                stimDrawer.initList(&redDotsPlane);
                mouseButton=0;
            }
        }
    }
    glutPostRedisplay();
}
Example #6
0
// Funzione di callback per gestire pressioni dei tasti
void handleKeypress(unsigned char key, int x, int y)
{   switch (key)
    {   //Quit program
	case 'x':
		// Facendo cosi si cancella lo stimolo durante il movimento (SINCRONO) del monitor.
		// Si imposta il isStimulusDrawn a FALSE e si riaggiorna la schermata con una drawGLScene()
		// infine si muove il monitor, la chiamata blocca il programma per x secondi, si 
		// simula lo spostamento dello schermo di proiezione ed infine si reimposta isStimulusDrawn a TRUE
		// cosi' la prossima chiamata di drawStimulus() lo disegna correttamente a schermo. Provare per credere...
		//factors = trial.getNext();
		trial.next();
		isStimulusDrawn=false;
		drawGLScene();
		initProjectionScreen(trial.getCurrent()["AbsDepth"]);
		isStimulusDrawn=true;
		break;
	case 'i':
		visibleInfo=!visibleInfo;
		break;
	case 'm':
		interoculardistance += 0.5;
	break;
	case 'n':
		interoculardistance -= 0.5;
	break;
	case '+':
	{
		// Il trucco per avanzare alla modalita' trial successiva: incrementi di uno e poi tieni il resto della 
		// divisione per due, in questo caso ad esempio sara' sempre:
		// 0,1,0,1,0,1
		// se metti il resto della divisione per 3 invece la variabile trialMode sar'
		// 0,1,2,0,1,2
		// ogni ciclo della variabile trialMode normalmente e' un trial (1)
		// puoi anche definire una funzione void advanceTrial() che si occupa di andare al trial successivo,
		// deve contenere una chiamata alla BalanceFactor::getNext() cosi' passi alla nuova lista di fattori
		// Ad esempio
		 trialMode++;
		 trialMode=trialMode%3;
	}
	break;
	case 't':
	{
		if (trial.isEmpty())
			exit(0);
		trial.next();

		break;
	}
	case 'Q':
	case 'q':
    case 27:	//corrisponde al tasto ESC
    {   
		// Ricorda quando chiami una funzione exit() di chiamare prima cleanup cosi
		// spegni l'Optotrak ed i markers (altrimenti loro restano accesi e li rovini) 
		cleanup();
        exit(0);
    }
    break;
    case ' ':
    {
        // Here we record the head shape - coordinates of eyes and markers, but centered in (0,0,0)
        if ( headCalibrationDone==0 && allVisiblePatch )
        {
            headEyeCoords.init(markers[1].p-Vector3d(230,0,0),markers[1].p, markers[5].p,markers[6].p,markers[7].p,interoculardistance );
            headCalibrationDone=1;
			beepOk(0);
            break;
        }
        // Second calibration, you must look a fixed fixation point
        if ( headCalibrationDone==1 && allVisiblePatch )
        {
            headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[5].p, markers[6].p,markers[7].p,interoculardistance );
            headCalibrationDone=2;
            break;
        }
    }
    break;
    // Enter key: press to make the final calibration
    case 13:
    {
        if ( headCalibrationDone == 2 && allVisiblePatch )
        {
            headEyeCoords.init( headEyeCoords.getP1(),headEyeCoords.getP2(), markers[1].p, markers[2].p,markers[3].p,interoculardistance );
            headCalibrationDone=3;
			visibleInfo=false;
        }
    }
    break;
      case '5':
      {  
		  if(dz/2>10)
			zedge -= .25;
		  else
			  zedge = zedge;
	  }
      break;
      case '8':
      {  
		 zedge += .25;
      }
      break;
	  case '4':
      {  
		xedge -= .25;
	  }
      break;
      case '6':
      {  
		  xedge += .25;
      }
      break;
      case 'a':
      {  
		  theta -= M_PI/2.0;
      }
      break;
      case 's':
      {  
		  theta += M_PI/2.0;
	  }
      break;
	  case '0':
	  {
		  advanceTrial();
	  }
	  break;
	}
}
Example #7
0
void advanceTrial()
{   if ( trialMode == STIMULUSMODE )
    {   bool pretrialMode=trialMode;
        trialMode++;
        trialMode=trialMode%2;
        totalTrialNumber++;

        if (block.at("Phase") != 1 )
        {
            double percentOccludedFrames = ((double)occludedFrames/(double)drawingTrialFrame )*100.0;
            if ( percentOccludedFrames > str2num<double>(parameters.find("TestPercentOccludedFrames")) )
            {
                cerr << "Percent occluded frames is" << percentOccludedFrames << " " << occludedFrames << " over " << drawingTrialFrame << endl;
                trial.reinsert(factors);

            }
            drawingTrialFrame=0;
            occludedFrames=0;
        }
        trialFrame=0;
        switch( block.at("Phase") )
        {
        case 0:  //pre-test
        {
            if ( !trial.isEmpty() )	// ci son ancora trial
            {   beepTrial();
                initStimulus(testStimHeight,testStimRadius);
                factors = trial.getNext();
                deltaXRods = mathcommon::unifRand(str2num<double>(parameters.find("DeltaXMin")),str2num<double>(parameters.find("DeltaXMax")));
                visualRodCenter = Vector3d(0,0,factors.at("Distances"));
                hapticRodCenter  = rodAway;
                initProjectionScreen(visualRodCenter.z());
                moveScreenAbsolute(visualRodCenter.z(),homeFocalDistance,SCREENSPEED);
                beepTrial();
            }
            else // si prepara per la modalità 1 (adaptation)
            {   trialMode = HANDONSTARTMODE;
                block = module.getNext();
                initStimulus(testStimHeight,testStimRadius );
                double zadaptmin = str2num<double>(parameters.find("AdaptZMin"));
                double zadaptmax = str2num<double>(parameters.find("AdaptZMax"));

                if (str2num<int>(parameters.find("AdaptMoveMonitor"))==1)
                    visualRodCenter=Vector3d(0,0,mathcommon::unifRand(zadaptmin,zadaptmax));
                else
                    visualRodCenter=Vector3d(0,0, (zadaptmin+zadaptmax)/2);
                initProjectionScreen( visualRodCenter.z());

                if ( str2num<int>(parameters.find("AdaptHapticFeedback"))==1 )
                    hapticRodCenter = visualRodCenter - Vector3d(0,0,adaptOffsets.at(block1TrialNumber));
                else
                    hapticRodCenter = rodAway;

                moveRod(Vector3d(0,0,hapticRodCenter.z() ),RODSPEED);

                checkBounds();
                beepLong();
            }
            block0TrialNumber++;
        }
        break;
        case 1:  // adaptation
        {
            block1TrialNumber++;
            if ( block1TrialNumber < str2num<int>(parameters.find("AdaptTrials")) )
            {   beepTrial();
                initStimulus(adaptStimHeight,adaptStimRadius);
                double zadaptmin = str2num<double>(parameters.find("AdaptZMin"));
                double zadaptmax = str2num<double>(parameters.find("AdaptZMax"));

                if (str2num<int>(parameters.find("AdaptMoveMonitor"))==1)
                    visualRodCenter = Vector3d(0,0,mathcommon::unifRand(zadaptmin,zadaptmax));
                else
                    visualRodCenter=Vector3d(0,0, (zadaptmin+zadaptmax)/2);

                if ( str2num<int>(parameters.find("AdaptHapticFeedback"))==1 )
                {
                    hapticRodCenter = visualRodCenter - Vector3d(0,0,adaptOffsets.at(block1TrialNumber));
                    moveScreenAbsoluteAsynchronous(visualRodCenter.z(),homeFocalDistance,SCREENSPEED);
                    moveRod(hapticRodCenter,RODSPEED);
                }
                else
                {
                    hapticRodCenter = rodAway;
                    moveScreenAbsolute(visualRodCenter.z(),homeFocalDistance,SCREENSPEED);
                }

                initProjectionScreen( visualRodCenter.z());
                beepTrial();
            }
            else
            {   beepLong();
                trialMode = HANDONSTARTMODE;
                block  = module.getNext();
                // reset the factors in order to prepare the next test phase
                trial.init(parameters);
                factors.clear();
                factors  = trial.getNext();
                deltaXRods = mathcommon::unifRand(str2num<double>(parameters.find("DeltaXMin")),str2num<double>(parameters.find("DeltaXMax")));
                //cerr << "DISTANCE= " << factors.at("Distances") << endl;
                initStimulus(testStimHeight,testStimRadius);
                visualRodCenter = Vector3d(0,0,factors.at("Distances"));
                hapticRodCenter = rodAway;

                moveScreenAbsolute(visualRodCenter.z(),homeFocalDistance,SCREENSPEED);
                moveRod(rodAway,RODSPEED);
                initProjectionScreen(visualRodCenter.z());

                beepTrial();
            }
        }
        break;
        case 2:  /// post-test
        {   if ( trial.isEmpty() )
            {   beepLong();
                cleanup();
                exit(0);
            }
            else
            {   beepTrial();
                initStimulus(testStimHeight,testStimRadius);
                factors = trial.getNext();
                deltaXRods = mathcommon::unifRand(str2num<double>(parameters.find("DeltaXMin")),str2num<double>(parameters.find("DeltaXMax")));
                cerr << "DISTANCE= " << factors.at("Distances") << endl;
                visualRodCenter =  Vector3d(0,0,factors.at("Distances"));
                hapticRodCenter  = rodAway;
                initProjectionScreen(visualRodCenter.z());
                moveScreenAbsolute(visualRodCenter.z(),homeFocalDistance,SCREENSPEED);
                beepTrial();
            }
            block2TrialNumber++;
        }
        break;
        }
        globalTimer.start();
    }
    // Mettere una idle così non perde il primo trial
    idle();
}
Example #8
0
int main(void)
{  randomizeSeed();
   /*
   BalanceFactor<int> balance;
   map<string,int> factors;
   balance.init(1,true);
   vector<int> f;
   for (int i=0; i<10; i++)
   f.push_back(i);

   balance.addFactor( "Slant",  f );
   while ( !balance.isEmpty() )
   {
       factors = balance.getNext();
       cout << factors["Slant"] << endl;
   }
   balance.init(1,true);
   cerr << "==========" << endl;
   f.clear();
   for (int i=0; i<10; i++)
   f.push_back(i);

   balance.addFactor( "Slant",  f );
   while ( !balance.isEmpty() )
   {
       factors = balance.getNext();
       cout << factors["Slant"] << endl;
   }
   */
   /*
   balance.addFactor( "Tilt", vlist_of<int>(90) );
   balance.addFactor( "Anchored", vlist_of<int>(0)(1)(2)(3));

   //balance.print();

   while ( !balance.isEmpty() )
   {
         map<string, int> tmp2 = balance.getNext() ;
         for ( map<string, int>::iterator iter = tmp2.begin(); iter!=tmp2.end(); ++iter)
         cout << iter->first << " " << iter->second << " ";
         cout << endl;
   }

   cerr << isnan(1.0/0.0) << " " << isinf(1.0/0.0) << endl;
    return 0;
    */
   map<string,int> factors;
   ifstream paramFile;
   paramFile.open("prova.exp");

   ParametersLoader params;
   params.loadParameterFile(paramFile);
   BalanceFactor<int> bfact;
   bfact.init(params);
   while (!bfact.isEmpty())
   {  factors = bfact.getNext();
      cout << factors["StimSpeed"] << endl;
   }
   //bfact.print();

   bfact.init(params);

   while (!bfact.isEmpty())
   {  factors = bfact.getNext();
      cout << factors["StimSpeed"] << endl;
   }
   /*
   BalanceFactor<int> balance;
   balance.init(params);
   balance.print();

   while ( !balance.isEmpty() )
   {
        map<string,int> vals = balance.getNext();
        for ( map<string,int>::iterator iter = vals.begin(); iter!=vals.end(); ++iter )
        {
        cout << iter->first << " " << iter->second << endl;
        }
        cout << endl << endl;

   }
   */

   return 0;
}
void advanceTrial()
{
	// Determine if previous trial was a good trial
	double percentOccludedFrames = numLostFrames/TGA_frame;
	bool notEnoughFrames = percentOccludedFrames > 0.10 ;
	int overwrite = 0;

	// If any of these things are true when advanceTrial is called, reinsert!
	if (training || !reachedObject || notEnoughFrames ) {
        beepOk(3); // 1000hz, 50ms
		if (training)
			cout << "Training Mode!" << endl;
		if (!reachedObject)
			cout << "I don't think you reached the object..." << endl;
		if (notEnoughFrames)
			cout << "Be visible!" << endl;

		if (!controlCondition) {
			map<std::string,double> currentFactorsList = trial.getCurrent();
			trial.reinsert(currentFactorsList);
		}

		overwrite = 1;
	}

	// Write previous trial to response file
	if (!overwrite && !controlCondition)
	{
		responseFile.precision(3);
		responseFile << 
						parameters.find("SubjectName") << "\t" <<
						trialNumber << "\t" <<
						TGA_time << "\t" <<
						trial.getCurrent()["ObjPosn"] << "\t" <<
                        sm_lg << "\t" <<
						con_inc << "\t" <<
						endl;
	} else if (!overwrite && controlCondition) {
		controlResponseFile.precision(3);
		controlResponseFile << 
						parameters.find("SubjectName") << "\t" <<
						controlTrial << "\t" <<
						TGA_time << "\t" <<
						currentObj << "\t" <<
                        sm_lg << "\t" <<
						con_inc << "\t" <<
						endl;
	}

	// Close previous trial file
	trialFile.close();

	// If we're done with control block
	if (controlCondition && controlTrial==16) {
		if (!overwrite) { // and not overwriting, change over
			plato_stop();
			exit(0);
			//controlCondition=false;
			//endControl=true;
		}
		else // if we ARE overwriting, initTrial again until we get it
			initTrial();
	}
	// If we're still in the control block
	if (controlCondition && controlTrial<16 ){
		if (!overwrite) //and not overwriting
			controlTrial++; //increment
		initTrial(); //initTrial will handle a repeat or the next trial
	}
	// If we're in the main block
	if( !trial.isEmpty() && !controlCondition)
	{
		if (!endControl) { // If it's NOT the v. first main block trial
			if (!overwrite) // and we're not overwriting due to a bad trial
				trialNumber++; // increment
			factors = trial.getNext(); // get the next trial and initialize it!
			initTrial();
		} else { // It IS the v. first main block trial (endControl)
			endControl=false; // turn this switch off so we know next time around that it's trial 1
			initTrial(); // initTrial WITHOUT getNext because we already gotNext at the end of calibration
		}
	}
	// Finally, if we're out of trials, finish the experiment.
	else if (trial.isEmpty() && !controlCondition)
	{
		controlCondition=true;
		initTrial();
	}
}
Example #10
0
/*** FUNCTIONS FOR TRIAL MODE DRAWING ***/
void advanceTrial()
{
    if ( trial.isEmpty() )
    {
#ifdef WIN32
        for (int i=0; i<3; i++)
        {
            Beep(220,440);
            totalTimer.sleep(20);
        }
#endif
        exit(0);
    }

    switch (trialMode)
    {
    case FIXATIONMODE:
    {
#ifdef WIN32
        Beep(440,440);
#endif
        totalTimer.start();
        stimulusTimer.start();
        //clearAndWait(2);
        trialMode=STIMULUSMODE;
    }
    break;
    case STIMULUSMODE:
    {
#ifdef WIN32
        Beep(440,440);
#endif
        trialMode=PROBEMODE;
        totalTimer.start();
        stimulusTimer.start();
    }
    break;
    case PROBEMODE:
    {
#ifdef WIN32
        Beep(880,440);
#endif
        resetPointStrip();
        responseTimer.start();
        totalTimer.start();
        trialMode=FIXATIONMODE;
    }
    }
    resetPointStrip();
    factors = trial.getNext();
    trialNumber++;
    responseFile << setw(6) << left <<
                 trialNumber << "\t" <<
                 factors["Tilt"] << "\t"  <<
                 factors["Slant"] << "\t" <<
                 factors["Def"] << "\t" <<
                 factors["FlowDirection"] << "\t" <<
                 factors["FlowIncrement"] << "\t" << endl;

    double responseTime=responseTimer.getElapsedTimeInMilliSec();
    timeFrame=0.0; //this put the stimulus in the center each central time mouse is clicked in
}
// INITTRIAL TO CHECK (MOSTLY FOR FINGERS-RELATED EVENTS)
void initTrial()
{
	// if the current is not an empty trial...
	if(!trial.isEmpty())
	{
		if(condition == 0)
			beepOk(0);

		if(condition == 1)
			endTrial = false;

		// these variables are reset
		showStimuli = false;
		h_stimulus = 1;
		fingersOccluded = 0;
		framesOccluded=0;
		frameN = 0;

		// random seed
		//srand(rand() % 100);
		// pick 0 or 1 at random and assign it to first_interval
		first_interval = rand() % 2;
		// pick the complementary (0 or 1) and assign it to second_interval
		second_interval = 1 - first_interval;
#ifdef SIMULATION
		//srand(5);
		testJND = str2num<double>(parameters.find("JND"));
		double JND = mathcommon::gaussRand(0,testJND);

		// set the parameters to build the stimulus:
		// HEIGHT
		//--- standard
		stimulus_height[0] = 55.0; 
		//--- comparison
		stimulus_height[1] = trial.getCurrent()["ConstantStimuli"] + JND; 
		// EGOCENTRIC DISTANCE
		absDepth = trial.getCurrent()["AbsDepth"];
#else
		// set the parameters to build the stimulus:
		// HEIGHT
		//--- standard
		stimulus_height[0] = 55.0; 
		//--- comparison
		stimulus_height[1] = trial.getCurrent()["ConstantStimuli"]; 
		// EGOCENTRIC DISTANCE
		absDepth = trial.getCurrent()["AbsDepth"];
#endif
		// build the stimuli		
		buildStandard(stimulus_noise, absDepth);		
		buildComparison(stimulus_height[1], stimulus_noise, absDepth);

#ifndef SIMULATION
		// roll on
		drawGLScene();
		initProjectionScreen(absDepth);

		if(condition == 1)
		{
			// generate random speed between 3500 and 5000
			randSpeed = rand() % 1501 + 3500;
			// move bottom surface up to topY - stimulus_height[first_interval]
			Vector3d moveHeight(0.0,whereTop.y()-stimulus_height[first_interval],absDepth);
			moveObjectAbsolute(moveHeight, whereBottom, randSpeed);
			beepOk(0);
		}
		
		if(condition == 0)
		{
			// show the stimuli
			showStimuli = true;
		}
		timer.start();
#else
		advanceTrial();
#endif

	} else
	{	
		if(condition == 1)
			responseFile.close();

		summaryFile.close();

		cleanup();
		exit(0);
	}
}