本文整理汇总了C++中BalanceFactor::reinsert方法的典型用法代码示例。如果您正苦于以下问题:C++ BalanceFactor::reinsert方法的具体用法?C++ BalanceFactor::reinsert怎么用?C++ BalanceFactor::reinsert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BalanceFactor
的用法示例。
在下文中一共展示了BalanceFactor::reinsert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: advanceTrial
/**
* @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);
}
}
示例2: advanceTrial
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);
}
}
示例3: handleKeypress
// Funzione di callback per gestire pressioni dei tasti
void handleKeypress(unsigned char key, int x, int y)
{
switch (key)
{
#ifdef SIMULATION
case '0':
{
good_trial = 1;
advanceTrial();
} break;
case '1':
allVisibleFingers = !allVisibleFingers;
break;
case '2':
{
trial.reinsert(trial.getCurrent());
good_trial = 0;
advanceTrial();
} break;
#endif
case 'i': // show info
visibleInfo=!visibleInfo;
break;
case 'm': // increase IOD
interoculardistance += 0.5;
break;
case 'n': // decrease IOD
interoculardistance -= 0.5;
break;
case 27: // press escape to quit
{
cleanup(); // clean the optotrak buffer
exit(0);
} break;
// fingers calibration
case 'f':
case 'F':
{
// Interpolate the fingertip (fourth virtual marker)
if ( fingerCalibrationDone==2 && allVisibleFingers && allVisibleObject )
{
fingerCalibrationDone=3;
calibration_fingers(fingerCalibrationDone);
beepOk(0);
break;
}
// Start the experiment
if ( fingerCalibrationDone==3 && allVisibleFingers )
{
fingerCalibrationDone=4;
beepOk(0);
visibleInfo=false;
drawGLScene(); // this is needed otherwise the next motor command freezes the screen
initProjectionScreen(-280);
}
} break;
case ' ': // confirm that you grasped
{
if(allVisibleFingers)
{
iGrasped = true;
isStimulusDrawn = false;
}
} break;
}
}
示例4: handleKeypress
// Funzione di callback per gestire pressioni dei tasti
void handleKeypress(unsigned char key, int x, int y)
{
switch (key)
{
#ifdef SIMULATION
case '0':
{
good_trial = 1;
advanceTrial();
}
break;
case '1':
allVisibleFingers = !allVisibleFingers;
break;
case '2':
{
trial.reinsert(trial.getCurrent());
good_trial = 0;
advanceTrial();
}
break;
#endif
case 'i': // show info
visibleInfo=!visibleInfo;
break;
case 'm': // increase IOD
interoculardistance += 0.5;
break;
case 'n': // decrease IOD
interoculardistance -= 0.5;
break;
case 27: // press escape to quit
{
cleanup(); // clean the optotrak buffer
exit(0);
}
break;
// fingers calibration
case 'f':
case 'F':
{
// Interpolate the fingertip (fourth virtual marker)
if ( fingerCalibrationDone==2 && allVisibleObject && allVisibleFingers )
{
fingerCalibrationDone=3;
calibration_fingers(fingerCalibrationDone);
beepOk(3);
break;
}
// Start the experiment
if ( fingerCalibrationDone==3 && allVisibleFingers )
{
fingerCalibrationDone=4;
beepOk(0);
home_position = ind;
visibleInfo=false;
drawGLScene(); // this is needed otherwise the next motor command freezes the screen
// check where the object is
object_reset_position = markers[3].p.transpose();
// calculate where the object has to go
Vector3d object_position(0.0,object_reset_position.y(),-550.0);
// move the object to position from where it is
moveObjectAbsolute(object_position, object_reset_position, 5000);
trial.next();
initTrial();
}
if (fingerCalibrationDone==4 && training)
areFingersDrawn = !areFingersDrawn;
}
break;
case ' ': // confirm that you grasped
{
if(allVisibleFingers)
{
iGrasped = true;
isStimulusDrawn = false;
}
}
break;
/* case 't':
{
training = true;
experiment =false;
beepOk(0);
//.........这里部分代码省略.........
示例5: advanceTrial
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();
}
}