Lag input after an action is executed

So, while my team runs their driver control on their bot, we try to multitask a lot of options to maximize time and score the most points. The only problem is that, we have a program/ motor that when it runs it stops/ continues all previous functions before it until it complete, which then all other actions will resume their code and finish.
ex. If we are spinning 90 degrees and turned on the motor, we would lag and overshoot for an extra 700-1000 milliseconds or so. It only happens with this motor and it severely stops our progress as we have to stop everything just to use the motor and then resume.
vVv Here is the code, I’ll try to answer any questions you have about it.(The problem is with DVM) vVv


void usercontrol( void ) {
  // User control code here, inside the loop
    
    int TurboSpeed = 200;
    int FullSpeed = 100;
    int ThreeSpeed = 75;
    int HalfSpeed = 50;
    int QuarterSpeed = 25;
    int Stop = 0;
    int PowerLevel = 10;
    
    static bool LToggle = false;
    static bool CToggle = false;
    static bool IToggle = false;
    static bool FToggle = false;

  while (1){
      
//Velocity
      RightF.setVelocity(FullSpeed,velocityUnits::rpm);
      LeftF.setVelocity(FullSpeed,velocityUnits::rpm);
      RightB.setVelocity(FullSpeed,velocityUnits::rpm);
      LeftB.setVelocity(FullSpeed,velocityUnits::rpm);
    
//Locks
LiftL.stop(brakeType::hold);
LiftR.stop(brakeType::hold);
Cappy.stop(brakeType::hold);
DVM.stop(brakeType::hold);
      
//Drive Control
        //Set the left and right motor to spin forward using the controller Axis values as the velocity value.
        LeftF.spin(vex::directionType::fwd, Controller2.Axis3.value(), vex::velocityUnits::pct);
        RightF.spin(vex::directionType::fwd, Controller2.Axis2.value(), vex::velocityUnits::pct);
        LeftB.spin(vex::directionType::fwd, Controller2.Axis3.value(), vex::velocityUnits::pct);
        RightB.spin(vex::directionType::fwd, Controller2.Axis2.value(), vex::velocityUnits::pct);

//Wheel Lock
    if(Controller2.ButtonA.pressing()){
    //Lock
       Controller2.Screen.clearScreen();
        LeftF.stop(brakeType::hold);
        LeftB.stop(brakeType::hold);
        RightF.stop(brakeType::hold);
        RightB.stop(brakeType::hold);
       Controller1.Screen.print("Lock On");
}
    if(Controller2.ButtonB.pressing()){
     //Unlock
        Controller2.Screen.clearScreen();
         LeftF.stop(brakeType::coast);
         LeftB.stop(brakeType::coast);
         RightF.stop(brakeType::coast);
         RightB.stop(brakeType::coast);
        Controller2.Screen.print("Lock Off"); 
      }
//Strafe
    if(Controller2.ButtonR1.pressing()){
        LeftF.spin(directionType::rev,180,velocityUnits::rpm);
        RightF.spin(directionType::rev,200,velocityUnits::rpm);
        LeftB.spin(directionType::fwd,180,velocityUnits::rpm);
        RightB.spin(directionType::fwd,200,velocityUnits::rpm);
    }
    if(Controller2.ButtonL1.pressing()){
        LeftF.spin(directionType::fwd,180,velocityUnits::rpm);
        RightF.spin(directionType::fwd,200,velocityUnits::rpm);
        LeftB.spin(directionType::rev,180,velocityUnits::rpm);
        RightB.spin(directionType::rev,200,velocityUnits::rpm);
    }
//Push Back System
    if(Controller2.ButtonLeft.pressing()){
      if(LeftF.rotation(rotationUnits::deg) >= 0.01){
        LeftF.rotateTo(0,rotationUnits::deg,200,velocityUnits::rpm,false);
        RightF.rotateTo(0,rotationUnits::deg,200,velocityUnits::rpm,false);
        LeftB.rotateTo(0,rotationUnits::deg,200,velocityUnits::rpm,false);
        RightB.rotateTo(0,rotationUnits::deg,200,velocityUnits::rpm);
      }
      if(LeftF.rotation(rotationUnits::deg) <= -0.01){
        LeftF.rotateTo(0,rotationUnits::deg,200,velocityUnits::rpm,false);
        RightF.rotateTo(0,rotationUnits::deg,200,velocityUnits::rpm,false);
        LeftB.rotateTo(0,rotationUnits::deg,200,velocityUnits::rpm,false);
        RightB.rotateTo(0,rotationUnits::deg,200,velocityUnits::rpm);
      }
    }
    if(Controller2.ButtonUp.pressing()){
        LeftF.setRotation(0,rotationUnits::deg);
        RightF.setRotation(0,rotationUnits::deg);
        LeftB.setRotation(0,rotationUnits::deg);
        RightB.setRotation(0,rotationUnits::deg);
    }   
//Lift Control

    if(Controller1.ButtonR1.pressing()){
      LiftR.spin(directionType::fwd,152,velocityUnits::rpm);
      LiftL.spin(directionType::fwd,150,velocityUnits::rpm);
  }
    else if(Controller1.ButtonR2.pressing()){
      LiftR.spin(directionType::rev,152,velocityUnits::rpm);
      LiftL.spin(directionType::rev,150,velocityUnits::rpm);
    }
    else{
      LiftR.stop();
      LiftL.stop();
      }
 
//Cappy Control

      if(Controller1.ButtonL1.pressing()) {
        Cappy.spin(directionType::fwd,100,velocityUnits::rpm);
      }
      else if(Controller1.ButtonL2.pressing()) {
        Cappy.spin(directionType::rev,100,velocityUnits::rpm);
      }
      else{
          Cappy.stop();
      }

//DVM
    if(Controller2.ButtonR2.pressing()){
        DVM.startRotateTo(2,rotationUnits::deg,200,velocityUnits::rpm);  
    }
/*
    else if(Controller2.ButtonL1.pressing()){
        DVM.rotateTo(332,rotationUnits::deg,200,velocityUnits::rpm);
    }
*/
    else if(Controller2.ButtonL2.pressing()){
        DVM.startRotateTo(370,rotationUnits::deg,200,velocityUnits::rpm);
    }
/*
    else if(Controller2.ButtonR1.pressing()){
        DVM.rotateTo(156,rotationUnits::deg,200,velocityUnits::rpm);
    }
*/
    else{
         DVM.stop();   
    }


motor::rotateTo

will stop any other command from executing until it finishes unless its wait for completion flag is set to false. For some commands you set the wait for completion flag to false. Do that for every


rotateTo

, too, and it won’t freeze on those commands.