Esempio n. 1
0
void classic15Blue()
{
		int armMin = 290;
		int wallHeight = 1000;
		int goalHeight = 1700;
		int dead1 = 1200;
		int dead2 = 2000;
		int dead3 = 3000;
		int pot = analogRead (8);

	//encoder values
		int encoder1 = 900; //drive to goal
		int encoder2 = 325; //keep going towards goal
		int encoder3 = 0; //drive slow, adjust to 90 degrees
		int encoder4 = 325; //back up
		int encoder5 = 1350; //back up across the barrier again
		int encoder6 = 80; // turn towards center large ball
		int encoder7 = 600; // hit 1st ball off the barrier
		int encoder8 = 350; // drive back
		int encoder9 = 200; // turn towards other large ball
		int encoder10 = 400; // hit 2nd ball off the barrier
		int encoder11 = 300; // drive back to square
		int encoder12 = 290; // turn to barf
		int encoder13 = 800; // drive to barf + pickup
		int encoder14 = 400;
		int encoder15 = 700;


	// begin routine

	intakeDead();
	delay(1000);
	stopIntake();

	// driveforward (some curve)////////////////////////////////////////////////////
	int counts = 0;
		imeReset(0); // rest rightLine ime
		imeGet(0, &counts);

		while (abs(counts) < encoder1)
		    {
		      motorSet (motor1, 110)	; // slight curve cuz friction
		      motorSet (motor2, 110)	;
		      motorSet (motor10, 127)	;
		      motorSet (motor9, 127)	;

		      imeGet(0, &counts); // keep getting the value
		    }

		motorSet (motor1, 0)	;
		motorSet (motor2, 0)	;
		motorSet (motor10, 0)	;
		motorSet (motor9, 0)	;
		delay(200);

///////////////////////////////////////////////////////////////////////////////



	//driveForward(encoder1); // drive to goal
	armUp (goalHeight); //raise arm after cross barrier
	driveForwardSlow(encoder2);  //keep going towards goal
	driveForwardSlowDead (); //drive slow, adjust to 90 degrees
	delay(1000);
	outtake (1700);// outtake
	driveBack(encoder4); // back up
	delay(300);
	armDown(armMin); // lower arm
	driveBack(encoder5); //back up across the barrier again
	delay(300);
	turnLeft(encoder6); // turn towards center large ball
	armUp(wallHeight); // arm up to wall height
	driveForward(encoder7); // hit it off the barrier
	delay (500);
	driveBack(encoder8); // drive back
	delay(300);
	turnRight(encoder9); // turn towards other large ball
	driveForward(encoder10); // hit 2nd ball off the barrier
	delay(500);
	driveBack(encoder11); // drive back to square
	delay(600);
	turnLeft(encoder12); // turn to barf
	delay(300);
	armDown(armMin);
	intakeDead(); // pick up barf
	driveForward(encoder13); // drive towards barf + intake it
	delay(500);



	//end of routine




	stopAll () ;
	delay(60000);///////////////////////////////////////////////////////////////////////////////////


}
Esempio n. 2
0
void rushBlue ()
{


	// variables
		int armMin = 300;
		int wallHeight = 1000;
		int goalHeight = 1700;
		int pot = analogRead (8);
		int midLine = analogRead(2);


		int encoder1 = 1800; //drive under wall
		int encoder2 = 130; // rotate 90 degrees
		int encoder3 = 1400; // backwards to the opponets goal
		int encoder4 = 630; //turn to goal + enclose it


		// begin routine

		intakeDead(); // unfold
		delay(300); // needs to clear the wall..
		driveBack (encoder1); // drive backwards to under the bridge
		stopIntake();
		turnLeft (encoder2); // turn ass to opponets goal
		driveBackDead(encoder3); // drive to opponets goal
		delay(500);

		midLine = 3000;
		while (midLine > 2000)
		{
			midLine = analogRead(2);
		}

		motorSet (motor1, 10)	; // no inertia
		motorSet (motor2, 10)	;
		motorSet (motor10, 10)	;
		motorSet (motor9, 10)	;
		delay (85);


		//driveBackDead(); // push them
		//delay (300);
		stopDrive ();
		delay (7000); // wait till auto end
		driveBackDead ();// push them
		delay (800);
		stopDrive();
		delay(100);
		driveForwardDead(); // driveback towards goal
		delay(300);
		stopDrive ();
		intakeDead();
		armUp(goalHeight); //arm up
		scrapeLeft (encoder4);  //encase the goal
		driveForwardSlowDead ();
		delay(700);
		stopDrive();
		outtake (3000);

		stopAll ();


}
Esempio n. 3
0
void K3b::Md5Job::stop()
{
    emit debuggingOutput( "K3b::Md5Job", QString("Stopped manually after %1 bytes.").arg(d->readData) );
    stopAll();
    jobFinished( true );
}
Esempio n. 4
0
void K3b::Md5Job::slotUpdate()
{
    if( !d->finished ) {

        // determine bytes to read
        qint64 readSize = Private::BUFFERSIZE;
        if( d->maxSize > 0 )
            readSize = qMin( readSize, d->maxSize - d->readData );

        if( readSize <= 0 ) {
            //      qDebug() << "(K3b::Md5Job) reached max size of " << d->maxSize << ". Stopping.";
            emit debuggingOutput( "K3b::Md5Job", QString("Reached max read of %1. Stopping after %2 bytes.").arg(d->maxSize).arg(d->readData) );
            stopAll();
            emit percent( 100 );
            jobFinished(true);
        }
        else {
            int read = 0;

            //
            // read from the iso9660 file
            //
            if( d->isoFile ) {
                read = d->isoFile->read( d->readData, d->data, readSize );
            }

            //
            // read from the device
            //
            else if( d->device ) {
                //
                // when reading from a device we always read multiples of 2048 bytes.
                // Only the last sector may not be used completely.
                //
                qint64 sector = d->readData/2048;
                qint64 sectorCnt = qMax( readSize/2048, ( qint64 )1 );
                read = -1;
                if( d->device->read10( reinterpret_cast<unsigned char*>(d->data),
                                       sectorCnt*2048,
                                       sector,
                                       sectorCnt ) )
                    read = qMin( readSize, sectorCnt*2048 );
            }

            //
            // read from the file
            //
            else if( !d->ioDevice ) {
                read = d->file.read( d->data, readSize );
            }

            //
            // reading from the io device
            //
            else {
                read = d->ioDevice->read( d->data, readSize );
            }

            if( read < 0 ) {
                emit infoMessage( i18n("Error while reading from file %1", d->filename), MessageError );
                stopAll();
                jobFinished(false);
            }
            else if( read == 0 ) {
                //	qDebug() << "(K3b::Md5Job) read all data. Total size: " << d->readData << ". Stopping.";
                emit debuggingOutput( "K3b::Md5Job", QString("All data read. Stopping after %1 bytes.").arg(d->readData) );
                stopAll();
                emit percent( 100 );
                jobFinished(true);
            }
            else {
                d->readData += read;
				d->md5.addData( d->data, read );
                int progress = 0;
                if( d->isoFile || !d->filename.isEmpty() )
                    progress = (int)((double)d->readData * 100.0 / (double)d->imageSize);
                else if( d->maxSize > 0 )
                    progress = (int)((double)d->readData * 100.0 / (double)d->maxSize);

                if( progress != d->lastProgress ) {
                    d->lastProgress = progress;
                    emit percent( progress );
                }
            }
        }
    }
}
Esempio n. 5
0
void LorrisProgrammer::connDisconnecting()
{
    stopAll(false);
}
Esempio n. 6
0
void QMidiOut::stopAll()
{
	for (int i = 0; i < 16; i++)
		stopAll(i);
}