[PROS] Issue with autonomous not continuing

So I have a team with me that’s having some issues with their robot during autonomous.


#include "main.h"

/**
 * Runs the user autonomous code. This function will be started in its own task
 * with the default priority and stack size whenever the robot is enabled via
 * the Field Management System or the VEX Competition Switch in the autonomous
 * mode. Alternatively, this function may be called in initialize or opcontrol
 * for non-competition testing purposes.
 *
 * If the robot is disabled or communications is lost, the autonomous task
 * will be stopped. Re-enabling the robot will restart the task, not re-start it
 * from where it left off.
 */
 Motor frontLeft(FRONTLEFTPORT);
 Motor frontRight(FRONTRIGHTPORT, true);
 Motor backLeft(BACKLEFTPORT);
 Motor backRight(BACKRIGHTPORT, true);
 Motor lift(LIFTPORT, MOTOR_GEARSET_36);
 Motor catapult(CATAPULTPORT, MOTOR_GEARSET_36, true);
 Motor intake(INTAKEPORT);
 Motor flipper(FLIPPERPORT, E_MOTOR_GEARSET_36);

 void autonomous() {
   flipDown(1.5, 50);
   forward((20/12.56), 75);
   flipUp(.75, 50);
   // turnLeft(6, 75);
   // shoot(1, 90);

 }

 void forward(float rev, int speed) {
  frontLeft.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  frontRight.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  backLeft.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  backRight.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);

  frontLeft.move_absolute(rev, speed);
  backLeft.move_absolute(rev, speed);
  frontRight.move_absolute(rev, speed);
  backRight.move_absolute(rev, speed);
  while( !(frontRight.get_position() < (rev + 0.5)) || !(frontRight.get_position() > (rev - 0.5))) {

  }
  frontLeft = 0;
  frontRight = 0;
  backLeft = 0;
  backRight = 0;

}

void turnLeft(float rev, int speed) {
  frontLeft.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  frontRight.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  backLeft.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  backRight.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);

  frontLeft.move_absolute(rev, -speed);
  backLeft.move_absolute(rev, -speed);
  frontRight.move_absolute(rev, speed);
  backRight.move_absolute(rev, speed);
  while(!(frontRight.get_position() < (rev + 0.5) && frontRight.get_position() > (rev - 0.5))) {

  }
  frontLeft = 0;
  frontRight = 0;
  backLeft = 0;
  backRight = 0;

}

void turnRight(float rev, int speed) {
  frontLeft.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  frontRight.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  backLeft.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);
  backRight.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);

  frontLeft.move_absolute(rev, speed);
  backLeft.move_absolute(rev, speed);
  frontRight.move_absolute(rev, -speed);
  backRight.move_absolute(rev, -speed);
  while(!(frontRight.get_position() < (rev + 0.5) && frontRight.get_position() > (rev - 0.5))) {

    }
    frontLeft = 0;
    frontRight = 0;
    backLeft = 0;
    backRight = 0;

  }

void liftUp(float rev, int speed) {
  lift.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);

  lift.move_absolute(rev, speed);

  }

void liftDown(float rev, int speed) {
  lift.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);

  lift.move_absolute(rev, -speed);

}

void shoot(float rev, int speed) {
  catapult.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);

  catapult.move_absolute(rev, speed);

}

void flipUp(float rev, int speed) {

  flipper.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);

  flipper.move_absolute(rev, speed);

}

void flipDown(float rev, int speed) {
  flipper.set_encoder_units(E_MOTOR_ENCODER_ROTATIONS);

  flipper.move_absolute(rev, -speed);

}

So what happens is that their flipper deploys, it goes forward, but then it doesn’t move the flipper back up to flip a cap. Anything they’re missing or something off in the logic?

Set the back drive to using velocity only and stop them when the front stops. You are already only checking the front and the back have probably not hit the position yet when all motors are zeroed. Try something like:

  frontLeft.move_absolute(rev, speed);
  backLeft.move_velocity(speed);
  frontRight.move_absolute(rev, speed);
  backRight.move_velocity(speed);