startRotateTo VCS not working

I am trying to use the startRotateTo/For command, and have also tried just using rotateTo/For with false added to the end of the line, so that I can have a more instantaneous shot with my puncher, with it rotating in such a way that when I press a button, the puncher has already been pulled back, and the shot is instantaneous. The part that I need help with is commented out in the picture below, and I displayed both ways that I have tried to do this with the two different commands. When I try to use what is currently commented out, I have no control over the motor while using this button, however I am able to drive while holding down the button. Just an FYI, I have tried that if statement as just a rotateTo/rotateFor and it does work as intended, however the “waitForCompletion” option is set to true, which means that I can’t drive and “reload” at the same time. I am trying to do this for my lift as well, however I am having the same issue where I can’t move the motor with the startRotateTo enabled. Thanks in advance


There is no way to do this without adding a custom task for pullback, and running during driver.

Here is our pull task, for our puncher, based on torque. You could also use a light sensor. Basing it on rotation is tough because of the slipgear being rotated, but it can be done.

    while(1) {
        if(!pulled && !punching && !Controller1.ButtonA.pressing()){
            pulling = true;
            Puncher.spin(directionType::fwd, 100, velocityUnits::pct);
            while(Puncher.torque(torqueUnits::Nm) < 0.75);
            pulled = true;
            pulling = false;

Here is how we then call it in driver, and use it with the controls:

        vex::task t(pulltask);

             punching = true;
             Puncher.spin(directionType::fwd,100, velocityUnits::pct);
             lastpress = true;
        else if(!Controller1.ButtonA.pressing() && lastpress){
            pulled = false;
            punching = false;
            lastpress = false;

Okay I’ve been trying my best to interpret what you meant with your code. Can you please explain a little bit more about where the first and second parts of code that you attached are supposed to go, in terms of the main while loop, user task, outside of user task, etc, why there is a “return(0)” , and what the purpose of the “vex::task t(pulltask)” is, and where it is supposed to be. Sorry, I’m still getting the hang of this

The actual task goes outside of everything, in no functions(driver, auton, etc.) The rest goes in driver. vex::task t(pullTask) starts the task. To be completely honest I don’t know why it is a return type int, and returns zero, but it doesn’t work any other way.

So what should I have before the task?
Something like:

int pulltask()
“the first set of code you sent with the while”

Okay I think I was able to make it work. Thanks for your help all over the forum. You’re awesome @jack202020

bool neverPrimed = true;
while(true) {
    //other stuff
    if (neverPrimed && button.pressing()) {
        neverPrimed = false;
        motor.startRotateTo( etc );
    } else if (button.pressing() && !motor.isSpinning()) {
        motor.startRotateFor( etc );

Should be all you need. The trick is the check for isSpinning so startRotateFor won’t be called if a startRotateFor is already in progress. This will have the motor rotateTo the primed position on the first press, and pressing it again or holding it down through that motion completing will trigger the startRotateFor.

So with this, the “priming” of the puncher in the if statement will not allow for other tasks to execute until it has been primed, but since this only happens once, the very first shot of the match, it wouldn’t be a big deal since the else if for the following shots would allow for other tasks to execute while this is being executed, if I understand it correctly. Thanks for your help

Edited. Should fix it.

It was a little bit too inconsistent, so I am just doing the priming manually with a hold function. Thanks though