task autonomous() { // Autonomous setIntakeSpeed(127); //drop buckie ball setArmSpeed(100); wait1Msec(1000); setArmSpeed(5); driveArcade(70,0); //drive forward wait1Msec(1100); driveArcade(0,0); setIntakeSpeed(0); setArmSpeed(20); wait1Msec(1000); driveArcade(-70,0); //drive back wait1Msec(1200); driveArcade(0,0); wait1Msec(5000); driveArcade(70,0); //drive forward wait1Msec(1300); driveArcade(0,0); wait1Msec(1000); driveArcade(-70,0); //drive back wait1Msec(1300); driveArcade(0,0); }
task usercontrol() { float maxRPM = 230; // Start the flywheel control task startTask( FwControlTask ); while (true) { // Different speeds set by buttons if( vexRT[ Btn8U ] == 1 ) FwVelocitySet( .9*maxRPM, 0.80 );//Test These Numbers if( vexRT[ Btn8L ] == 1 ) FwVelocitySet( .8*maxRPM, 0.70 ); if( vexRT[ Btn8R ] == 1 ) FwVelocitySet( .7*maxRPM, 0.60 ); if( vexRT[ Btn8D ] == 1 ) FwVelocitySet( 00, 0 ); int driveX = -vexRT[Ch2]; int driveY = vexRT[Ch1] ; int intakeForward = vexRT[Btn5U]; int intakeBackwards = vexRT[Btn5D]; driveArcade(driveY * 127 / 128, driveX * 127 / 128); setIntake(intakeForward*127, intakeBackwards*127); wait1Msec(10); } }
task usercontrol() { // User control initialization while (true) { // User control loop int driveX = scaleInput(vexRT[Ch4]); int driveY = scaleInput(vexRT[Ch3]); int armSpeed = vexRT[Ch2]; int intakeSpeed = 127*((vexRT[Btn5U]|vexRT[Btn5D])-(vexRT[Btn6U]|vexRT[Btn6D])); /* string potenString, gyroString; s sprintf(potenString, "%3f%c", SensorValue[poten]); sprintf(gyroString, "%3f%c", SensorValue[gyro]); displayString(potenString, gyroString);*/ if (SensorValue[poten] > ARMAX) armSpeed = 0; // Limit the Poten from dying. driveX = turnPID.enabled ? calculate(turnPID, SensorValue[gyro]) : driveX; armSpeed = armPID.enabled ? calculate(armPID, SensorValue[poten]) : armSpeed; if (abs(driveY) < 5) driveY = 0; // Deadband if (abs(driveX) < 5) driveX = 0; driveArcade(driveY, driveX); setArmSpeed(armSpeed); setIntakeSpeed(intakeSpeed); } }
task usercontrol() { // User control code here, inside the loop while (true) { bool tankdrive = false; //enable tankdrive??? while (tankdrive==false) { int DriveX = -vexRT[Ch4]; int DriveY = vexRT[Ch3]; int liftSpeed = vexRT[Ch2]; if (abs(DriveY) < 5) DriveY = 0; // Deadband if (abs(DriveX) < 5) DriveX = 0; // Deadband if (abs(liftSpeed) < 5) liftSpeed = 5; //Deadband and Keep String Taught driveArcade(DriveY, DriveX); setLiftSpeed(liftSpeed); } while (tankdrive==true) //Tank Drive Option For Debugging DriveTrain { motor[leftRear] = motor[leftFront] = vexRT[Ch3]; motor[rightRear] = motor[rightFront] = vexRT[Ch2]; } // This is the main execution loop for the user control program. Each time through the loop // your program should update motor + servo values based on feedback from the joysticks. // ..................................................................................... // Insert user code here. This is where you use the joystick values to update your motors, etc. // ..................................................................................... } }
task usercontrol() { // User control code here, inside the loop resetDriveVariables(); armState = 0; // This is the main execution loop for the user control program. Each time through the loop // your program should update motor + servo values based on feedback from the joysticks. while (true) { driveArcade(vexRT[Ch3],vexRT[Ch4],true,true);//leave both square and ramp as false until the code is proven to work if (vexRT[Btn6U] != 0){ clawInput = 128; slowClose = false; } else if(vexRT[Btn6D] != 0){ clawInput = -63; slowClose = false; } else if(vexRT[Btn5U] != 0){ clawInput = 40; slowClose = true; } else if(vexRT[Btn5D]){ clawInput = -31; slowClose = true; } else{ clawInput = 0; slowClose = false; } armMove(vexRT[Ch2]); } }
task autonomous() { driveArcade(100, 100); wait1Msec(10000); driveArcade(0,0); }
task autonomous() { bool interaction = (SensorValue[area] == 1); //user input switch to set if interaction zone or not (isolation) bool red = (SensorValue[color] == 1); //user input switch to set if on red team or not (blue) if (interaction) //if in interaction { if (red) //if on red team { time1[T1] = 0; while(time1[T1] < 1300) //flip out rotors and intake pre-load spinMove(128); spinMove(0); time1[T1] = 0; while(time1[T1] <1500) // raise arm to high goal level armMove(100); time1[T1] = 0; while (time1[T1] < 3000) //hold up arm to allow for loading armMove(35); time1[T1] = 0; while (time1[T1] < 4500) //Drive forwards to goal, (while holding up arm) driveArcade(40,0,false,false); driveArcade(20,0,false,false); time1[T1] = 0; while (time1[T1] < 3000) //Release load and score!! (while holding up arm) spinMove(-80); armMove(0); spinMove(0); driveArcade(0,0,false,false); time1[T1]=0;//Drive home and lower arm while (time1[T1]<1650){ if(time1[T1]>500){ armMove(-45); if(SensorValue[armPot]<=armFloor+40) armMove(0); } driveArcade(-100,0,false,false); } armMove(0); driveArcade(0,0,false,false); time1[T1]=0;//wait to repostition robot for 2 seconds while(time1[T1]<2000){ } time1[T1]=0;//Drive to the wall spinMove(128);//because omnomnomnom while(time1[T1]<2000){ driveArcade(40,0,false,false); spinMove(0); time1[T1]=0;//Drive home while(time1[T1]<1000){ driveArcade(-99,0,false,false); } driveArcade(0,0,false,false); time1[T1]=0;//wait to repostition robot for 2 seconds while(time1[T1]<2000){ } while(SensorValue[armPot]<=armLowScore){ armMove(40) } armMove(0); driveArcade(0,0,false,false); } } else //if on blue team { time1[T1] = 0; while(time1[T1] < 1300) //flip out rotors and intake pre-load spinMove(128); spinMove(0); time1[T1] = 0; while(time1[T1] <1500) // raise arm to high goal level armMove(100); time1[T1] = 0; while (time1[T1] < 3000) //hold up arm to allow for loading armMove(35); time1[T1] = 0; while (time1[T1] < 4500) //Drive forwards to goal, (while holding up arm) driveArcade(40,0,false,false); driveArcade(20,0,false,false); time1[T1] = 0; while (time1[T1] < 3000) //Release load and score!! (while holding up arm) spinMove(-80); armMove(0); spinMove(0); driveArcade(0,0,false,false); time1[T1]=0;//Drive home and lower arm while (time1[T1]<1650){ if(time1[T1]>500){ armMove(-45); if(SensorValue[armPot]<=armFloor+40) armMove(0); } driveArcade(-100,0,false,false); } armMove(0); driveArcade(0,0,false,false); time1[T1]=0;//wait to repostition robot for 2 seconds while(time1[T1]<2000){ } time1[T1]=0;//Drive to the wall spinMove(128);//because omnomnomnom while(time1[T1]<2000){ driveArcade(40,0,false,false); spinMove(0); time1[T1]=0;//Drive home while(time1[T1]<1000){ driveArcade(-99,0,false,false); } driveArcade(0,0,false,false); time1[T1]=0;//wait to repostition robot for 2 seconds while(time1[T1]<2000){ } while(SensorValue[armPot]<=armLowScore){ armMove(40) } armMove(0); driveArcade(0,0,false,false); } } }
task autonomous() { { time1[T1] = 0; while(time1[T1] < 1300) //flip out rotors and intake pre-load spinMove(128); spinMove(0); time1[T1] = 0; while(time1[T1] <1500) // raise arm to high goal level armMove(100); time1[T1] = 0; while (time1[T1] < 3000) //hold up arm to allow for loading armMove(50); time1[T1] = 0; while (time1[T1] < 4500) //Drive forwards to goal, (while holding up arm) driveArcade(40,0,false,false); driveArcade(20,0,false,false); time1[T1] = 0; while (time1[T1] < 3000) //Release load and score!! (while holding up arm) spinMove(-80); // ^ lolololol armMove(0); spinMove(0); time1[T1]=0;//Drive home and lower arm while (time1[T1]<1650){ if(time1[T1]>500){ armMove(-45); if(SensorValue[armPot]<=armFloor+20) armMove(0); } driveArcade(-100,0,false,false); } armMove(0); driveArcade(0,0,false,false); time1[T1]=0;//wait to repostition robot for 4 whole seconds while(time1[T1]<4000){ } time1[T1]=0;//Drive like an old Asian lady to the doubler spinMove(128);//because omnomnomnom while(time1[T1]<5000){ driveArcade(40,0,false,false); } spinMove(0); time1[T1]=0;//Drive home while(time1[T1]<2200){ driveArcade(-99,0,false,false); } driveArcade(0,0,false,false); time1[T1]=0;//Wait for only 3 seconds while(time1[T1]<3000){ } //Do the same thing as before to put the doubler in the goal time1[T1] = 0; while(time1[T1] <1500) // raise arm to high goal level armMove(100); armMove(10); time1[T1] = 0; while (time1[T1] < 3500) //Drive forwards to goal, (while holding up arm) driveArcade(40,0,false,false); time1[T1] = 0; while (time1[T1] < 3000) //Release load and score!! (while holding up arm) spinMove(-80); armMove(0); spinMove(0); //make sure it's never the programmer's fault bool RickIsDumb=true; bool itsRicksFault=false; if(RickIsDumb){ itsRicksFault=true; } } if(false) //**************Why is this even here?***********************************************// { // time1[T1] = 0; // while(time1[T1] < 500) //push slightly forwards to fit barell into claw // { // driveArcade(32,0,false,false); // } // driveArcade(0,0,false,false); // time1[T1] = 0; // while(time1[T1] < 250) //reverse to fit barell into claw // { // driveArcade(-32,0,false,false); // } // driveArcade(0,0,false,false); // time1[T1] = 0; // while(time1[T1] < 500) //close claw // { // clawPower = 100; // armMove(0,clawPower); // } // while(sensorValue[armPot] < armHighPlace) // raise to high goal level // { // armPower = 64; // armMove(armpower,0); // } // time1[T1] = 0; // while(time1[T1] < 4000) //drive forwards to goal // { // driveArcade(32,0,false,false); // } // driveArcade(0,0,false,false); // time1[T1] = 0; // while(time1[T1] < 650) //open claw to score! // { // clawPower = -15; // armMove(0,clawPower); // } // while(sensorValue[clawPot] > clawOpen) //finish opening claw // { // clawPower = -100; // armMove(0,clawPower); // } // after first score // time1[T1] = 0; // while(time1[T1] < 4000) //drive backwards to red zone // { // driveArcade(-40,0,false,false); // } // driveArcade(0,0,false,false); // while(sensorValue[armPot] > armFloor) // lower arm to floor // { // armPower = -64; // armMove(armpower,0); // } } ///////////////////////////////////////////////////////////////////////////////////////// // // User Control Task // // This task is used to control your robot during the user control phase of a VEX Competition. // You must modify the code to add your own robot specific commands here. // ///////////////////////////////////////////////////////////////////////////////////////// }