void autonomous() { int encoder1 = digitalRead (1); int limit2 = digitalRead (2); intakeDead(); //turnRightDead(); //delay (500); driveForwardDead(); delay (1000); stopIntake(); driveBackDead(); delay (2000); turnRight(500); outtakeDead (3000); if (encoder1 < 300 ) // bottom is activated { stopIntake(); driveBackDead(); delay (2000); turnRight(500); outtakeDead (1000); } else stopIntake(); driveBackDead(); delay (2000); stopAll(20000); //rushBlue (); //allLine (99999); // all jumper comands here: }
void rejectionRed() { // variables int armMin = 300; int wallHeight = 1000; int goalHeight = 1550; int pot = analogRead (8); int encoder1 = 1200; //drive under wall int encoder2 = 136; // rotate 90 degrees int encoder3 = 900; // backwards to the opponets goal int encoder4 = 150; //rotate 90 int encoder5 = 200; // ass towards bridge // begin routine intakeDead(); // unfold delay(300); // needs to clear the wall.. driveBack (encoder1); // drive backwards to under the bridge stopIntake(); turnRight (encoder2); // turn ass to opponets goal driveBack (encoder3); // drive to opponets goal turnRight (encoder4); // ass to bridge armUp(wallHeight);// arm up driveBack(encoder5); // block their launch stopAll (); }
/* Psuedocode Ramp Forward -> [Cross Barrier] -> Raise Arm HIGH -> Hold Arm HIGH -> Ramp Zero -> [Reach Goal] -> Outtake -> [Finish Outtake] -> Stop Intake -> Ramp Forward -> Ramp Zero -> [Reach Barrier] -> Lower Arm LOW -> Ramp Backward -> [Reach Square] -> Hard Zero Wait Until Press -> Raise Arm BARRIER -> Hold Arm BARRIER -> Ramp Forward -> Ramp Zero -> [Reach Barrier] -> Ramp Backward -> [Reach Square] -> Hard Zero -> Wait Until Press -> Ramp Forward -> Ramp Zero -> [Reach Barrier] */ void Alex() // Caches preload (5) + Knocks 2 big balls (10) { deploy(); moveStraight(1, 0, 1550); // 1600 is just before goal...changed for some reason lift(HIGH); // only accurate to the nearest 100... may need to adjust HIGH value holdArm(); moveStraight(1, 0, 300); // reaches goal //wait1Msec(1000); intake(false); wait1Msec(1000); // outtake stopIntake(); moveStraight(-1, 0, 400); // move back away from goal...Apparently Safety is greater than move forward liftDown(); moveStraight(-1, 0, 1500); waitForButton(); lift(BARRIER); holdArm(); intake(false); moveStraight(1, 0, 550); // estimated guess based on 10Q's values - WORKS wait1Msec(300); moveStraight(-1, 0, 550); waitForButton(); moveStraight(1, 0, 950); // A bit of trouble... Not sure if you want to spin rollers for this hit... wait1Msec(300); // outtaking pushes the ball away + needs good aiming moveStraight(-1, 0, 950); resetValues(100); }
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(MOTOR_DRIVE_RIGHT_BACK, 10); // no inertia motorSet(MOTOR_DRIVE_RIGHT_FRONT, 10); motorSet(MOTOR_ARM_LEFT_BACK, 10); motorSet(MOTOR_ARM_LEFT_FRONT, 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(); }
void kakitRed () { // variables int armMin = 300; int wallHeight = 1000; int goalHeight = 1550; int dead1 = 1000; int dead2 = 2000; int dead3 = 3000; int pot = analogRead (8); int encoder1 = 1000; int encoder2 = 150; int encoder3 = 2000; int encoder4 = 75; int encoder5 = 75; int encoder6 = 75; int encoder7 = 75; int encoder8 = 75; int encoder9 = 75; // begin routine driveForwardDead (); //ram big balls intakeDead (); delay (3000); stopIntake(); driveBackDead (4000); // wall align to 90 deg driveForward (encoder1); turnRight (encoder2); // turn towards buckys intakeDead (); //line follow forward (encoder 4) driveBackSlowDead (); // allign the bump driveBackDead(); // over the bump driveForwardSlowDead(); // alighn to bump driveBackSlow(encoder4); turnRight (encoder5); driveBackSlow (encoder6) ; // go under the bridge armUpDead (); // break the bridge delay(500); armDown (armMin); driveBack (encoder7); turnRight (encoder8); armUp (goalHeight); //line follow (encoder9); outtake(8000); // score all three balls in the goal stopAll (); }
void redDevansh() // Places preload (1-2) + 2 buckies (2-4) + TURN LEFT Knocks buckies (1-6) + Places two Balls (2) { deploy(); intake(true); wait10Msec(10); moveStraight(1, 0, 150); // 200 estimated based on 10Q values wait10Msec(50); moveStraight(-1, 0, 150); stopIntake(); waitForButton(); lift(BUMP); holdArm(); intake(false); waitForButton(); resetValues(0); liftDown(); wait10Msec(20); intake(true); moveStraight(1, 0, (TILE + HALF_TILE)); // theory wait10Msec(50); // intake ball hopefully lift(BUMP); holdArm(); stopIntake(); spin(0, -1, RIGHT_ANGLE); // RED SIDE TURN LEFT knocks buckies hopefully wait10Msec(30); intake(false); // outtake ball hopefully wait10Msec(300); stopIntake(); spin(0, 1, RIGHT_ANGLE); liftDown(); intake(true); moveStraight(1, 0, (TILE + HALF_TILE)); // theory lift(BUMP); holdArm(); stopIntake(); spin(0, -1, RIGHT_ANGLE); // RED SIDE TURN LEFT wait10Msec(30); intake(false); resetValues(10); }
void ram() { intakeDead(); // unfold driveForwardDead(); delay(5000); stopDrive(); stopIntake(); stopAll(); }
void pickUpBall(int goals) { resetValues(0); intake(true); wait10Msec(30); int current = 0; while(current < goals * 250) { setLeft(25); setRight(25); current = nMotorEncoder[LeftMWheel]; } stopIntake(); setLeft(0); setRight(0); }
void worldsBlue () { // variables int armMin = 300; int wallHeight = 100; int goalHeight = 1550; int dead1 = 1000; int dead2 = 2000; int dead3 = 3000; int pot = analogRead (8); int encoder1 = 1500; //drive under wall int encoder2 = 136; // rotate 90 degrees int encoder3 = 900; // backwards to the opponets goal int encoder4 = 400; //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 driveBack (encoder3); // drive to opponets goal driveBackDead(); // push them delay (200); stopDrive (); delay (7000); // wait till auto end driveBackDead ();// push them delay (600); stopDrive(); delay(100); driveForwardDead(); // driveback towards goal delay(400); stopDrive (); armUp(goalHeight); //arm up scrapeLeft (encoder4); //encase the goal outtake (300); stopAll (); }
void reverse15Red() { // variables int armMin = 300; int wallHeight = 1000; int goalHeight = 1550; int pot = analogRead (8); int encoder1 = 1200; //drive under wall int encoder2 = 136; // rotate 90 degrees int encoder3 = 1300; // backwards to the opponets goal int encoder4 = 900; //turn to bridge int encoder5 = 200; // knock their wallball int encoder6 = 200; // turn to other ball int encoder7 = 400; // knock their center ball int encoder8 = 400; // positioning // begin routine intakeDead(); // unfold delay(300); // needs to clear the wall.. driveBack (encoder1); // drive backwards to under the bridge stopIntake(); turnRight (encoder2); // turn ass to opponets goal driveBack (encoder3); // drive to opponets goal driveBackDead(); // 90 deg align delay(400); stopDrive (); armUp(wallHeight);// arm up scrapeLeft (encoder4); // turn to wall ball driveForward (encoder5); // knock off wall ball scrapeLeftBack(encoder6); // turn to middle ball driveForward(encoder7); // knock off middle ball driveBack (encoder8); // positioning stopAll (); }
void intakeControl() { // Intake for 1 controller. if(vexRT[Btn5D] == 1 && vexRT[Btn5U] == 0) { // Intake roller inward. motor[intakeTread] = currentIntakeSpeed; motor[intakeWheel] = currentIntakeSpeed; } else if(vexRT[Btn5D] == 0 && vexRT[Btn5U] == 1) { // Intake roller outward. motor[intakeTread] = -currentIntakeSpeed; motor[intakeWheel] = -currentIntakeSpeed; } else { // Stop intake roller movement. stopIntake(); } }
void rejectionBlueSkills() { // 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 = 270; //turn to center of large balls int encoder5 = 200; //hit 1st blue ball off int encoder55 = 300; // back a bit int encoder6 = 450; //hit 2nd ball off int encoder7 = 450; // drive back past line int encoder8 = 160; // turn to line // 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(MOTOR_DRIVE_RIGHT_BACK, 10); // no inertia motorSet(MOTOR_DRIVE_RIGHT_FRONT, 10); motorSet(MOTOR_ARM_LEFT_BACK, 10); motorSet(MOTOR_ARM_LEFT_FRONT, 10); delay(85); armUp(wallHeight); // arm up turnRight(encoder4); // turn towards center of large balls driveForwardSlowDead(); // go between large balls delay(1200); stopDrive(); delay(300); turnLeft(encoder5); //hit center ball driveBackSlow(encoder55); turnRight(encoder6); // hit far ball driveBackSlow(encoder7); // back up past line turnRight(encoder8); // tun to line armUp(goalHeight); findLineLeft(); //followLine(300); driveForwardDead(); // drive to goal delay(700); stopDrive(); outtake(3000); stopAll(); delay(60000); }
void kakitRed() { // variables int armMin = 300; int wallHeight = 1000; int goalHeight = 1650; int pot = analogRead(8); int encoder00 = 250; // back up abit to row int encoder0 = 950; // turn 360 degrees, knock off buckys, face line int encoder1 = 162; // rotate towards 2 buckys int encoder2 = 150; // drive towards buckys int encoder3 = 400; // back up to bump int encoder4 = 200; // back up towards bridge int encoder5 = 360; // rotate 180 degrees to the large ball int encoder6 = 900; // go under bridge and knock out large ball int encoder7 = 90; // turn to goal int encoder8 = 200; // drive to goal int encoder9 = 75; // begin routine intake(300); armDownTrim(); driveForwardDead(); //ram big balls delay(1500); stopDrive(); delay(500); driveBack(encoder00); // back up to row abit intakeDead(); turnLeft(encoder0); // turn 360 degrees driveBackDead(); // drive back + wall align delay(1300); stopDrive(); delay(500); turnRight(encoder1); // turn to two buckys intakeDead(); followLine(300); // make sure ur straight driveForwardSlowDead(); // drive towards buckys delay(500); stopDrive(); delay(600); driveForwardDead(); //get the 2nd ball delay(200); stopDrive(); delay(600); stopIntake(); driveBack(encoder3); // back up to bump armUpDead(); // armup delay(50); stopArm(); stopIntake(); driveBackSlowDead(); // allign the bump delay(300); stopDrive(); delay(500); driveBackDead(); // over the bump delay(1000); stopDrive(); delay(500); driveForwardSlowDead(); // alighn to bump delay(800); stopDrive(); delay(500); driveBackSlow(encoder4); // back up towards bridge turnLeft(encoder5); // rotate 180 degrees to the large ball armDown(armMin); armDownTrim(); driveForward(encoder6); // go under the bridge + knock large ball armUp(goalHeight); turnRight(encoder7); // turn to goal findLineRight(); followLine(300); driveForwardSlowDead(); // drive to goal delay(700); stopDrive(); outtake(7000); // outtake 3 stopAll(); }
void rejectionBlue() { // 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 = 100; //turn to goal + enclose it int encoder5 = 450; //hit 1st blue ball off int encoder6 = 350; // drive back int encoder7 = 175; // turn to 2nd blue ball int encoder8 = 550; // hit 2nd ball off int encoder9 = 250; // drive back to position int encoder10 = 370; // rotate to line // 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(MOTOR_DRIVE_RIGHT_BACK, 10); // no inertia motorSet(MOTOR_DRIVE_RIGHT_FRONT, 10); motorSet(MOTOR_ARM_LEFT_BACK, 10); motorSet(MOTOR_ARM_LEFT_FRONT, 10); delay(85); armUp(wallHeight); // arm up turnRight(encoder4); // turn towards center blue ball driveForward(encoder5); // hit 1st ball off delay(700); driveBack(encoder6); // back delay(700); turnRight(encoder7); // turn towards 2nd blue ball delay(700); driveForward(encoder8); // hit off 2nd blue ball delay(700); intakeDead(); driveBack(encoder9); // position delay(700); turnLeft(encoder10); // encase opponet goal delay(700); armUp(goalHeight); findLineRight(); //followLine(300); driveForwardDead(); // drive to goal delay(700); stopDrive(); outtake(3000); stopAll(); delay(60000); }
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 I.M.E imeGet(0, &counts); while (abs(counts) < encoder1) { motorSet(MOTOR_DRIVE_RIGHT_BACK, 110); // slight curve cuz friction motorSet(MOTOR_DRIVE_RIGHT_FRONT, 110); motorSet(MOTOR_ARM_LEFT_BACK, 127); motorSet(MOTOR_ARM_LEFT_FRONT, 127); imeGet(0, &counts); // keep getting the value } motorSet(MOTOR_DRIVE_RIGHT_BACK, 0); motorSet(MOTOR_DRIVE_RIGHT_FRONT, 0); motorSet(MOTOR_ARM_LEFT_BACK, 0); motorSet(MOTOR_ARM_LEFT_FRONT, 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); /////////////////////////////////////////////////////////////////////////////////// }
task autonomous() { switch(selectedAuton) { case Autonomous_LeftScoreMatchLoads: { clearEncoders(); motor[intakeTread] = -127; motor[intakeWheel] = -127; wait1Msec(700); stopIntake(); positionArm(Arm_ScoreHeight); stopArm(); wait1Msec(1000); int leftDest = SensorValue[encoder_Left] + 2200; while(SensorValue[encoder_Left] < leftDest) { driveAtSpeed(60); } stopDrive(); motor[intakeTread] = 127; motor[intakeWheel] = 127; wait10Msec(200); } break; case Autonomous_RightPickupScoreYellow: { clearEncoders(); int leftDest = SensorValue[encoder_Left] + 1850; while(SensorValue[encoder_Left] < leftDest) { driveAtSpeed(50); } stopDrive(); motor[intakeTread] = -127; motor[intakeWheel] = -127; wait1Msec(1000); stopIntake(); positionArm(Arm_ScoreHeight); int rightDest = SensorValue[encoder_Right] - 730; while(SensorValue[encoder_Right] > rightDest) { motor[driveLeftBack] = 38; motor[driveRightBack] = 0; motor[driveLeftFront] = 38; motor[driveRightFront] = 0; } leftDest = SensorValue[encoder_Left] + 650; while(SensorValue[encoder_Left] < leftDest) { motor[driveLeftBack] = 38; motor[driveRightBack] = 40; motor[driveLeftFront] = 38; motor[driveRightFront] = 40; } stopDrive(); motor[intakeTread] = 127; motor[intakeWheel] = 127; wait1Msec(1500); stopIntake(); } break; case Autonomous_ProgrammingSkills: { clearEncoders(); int leftDest = SensorValue[encoder_Left] + 1850; while(SensorValue[encoder_Left] < leftDest) { driveAtSpeed(50); } stopDrive(); motor[intakeTread] = -127; motor[intakeWheel] = -127; wait1Msec(1000); stopIntake(); positionArm(Arm_ScoreHeight); int rightDest = SensorValue[encoder_Right] - 730; while(SensorValue[encoder_Right] > rightDest) { motor[driveLeftBack] = 38; motor[driveRightBack] = 0; motor[driveLeftFront] = 38; motor[driveRightFront] = 0; } leftDest = SensorValue[encoder_Left] + 650; while(SensorValue[encoder_Left] < leftDest) { driveAtSpeed(40); } stopDrive(); motor[intakeTread] = 127; motor[intakeWheel] = 127; wait1Msec(500); stopIntake(); leftDest = SensorValue[encoder_Left] - 390; while(SensorValue[encoder_Left] > leftDest) { driveAtSpeed(-30); } stopDrive(); positionArm(990); stopArm(); rightDest = SensorValue[encoder_Right] + 660; while(SensorValue[encoder_Right] < rightDest) { motor[driveLeftBack] = -30; motor[driveLeftFront] = -30; } stopDrive(); leftDest = SensorValue[encoder_Left] - 2050; while(SensorValue[encoder_Left] > leftDest) { driveAtSpeed(-50); } stopDrive(); } break; case Autonomous_None: default: { } break; } }
void classic15Red() { int armMin = 300; int wallHeight = 1000; int goalHeight = 1550; int dead1 = 1000; int dead2 = 2000; int dead3 = 3000; int pot = analogRead (8); //encoder values int encoder1 = 1125; //drive to goal int encoder2 = 325; //keep going towards goal int encoder3 = 0; //drive slow, adjust to 90 degrees int encoder4 = 275; //back up int encoder5 = 800; //back up across the barrier again int encoder6 = 90; // turn towards center large ball int encoder7 = 220; // hit it off the barrier int encoder8 = 350; // drive back int encoder9 = 110; // turn towards other large ball int encoder10 = 681; // hit it off the barrier int encoder11 = 300; // drive back to square int encoder12 = 150; // ass to wall int encoder13 = 800; int encoder14 = 400; int encoder15 = 700; int encoder16 = 400; int encoder17 = 100; int encoder18 = 400; int encoder19 = 700; int encoder20 = 400; int encoder21 = 100; int encoder22 = 400; int encoder23 = 700; // begin routine intakeDead(); delay(1000); stopIntake(); driveForward(encoder1); // drive to goal armUp (goalHeight); //raise arm after cross barrier driveForwardSlow(encoder2); //keep going towards goal driveForwardSlowDead (dead1); //drive slow, adjust to 90 degrees outtake (1500); driveBack(encoder4); // back up armDown(armMin); // lower arm driveBack(encoder5); //back up across the barrier again turnRight(encoder6); // turn towards center large ball armUp(wallHeight); // arm up to wall height driveForward(encoder7); // hit it off the barrier driveBack(encoder8); // drive back turnLeft(encoder9); // turn towards other large ball driveForward(encoder10); // hit it off the barrier driveBackSlowDead (dead2); // drive back to square turnLeftArc (encoder12); // ass to wall driveBackSlowDead (dead2) ; // wall align 90degrees armDown (armMin); // arm down to floor intakeDead (); // start intaking driveForwardSlow (encoder13) ;// drive towards barf and intake whatever turnRightArc (encoder14); // rotate towards the barrier stopIntake(); armUp(wallHeight); // arm up to wall height driveForwardSlow (encoder15); // drive to barrier stopDrive(); // stop at barrier outtake (1500); //drop the barf driveBackSlowDead(dead2); //hump da bump armDown (armMin); // arm down to floor intakeDead (); //start intaking turnLeftArc (encoder16); //face the barf driveForwardSlow (encoder17) ;// drive towards barf and intake whatever turnRightArc (encoder18) ; // rotate towards the barrier stopIntake(); armUp(wallHeight); // arm up to wall height driveForwardSlow (encoder19); // drive to barrier stopDrive(); // stop at barrier outtake (1500); //drop the barf driveBackSlowDead(dead2); //drive to and align on bump armDown (armMin); // arm down to floor intakeDead (); //start intaking turnLeftArc (encoder20); //face the barf driveForwardSlow (encoder21) ;// drive towards barf and intake whatever turnRightArc (encoder22) ; // rotate towards the barrier stopIntake(); armUp(wallHeight); // arm up to wall height driveForwardSlow (encoder23); // drive to barrier outtake (1500); //drop the barf //end of routine stopAll () ; delay(60000);/////////////////////////////////////////////////////////////////////////////////// }
void deploy() { intake(true); wait1Msec(300); stopIntake(); }