コード例 #1
0
ファイル: TubeBot.cpp プロジェクト: The-Charge/2011_TubeBot
	void FunctionBot::runArm()
	{
		int state;
		int pnulvl;
		float lim;
		state=getState();
		pnulvl=pnuState(state);
		if(state==5||state==6)
		{
			lim=MAX_POS_0/300.0f;
		}
		else
			lim=MAX_POS_1/300.0f;
		if(pnulvl>lpnulvl)
		{
			if(!inTransit)
			{
				updatePNU(pnulvl);
				inTransit=true;
				startTiming(1);
			}
			else if(timeExpired())
			{
				inTransit=false;
				lpnulvl=pnulvl;
				if(desiredAngle()<lim)
				{
					updateElbow(desiredAngle());
				}
				else
					updateElbow(lim);
			}
			else
			{
				if(desiredAngle()<MAX_POS_0/300.0f)
					updateElbow(desiredAngle());
				else
					updateElbow(MAX_POS_0/300.0f);
			}
		}
		else
		{
			if(currentAngle()>lim)
			{
				updateElbow(lim);
			}
			else
			{
				updatePNU(pnulvl);
				lpnulvl=pnulvl;
				if(desiredAngle()<lim)
					updateElbow(desiredAngle());
				else
					updateElbow(lim);
			}
		}
		updateClaw();
	}
コード例 #2
0
ファイル: main.cpp プロジェクト: sensaura-public/sensnode
/** Delay the invocation of the application loop for a specified duration
 *
 * This function will block until the specified time period has elapsed but
 * background tasks (network operations, battery monitoring, etc) will continue.
 *
 * @param duration the amount of time to delay for
 * @param units the units the duration is specified in
 */
void delay(uint32_t duration, TIMEUNIT units) {
  static bool inDelay = false;
  if(inDelay)
    return; // Avoid recursive calls
  inDelay = true;
  // Run the main loop without the user application for a while
  uint32_t timer = getTicks();
  while(!timeExpired(timer, duration, units))
    mainLoop(false);
  inDelay = false;
  }
コード例 #3
0
ファイル: colliIr.c プロジェクト: herrsergio/bee_src
void
COLLI_IrHandler( irInfo* irs)
{
  if ( 0 && irs->numberOfActivatedIrs > 0)
    fprintf( stderr, "%d irs\n", irs->numberOfActivatedIrs);

  if ( irs->numberOfActivatedIrs > 0
       ||
       ( irs->numberOfActivatedIrs == 0
	&&
	Ir_Obstacle_Points.no_of_points > 0
	 &&
	 ( timeExpired( IR_TIMER) > IR_REMEMBER_TIME))
       )
    update_IrPoints( irs);
  
  COLLI_update_tcx_IrPoints();
}
コード例 #4
0
ファイル: QtMonitoring.cpp プロジェクト: ed-01/QtMonitor
QtMonitoring::QtMonitoring() : QWidget()
{
	ui.setupUi(this);

	infoThread = new InfoThread();
	memInfo = new MemoryInfo("/proc/meminfo");

	QHBoxLayout *controlLayout = new QHBoxLayout;

	btnStart = new QPushButton("Start");
	btnStop = new QPushButton("Stop");
	btnStop->setEnabled(false);

	this->connect(btnStart, SIGNAL(clicked()), this, SLOT(startMonitoring()));
	this->connect(btnStop, SIGNAL(clicked()), this, SLOT(stopMonitoring()));

	this->connect(infoThread, SIGNAL(timeExpired()), this, SLOT(handleTimeExpired()));

	controlLayout->addWidget(btnStart);
	controlLayout->addWidget(btnStop);

	this->setLayout(controlLayout);
}