Esempio n. 1
0
ProgressUI *ProgressUI::showProgerss(QString txt, QWidget *p)
{
    ProgressUI *ui = new ProgressUI();
    ui->setText(txt);
    ui->show();
    if (p)
        MovePcenter(p, ui);
    else
        movecenter(ui);
    ui->activateWindow();
    return ui;
}
int main()
{
//	wait_for_light(7);
	enable_servos();
	set_servo_position(1,2000);
	float threshold=190;     // set threshold for light conditions
	while(analog(4) <= 190 && analog(6) <= 190) {
		movecenterslow(500);
	}
	if(analog(4) >= threshold ||analog(6) >= threshold) {
		ao();
			sleep(.5);
			movecenterslow(400);
			sleep(.2);
		}
		while(analog(4) <= 190 && analog(6) <= 190) {
		movecenterslow(500);
	}
	
	ao();
	turnCCW();
	sleep(1);
	movecenterfast(900);
	sleep(3.2124512516);
	turnCW();
	while(analog(4) <= 190 && analog(6) <= 190) {
		movecenterfast(500);
	}
	ao();
	sleep(8);
			movecenterfast(800);
	sleep(1);
	
	while(analog(4) <= 190) {
		movecenterslow(500);
	}
	ao();
//at this point it has stopped at our side of the center divider
		set_servo_position(1, 1600); //lift up the arms enough so that the robot can still detect the line while clearing the center bump.
	while(analog(4) >= 190 || analog(6) >= 190) 
	{
		movecenterfast(900); //move forward as long as both of the sensors arent over white
	}
	set_servo_position(1,2000);
turnCCW();
	//insert tower tracking function here (possibly move servos to knock over towers
	turnCW();
	turnCW();
	movecenterfast(900);
	sleep(1);
	turnCCW();
	LuggageTrack(); //track and pick up luggage
	movecenterbackwards(600);
	sleep(3);
	ao();
	set_servo_position(1,200);
	movecenterbackwards(400);
	sleep(1);
	ao();
	turnCCW();
	movecenter(600);
	sleep(1.5);
	ao();
	turnCW();
	while(analog(4) <= 190 && analog(6) <= 190) {
		movecenterslow(350);
	}
	ao();
	movecenterslow(200);
	sleep(0.3);
	ao();
	
}