コード例 #1
0
bool
EGPlanner::checkTerminationConditions()
{
    if (!isActive()) {
        return true;
    }
    bool termination = false;
    //max steps equal to -1 means run forever
    if (mMaxSteps != -1 && mCurrentStep >= mMaxSteps) {
        if (!mRepeat) {
            pausePlanner();
            termination = true;
        } else {
            resetParameters();
        }
        if (!mMultiThread) {
            Q_EMIT update();
        }
    } else if (mMaxTime != -1) {
        //check time limit
        //for now exceeding the time limit simply kills it for good
        if (getRunningTime() > mMaxTime) {
            termination = true;
            stopPlanner();
        }
    }
    if (termination) {
        Q_EMIT complete();
    }
    return termination;
}
コード例 #2
0
ファイル: egPlanner.cpp プロジェクト: CURG/graspit_handop
/*! After this is called, the planner can no longer be re-started. 
	This differentiation is needed mainly for the multi-threaded case: 
	this function stops the planner's thread.
*/
void
EGPlanner::stopPlanner()
{
	if (getState()==DONE || getState()==EXITED) return;
	//this will stop the planner REGARDLESS of what state it is in!
	pausePlanner();
	//this also finishes the thread
	setState(DONE);
	if (mMultiThread) {
		DBGP("Waiting for exit");
		//wait for the thread to stop spinning
		while (getState()!=EXITED);
		DBGP("Exited");
	}
}