We have an issue with our intake code. For some reason, when the intake code to run the intakes slowly back (buttons R2 and B) if we have just ran the intakes quickly (button L1 and L2) the intakes will jolt for a split second at that speed.
For example, if we just pressed L1 and ran the intakes full speed inward, and then press R2 to run them out slowly, they will jolt at 100 percent inward for a split second, then rotate out slowly like they are supposed to.
As a result, we have dropped a lot of stacks in practice. Any ideas?
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
void usercontrol(void);
// User control code here, inside the loop
while (1) {
// 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.
// ........................................................................
// int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
int armSpeedPCT = 100;
int ClawSpeedPCT = 100;
int slowClawSpeedPCT = 10;
int chuteSpeedPCT = 100;
//Create an infinite loop so that the program can pull remote control values every iteration.
//This loop causes the program to run forever.
while(1) {
//Drive Control
//Normal intake Control
if(Controller1.ButtonL1.pressing()) { //If the L1 button is pressed…
//…Spin the intake forward.
intake.spin(vex::directionType::fwd, ClawSpeedPCT, vex::velocityUnits::pct);
}
else if(Controller1.ButtonL2.pressing()) { //If the L2 button is pressed…
//…Spin the intake backward.
intake.spin(vex::directionType::rev, ClawSpeedPCT, vex::velocityUnits::pct);
}
else { //If the L1 or L2 button are not pressed…
//…Stop the intake.
intake.stop(vex::brakeType::brake);
}
//Slow intake Control
if(Controller1.ButtonR1.pressing()) { //If the R1 button is pressed…
//…Spin the intake forward.
intake.spin(vex::directionType::fwd, slowClawSpeedPCT, vex::velocityUnits::pct);
}
else if(Controller1.ButtonR2.pressing()) { //If the R2 button is pressed…
//…Spin the intake backward.
intake.spin(vex::directionType::rev, slowClawSpeedPCT, vex::velocityUnits::pct);
}
else { //If the R1 or R2 button are not pressed…
//…Stop the intake.
intake.stop(vex::brakeType::brake);
}
//Controller 2 intake Control
if (Controller2.ButtonB.pressing()) { //If the R2 button is pressed…
//…Spin the intake backward.
intake.spin(vex::directionType::rev, slowClawSpeedPCT, vex::velocityUnits::pct, Drivetrain.setDriveVelocity(10, percent),
Drivetrain.drive(rev);
}
else if ( //If the B button is not pressed…
//…Stop the intake.
intake.stop(vex::brakeType::brake);
See the thing is now that you pointed it out, I too have noticed this subtle yet consistent problem with out bot too. If anyone knows how to fix it, could they help? My code specifically just holds if not moved.
So we ended up changing the stop mode to (brake) instead of (hold) like we had been doing, and that solved the issue. Thank you to all who helped us out.
the issue is you have two intake stop functions at two different flows. when ButtonL1/2 is pressed the intake motor spins, then because the ButtonR1/2 is not pressed, the intake motor stops. The cycle goes on and on and the intake jolts.