void redUdit() { deploy(); intake(1); wait10Msec(10); moveStraight(1, 0, 475); //picks up wait10Msec(50); moveStraight(-1, 0, 475);//comes back //intake(0)(); spin(1, 0, 400); lift(BUMP); holdArm(); waitForButton(); intake(-1); wait10Msec(100); resetValues(0); liftDown(); // added // end Devansh waitForButton(); intake(1); moveStraight(1, 0, (HALF_TILE)); wait10Msec(50); pickUpBall(1); spin(-1, 0, 200); crossBump(); lift(BARRIER); holdArm(); wait10Msec(30); moveStraight(1, 0, 550); intake(-1); // end udit resetValues(1000); }
void redDevansh() // Places preload (1-2) + 2 buckies (2-4) + TURN LEFT Knocks buckies (1-6) { deploy(); intake(1); wait10Msec(10); moveStraight(1, 0, 455); //picks up wait10Msec(50); moveStraight(-1, 0, 475);//comes back intake(0); // end part 1: prepare dump waitForButton(); lift(BUMP); holdArm(); intake(-1); resetValues(1200); // end part 2: dump waitForButton(); liftDown(); wait10Msec(100); moveStraight(1, 0, 700); // end part 3: prepare hit spin(-1, 0, 200); intake(-1); lift(BUMP); holdArm(); noRamp(1, 250); resetValues(0); // end part 4: hit }
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, 475); wait10Msec(50); moveStraight(-1, 0, 475); //stopIntake(); lift(BUMP); holdArm(); waitForButton(); intake(false); wait10Msec(100); waitForButton(); resetValues(0); liftDown(); // end Devansh waitForButton(); intake(true); moveStraight(1, 0, (HALF_TILE)); wait10Msec(50); pickUpBall(1); spin(-1, 0, 200); crossBump(); lift(BARRIER); holdArm(); wait10Msec(30); moveStraight(1, 0, 550); intake(false); // end udit resetValues(1000); }
void armbotRed() { encoderReset(TOWER_ENCODER); printf("ENCODER %x reset\n\r",TOWER_ENCODER); int stackRot = 3360; int loadRot = 100; int loadHeight = 70; int loadHeightHigh = 376 +30; //30 is error int wallHeightU = loadHeightHigh; // idk int wallHeight = loadHeight; // idk int spike1 = -6; // heights for the individual spikes! int spike2 = 450; //n*(offset+ drift) //150 = 450-300 release height int spike3 = 800; int spike4 = 0; int spike5 = 0; int spike6 = 0; int pot = analogRead (8); int wall = 980; //pot value int stack = 3360; // pot value int center = (stack-wall)/2; /////////////////////////////////////spike 1////////////////////////////////////////// armUpEnc(wallHeight); turnRightSlow(wall); intake(300); //clamp it! armUpEnc(wallHeightU); // pick it up turnLeftSlow(stack); // rotate to stack armDownEnc(spike1); //score the spike! outtake(300); armUpEnc(spike1 + 500); turnRightSlow(center); // and loop!/////////////////////spike 2////////////////////////// armUpEnc(wallHeightU); turnRightSlow(wall); intake(300); //clamp it! armUpEnc(spike2 + 100); // pick it up + go abit higher than spike height! turnLeftSlow(stack); // rotate to stack delay(500); // wait for swing to stop! armDownEnc(spike1); //score the spike! outtake(300); armUpEnc(spike2 + 500); turnRightSlow(center); //end of routine stopAll () ; delay(60000);/////////////////////////////////////////////////////////////////////////////////// }
/* 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 AlexAlt() // Caches preload (5) + Knocks 2 big balls (10) { deploy(); moveStraight(1, 0, 1600); // maintenence and recalibrating needed liftTime(1,300); holdArmHigh(); moveStraight(1, 0, 650); // reaches goal //wait1Msec(1000); intake(-1); wait1Msec(500); // outtake moveStraight(-1, 0, 400); //move back away from goal...Apparently Safety is greater than move forward liftDown(); // end score bucky moveStraight(-1, 0, 1400); // now user readjust for first ball waitForButton(); lift(BARRIER); holdArm(); intake(-1); moveStraight(1, 0, 580); //estimated guess based on 10Q's values wait1Msec(300); //moveStraight(-1, 0, 550); moveStraight(-1, 0, 580); waitForButton(); moveStraight(1, 0, 950); wait1Msec(300); //moveStraight(-1, 0, 950); moveStraight(-1, 0, 950); resetValues(100); }
void Alex2() // Knocks 2 big balls (10) then caches preload { deploy(); lift(BARRIER); holdArm(); intake(-1); moveStraight(1, 0, 580); //estimated guess based on 10Q's values wait1Msec(300); //moveStraight(-1, 0, 550); moveStraight(-1, 0, 580); waitForButton(); moveStraight(1, 0, 950); wait1Msec(300); //moveStraight(-1, 0, 950); moveStraight(-1, 0, 950); resetValues(100); waitForButton(); moveStraight(1, 0, 1420); // maintenence and recalibrating needed lift(HIGH); // nearest 100 holdArmHigh(); moveStraight(1, 0, 500); // reaches goal //wait1Msec(1000); intake(-1); wait1Msec(500); // outtake moveStraight(-1, 0, 400); //move back away from goal...Apparently Safety is greater than move forward motor[LeftArm] = motor[RightArm] = -127; wait1Msec(800); motor[LeftArm] = motor[RightArm] = 0; // end score bucky moveStraight(-1, 0, 1300); // now user readjust for first ball }
void blueBrian() { moveStraight(1, 0, 1000); // estimate going 2 tiles, under bump perpendicular to barrier wait10Msec(30); // stableeeeeeeeeeeeeeeee hit ball gently? spin(-1, 0, 100); // uh... hopefully it doesn't fall out? //wait10Msec(70); 1 sec stabilization time already incorporated in spin() lift(HIGH); // uh.. holdArmHigh(); wait10Msec(70); moveStraight(1, 0, 450); wait10Msec(70); intake(-1); wait10Msec(10); // lol intake(0); moveStraight(-1, 0, 200); // lol intake(-1); // lol wait10Msec(20); intake(0); moveStraight(-1, 0, 250); resetValues(0); liftDown(); spin(1, 0, 100); moveStraight(-1, 0, 1000); waitForButton(); // end 15 pts lift(BARRIER); holdArm(); moveStraight(1, 0, 950); // end 5 pts, or 20pts total }
/* 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, 1600); // 1600 is just before goal lift(HIGH); // nearest 100 holdArm(); moveStraight(1, 0, 300); // reaches goal //wait1Msec(1000); intake(-1); wait1Msec(500); // outtake intake(0); 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(-1); moveStraight(1, 0, 550); //estimated guess based on 10Q's values wait1Msec(300); moveStraight(-1, 0, 550); waitForButton(); moveStraight(1, 0, 950); wait1Msec(300); moveStraight(-1, 0, 950); resetValues(100); }
void redUdit() { deploy(); intake(true); wait10Msec(10); moveStraight(1, 0, 475); wait10Msec(50); moveStraight(-1, 0, 475); //stopIntake(); lift(BUMP); holdArm(); waitForButton(); intake(false); wait10Msec(100); waitForButton(); resetValues(0); liftDown(); // end Devansh waitForButton(); intake(true); moveStraight(1, 0, (HALF_TILE)); wait10Msec(50); pickUpBall(1); spin(-1, 0, 200); crossBump(); lift(BARRIER); holdArm(); wait10Msec(30); moveStraight(1, 0, 550); intake(false); // end udit resetValues(1000); }
task main() { setupGyro(); resetAll(); //Stop all motors and reset all sensors //1.Preload //Pick up First Buckyball intake(127, 200); //Rotate 90 degrees spin(900, 5); wait1Msec(500); //Dump buckyball intake(-127, 1000); //Spin intake for 1 second wait1Msec(500); //2. Corner Buckys //Turn around to collect other buckyballs clearGyro(); spin(1800,5); wait1Msec(500); //Move toward buckys clearDriveEncoders(); motor[intakeMotor] = 127; sonicMove(80, 15); //Move to 15cm away from buckyball using sonar motor[intakeMotor] = 0; //3. Deposit Buckys in goal resetAll(); //Turn around 180 degrees spin(1800, 5); wait1Msec(500); //Drive to other side clearDriveEncoders(); drive(100); wait1Msec(7000); //Time based driving at the beginning to get over bump clearDriveEncoders(); sonicMove(100, 30); //Ultra-sonic takes over //Turn to face tube clearGyro(); spin(3150, 2); wait1Msec(500); //Drive to tube sonicMove(50, 15); }
void pickUpBall(int goals) { resetValues(0); intake(1); wait10Msec(30); int current = 0; while(current < goals * 250) { setLeft(25); setRight(25); current = nMotorEncoder[LeftMWheel]; } intake(0); setLeft(0); setRight(0); }
void blueUdit() { deploy(); intake(1); wait10Msec(10); moveStraight(1, 0, 475); //picks up wait10Msec(50); moveStraight(-1, 0, 475);//comes back //intake(0)(); spin(1, 0, 400); lift(BUMP); holdArm(); waitForButton(); intake(-1); wait10Msec(100); resetValues(0); liftDown(); // added waitForButton(); //liftDown(); // end Devansh //waitForButton(); intake(1); moveStraight(1, 0, (HALF_TILE)); wait10Msec(50); pickUpBall(1); spin(1, 0, 200); //crossBump(); lift(BUMP); nMotorEncoder[LeftMWheel] = 0; if(true) { setRight(127); wait10Msec(10); setLeft(127); } while (abs(nMotorEncoder[LeftMWheel]) < 500) { setRight(127); setLeft(127); } setRight(0); setLeft(0); lift(BARRIER); holdArm(); wait10Msec(30); moveStraight(1, 0, 550); intake(-1); // end udit resetValues(1000); }
void skills() { deploy(); wait10Msec(20); intakeSlow(1); moveStraight(1, 0, 430); //picks up wait10Msec(50); moveStraight(-1, 0, 430);//comes back intake(1); lift(BUMP - 50); holdArm(); moveStraight(-1,0,700);//hops bump waitForButton(); liftDown(); intake(0); waitForButton(); moveStraight(1, 0, 1400); // maintenence and recalibrating needed wait10Msec(30); lift(HIGH); holdArmHigh(); moveStraight(1, 0, 430); // reaches goal //wait1Msec(1000); intake(-1); wait10Msec(150); // outtake moveStraight(-1, 0, 400); //move back away from goal...Apparently Safety is greater than move forward lift(LOW); wait10Msec(50); intake(0); // end score bucky moveStraight(-1, 0, 1400); // now user readjust for first ball waitForButton(); moveStraight(1,0,600); spin(1,0,200); lift(BARRIER); holdArmHigh(); moveStraight(1, 0, 475); wait10Msec(40); moveStraight(-1, 0, 275); }
task autonomous() { //Old Auton, Keep Until new one is Proven /* drive(127); wait1Msec(7000);//Test this motor[shooterL] = motor[shooterR] = 127; drive(0); wait1Msec(3000); motor[shooterL] = motor[shooterR] = 0; drive(0); */ //Adujust Times Below int speeder = 73; //Ball One shoot(speeder); wait1Msec(2000); intake(127); wait1Msec(400); intake(0); wait1Msec(750); //Ball Two shoot(speeder); wait1Msec(1000); intake(127); wait1Msec(650); intake(0); wait1Msec(750); //Ball Three shoot(speeder); wait1Msec(1000); intake(127); wait1Msec(650); intake(0); wait1Msec(750); //Ball Four shoot(speeder); wait1Msec(1000); intake(127); wait1Msec(650); intake(0); wait1Msec(750); //All Stop stopAll(); }
void IntakeModule::intake(double power, bool opposite) { if(!m_Enabled) return; if(opposite) { m_Motor_1->Set(power * .5 * 2); m_Motor_2->Set(power * .5 * 2); } else intake(power); }
task usercontrol() { startTask(pid); clearDebugStream(); while (true) { //++++++++++++++++++++Shooter++++++++++++++++++++ if (vexRT[Btn5DXmtr2]){ if (vexRT[Btn8UXmtr2]) targetRPM = full; else if (vexRT[Btn8LXmtr2])targetRPM = skills; else if (vexRT[Btn8RXmtr2])targetRPM = half; else if (vexRT[Btn8DXmtr2])targetRPM = close; } else targetRPM = 0; if (vexRT[Btn6DXmtr2]) targetRPM = 0; //pid overwrite if (vexRT[Btn6UXmtr2]) shooter(vexRT[Ch2Xmtr2]); //------------------End Shooter------------------ //+++++++++++++++++++++Drive+++++++++++++++++++++ if (vexRT[Btn5U]) drive(vexRT[Ch2]/2+vexRT[Ch1]/2,vexRT[Ch2]/2-vexRT[Ch1]/2); else if (vexRT[Btn5D]) drive(vexRT[Ch2]/4+vexRT[Ch1]/4,vexRT[Ch2]/4-vexRT[Ch1]/4); else drive(vexRT[Ch2]+vexRT[Ch1], vexRT[Ch2]-vexRT[Ch1]); /*tank drive runLeft(vexRT[Ch3]); runRight(vexRT[Ch2]); */ //--------------------End Drive-------------------- //++++++++++++++++++++++Intake++++++++++++++++++++++ if (vexRT[Btn6U]) intake(127); else if (vexRT[Btn6D]) intake(-127); else intake(0); //--------------------End Intake-------------------- //++++++++++++++++++++Solenoids+++++++++++++++++++++ //------------------End Solenoids------------------ }//while }//task
task usercontrol(){ // User control code here, inside the loop while (true){ driveControl();//joystick controls intake(); //intake control armMotor(); // arm control highGoal(); // macro control for highGoal } }
void TeleopInit() { while(IsOperatorControl()) { intake(); shoot(); } }
void resetAll(){ //Stops all motors and resets all sensors drive(0); intake(0,0); arm(0,0); slide(0,0); wait1Msec(400); clearDriveEncoders(); clearSlideEncoder(); SensorValue[in6] = 0; }
void Udit() { deploy(); intake(true); moveStraight(1, 0, 150); wait10Msec(30); moveStraight(-1, 0, 150); lift(BUMP); moveStraight(-1, 0, 150); setRight(127); setLeft(127); }
void redUdit() { deploy(); wait10Msec(20); moveStraight(1, 0, 450); //picks up wait10Msec(50); moveStraight(-1, 0, 450);//comes back intake(0); waitForButton(); moveStraight(1, 0, (610)); spin(-1,0, 240); moveStraight(1, 0, (575)); lift(BARRIER - 300); holdArm(); intake(-1); wait10Msec(130); liftDown(); intake(0); }
void redDevansh() // Places preload (1-2) + 2 buckies (2-4) + TURN LEFT Knocks buckies (1-6) + Places two Balls (2) { deploy(); intake(1); wait10Msec(10); moveStraight(1, 0, 150); // 200 estimated based on 10Q values wait10Msec(50); moveStraight(-1, 0, 150); intake(0); waitForButton(); lift(BUMP); holdArm(); intake(-1); waitForButton(); resetValues(0); liftDown(); wait10Msec(20); intake(1); moveStraight(1, 0, (TILE + HALF_TILE)); // theory wait10Msec(50); // intake ball hopefully lift(BUMP); holdArm(); intake(0); spin(0, -1, RIGHT_ANGLE); // RED SIDE TURN LEFT knocks buckies hopefully wait10Msec(30); intake(-1); // outtake ball hopefully wait10Msec(300); intake(0); spin(0, 1, RIGHT_ANGLE); liftDown(); intake(1); moveStraight(1, 0, (TILE + HALF_TILE)); // theory lift(BUMP); holdArm(); intake(0); spin(0, -1, RIGHT_ANGLE); // RED SIDE TURN LEFT wait10Msec(30); intake(-1); resetValues(10); }
void normAuto(){ startTask(pid); //start pid targetRPM = autoTargetRPM; runLeft(123); runRight(110); //move forward a little wait1Msec(moveTime); moveStright(0); //stop moving moveStright(-50); wait1Msec(200); moveStright(0); wait1Msec(500); while (true){ while(currentRPM < close){} //wait for shooter to get up to speed intake(127); //run intake wait1Msec(intakeTime); //wait for a second intake(0); //stop intake } }
task main(){ while (true){ getJoystickSettings(joystick); yolodrive( threshold(joystick.joy1_y1), threshold(joystick.joy1_y2), threshold(joystick.joy1_x1), threshold(joystick.joy1_x2)); lift(); tongue(); intake(); gate(); knocker(); } }
/* User Control */ task usercontrol() { initMotor(&motorLeftShooter, leftShooter1, leftShooter2, leftShooterSensor); initMotor(&motorRightShooter, rightShooter1, rightShooter2, rightShooterSensor); clearAll(actOnSensors); clearTimer(T1); clearTimer(T2); while(true) { drive(); intake(); shooter(&motorLeftShooter, &motorRightShooter); velocidade_motor_esquerdo=motorLeftShooter.speedRead; potencia_motor_esquerdo=motorLeftShooter.controller_output; velocidade_motor_direito=motorRightShooter.speedRead; potencia_motor_direito=motorRightShooter.controller_output; } }
task main() { clearTimer(T1); while(true) { drive(); intake(); shooter(); timenow = time1[T1]; if(timenow>=30){ encoderr = SensorValue[rightShooterSensor]; speedReadr = abs((1000.0*(encoderr - lastr))/timenow); //that is not a unit. You should multiply for a constant. I will leave this way by now. lastr = encoderr; checktime=timenow; clearTimer(T1); } } }
task main() { while(true) { if(VexRT(Btn5U)) { leftTurn(1); wait10Msec(100); } if(VexRT(Btn6U)) { rightTurn(1); wait10Msec(100); } if(VexRT(Btn8U)) { move(2); wait10Msec(100); } if(VexRT(Btn8D)) { move(-2); wait10Msec(100); } if(VexRT(Btn7U)) { rightTurn(360); } if(vexRT(Btn8R)) { rightTurn(2); move(20); leftTurn(10); move(30); intake(true); fly(3); wait10Msec(1000); rest(); } } }
void RedSai() //potential 20pt auton { deploy(); // go for second ball knockdown moveStraight(1, 0, 950); wait1Msec(300); moveStraight(-1, 0, 950); resetValues(100); waitForButton(); moveStraight(1,0,1500); //move forward spin(-1,0,180); // turn towards the cache lift(HIGH); // nearest 100 holdArmHigh(); moveStraight(1, 0, 650); // reaches goal intake(-1); wait1Msec(1000); // outtake }
//---------------------------------------------------------------------------------- //std::vector<EnumConclusion> Simulation::execute() void Simulation::execute(MeasurementsTable& table, std::vector<EnumConclusion>& conclusions) { checkPopSize("void Simulation::execute() - #1"); std::cout << "Start of simulation, running time (timesteps): " << mMaxTime << std::endl; std::cout << "Starting population size: " << SoilMiteBase::getPopSize() << std::endl; mErrorCode = EcNoError; for(unsigned int time=0; time<mMaxTime && mErrorCode==EcNoError; ++time) { changeEnvironment(time,table); intake(table); reproduction(table); mortality(); measurePopulation(table); if (mOptionsFileParameters.showYearSummary==true) table.showYearHorizontal(time); } checkPopSize("void Simulation::execute() - #2"); mpFunctions->coutAll(); std::cout << "Body size adult: " << SoilMiteBase::getBodySizeAdult() << std::endl; //Some conclusions if (mOffspringProduced==false) conclusions.push_back(CcNoOffspringProduced); switch(mErrorCode) { case EcNoError: conclusions.push_back(CcNoError); break; case EcPopExtinct: conclusions.push_back(CcPopExtinct); break; case EcPopSizeTooBig: conclusions.push_back(CcPopSizeTooBig); break; case EcNoffspringTooBigSingleParent: conclusions.push_back(CcNoffspringTooBigSingleParent); break; case EcNoffspringTooBigAllParents: conclusions.push_back(CcNoffspringTooBigAllParents); break; } }