I am having trouble with the motors’s position for our wall stake arm not resetting. In this case, when we press the down button, the arm is lowered onto a bumper and stopped. Then, when we press the left button, the motor position is supposed to be set to zero (this is the code below). However, the motor position is not resetting at all (it’s not just a few encoders off, it’s simply not resetting). I also know there is not a functional purpose to resetting the motors with the current code since the motor is just turning by a set number of turns instead of to a position, but the problem remains that the motor position won’t set to 0. What am I doing wrong?
void ButtonLeft_released() {
isPtoOnBase = false;
PtoCylinders.set(true);
PtoMotorLeft.setStopping(brake);
PtoMotorRight.setStopping(brake);
PtoMotorLeft.setVelocity(25.0, percent);
PtoMotorRight.setVelocity(25.0, percent);
PtoMotorLeft.setPosition(0, degrees);
PtoMotorLeft.resetPosition();
PtoMotorRight.setPosition(0, degrees);
PtoMotorRight.resetPosition();
PtoMotorLeft.spinFor(forward, 1.22, turns, false);
PtoMotorRight.spinFor(forward, 1.22, turns);
PtoMotorLeft.setVelocity(100.0, percent);
PtoMotorRight.setVelocity(100.0, percent);
}