VCS Autonomous Issues

Before I begin, I’d like to state that I fully understand that VEXCode has been released and is what I should probably be using. I tried it and didn’t really like it, so I stuck with VCS. Now on to the main issue…I was attempting to upgrade my auton today by adding about 20-30 new commands and then going through and running the program and adjusting the values. I got to a point where it almost fully worked…I did some final adjustments and ran it again. It stopped about 2/3 through the auton code. I restarted the bot and tried a few more times with the same result. I’m guessing I left something wrong when I adjusted the values that last time, but I’ve reviewed the code and can’t seem to find it. Here’s my code for reference and I commented to show where it stopped. If anyone can find my mistake…thank you in adavance!

Lift1.startRotateFor(500,rotationUnits::deg,50,velocityUnits::pct);
Lift2.rotateFor(500,rotationUnits::deg,50,velocityUnits::pct);
    FRDrive.startRotateFor(400,rotationUnits::deg,50,velocityUnits::pct);
    BRDrive.startRotateFor(400,rotationUnits::deg,50,velocityUnits::pct);
    FLDrive.startRotateFor(400,rotationUnits::deg,50,velocityUnits::pct);
    BLDrive.rotateFor(400,rotationUnits::deg,50,velocityUnits::pct);
        Intake.startRotateFor(-500,rotationUnits::deg,80,velocityUnits::pct);
        Intake2.startRotateFor(500,rotationUnits::deg,80,velocityUnits::pct);
        vex::task::sleep(10);
        vex::task::sleep(1000);
            FRDrive.startRotateFor(-500,rotationUnits::deg,50,velocityUnits::pct);
            BRDrive.startRotateFor(-500,rotationUnits::deg,50,velocityUnits::pct);
            FLDrive.startRotateFor(-500,rotationUnits::deg,50,velocityUnits::pct);
            BLDrive.rotateFor(-500,rotationUnits::deg,50,velocityUnits::pct);
            vex::task::sleep(1000);
                FRDrive.startRotateFor(-650,rotationUnits::deg,50,velocityUnits::pct);
                BRDrive.rotateFor(-650,rotationUnits::deg,50,velocityUnits::pct);
                vex::task::sleep(1500);
                FRDrive.startRotateFor(300,rotationUnits::deg,50,velocityUnits::pct);
                BRDrive.startRotateFor(300,rotationUnits::deg,50,velocityUnits::pct);
                FLDrive.startRotateFor(300,rotationUnits::deg,50,velocityUnits::pct);
                BLDrive.rotateFor(300,rotationUnits::deg,50,velocityUnits::pct);
                FRDrive.startRotateFor(100,rotationUnits::deg,30,velocityUnits::pct);
                BRDrive.startRotateFor(100,rotationUnits::deg,30,velocityUnits::pct);
                FLDrive.startRotateFor(100,rotationUnits::deg,30,velocityUnits::pct);
                BLDrive.startRotateFor(100,rotationUnits::deg,30,velocityUnits::pct);
                    Intake.startRotateFor(800,rotationUnits::deg,100,velocityUnits::pct);
                    Intake2.startRotateFor(-800,rotationUnits::deg,100,velocityUnits::pct);
                        Lift1.startRotateFor(-600,rotationUnits::deg,50,velocityUnits::pct);
                        Lift2.rotateFor(-600,rotationUnits::deg,50,velocityUnits::pct);
  \\nothing below here ran
                            Lift1.startRotateFor(500,rotationUnits::deg,50,velocityUnits::pct);
                            Lift2.rotateFor(500,rotationUnits::deg,50,velocityUnits::pct);
                                        FRDrive.startRotateFor(-650,rotationUnits::deg,50,velocityUnits::pct);
                                        BRDrive.rotateFor(-650,rotationUnits::deg,50,velocityUnits::pct);
                                            FRDrive.startRotateFor(300,rotationUnits::deg,50,velocityUnits::pct);
                                            BRDrive.startRotateFor(300,rotationUnits::deg,50,velocityUnits::pct);
                                            FLDrive.startRotateFor(300,rotationUnits::deg,50,velocityUnits::pct);
                                            BLDrive.rotateFor(300,rotationUnits::deg,50,velocityUnits::pct);
                                                Lift1.startRotateFor(1200,rotationUnits::deg,50,velocityUnits::pct);
                                                Lift2.rotateFor(1200,rotationUnits::deg,50,velocityUnits::pct);
                                                    FRDrive.startRotateFor(400,rotationUnits::deg,50,velocityUnits::pct);
                                                    BRDrive.startRotateFor(400,rotationUnits::deg,50,velocityUnits::pct);
                                                    FLDrive.startRotateFor(400,rotationUnits::deg,50,velocityUnits::pct);
                                                    BLDrive.rotateFor(400,rotationUnits::deg,50,velocityUnits::pct);
                                                        Intake.startRotateFor(-1500,rotationUnits::deg,50,velocityUnits::pct);
                                                        Intake2.startRotateFor(1500,rotationUnits::deg,50,velocityUnits::pct);
                                                            task::sleep(15000);
1 Like

Have you checked the error bar at the bottom?

So that i can check the code accurately, what’s the difference between startRotateFor and rotateFor?

RotateFor is blocking, the code stops until the command is completed.
startRotateFor does not block

1 Like

Nothing looks wrong to me but then again I don’t use VCS. I think it’s just a VCS issue but I could be wrong.

VCS and vexcode function almost exactly the same. My suggestion to the OP would be to comment out a couple lines if code at a time until it functions all the way through

1 Like

@Dimension_360 No errors or anything unordinary in the console.
@Deicer Ok, I’ll try that at next practice.

OK, new development. After a bit more extensive testing and adjustment…I believe it may be something in the controller because if i turn everything on and run…1st time works, second time stops 1/2way through, 3rd time works, 4th time stops 1/2way through. But if I wait 2-5 minutes after the first run leaving everything on, it works again. We just got a competition switch so i’m going to try that out, but if that doesn’t work i don’t know where to turn. All firmware is up to date, and i have tried resetting the controller.

something tells me that it has to do with rotateFor, if your lift is at its max, the code will seem to stop as the motor tries to break your lift to rotate as much as you told it to. Maybe try using rotateTo instead.

I’m guessing you are manually resetting your robot when you first turn on your controller but then maybe the lift never actually gets back to that original state.

1 Like

Like if the lift bottoms out and then cannot continue…so it blocks the rest of the code?

Yes thats right. If you want to make the lift or something go all the way up or down you can try this instead of rotateFor.

lift.spin();
wait(150,msec):
while(fabs(lift.velocity(percent))>1){
        wait(20,msec);
}
lift.stop();

This will make the motor spin until it can’t spin anymore and will stop

2 Likes

UGH…I never though of the lift! I looked at the chain intake at that it wasn’t catching, but it might be the lift going all the way down and them because it never completes all its rotation the code doesnt move on. Thats probably it.

I’ll check into that after school today, as my robot is at home.