Robot Keeps Spinning in Circles during Autonomous

Hello, when I ran my previously working autonomous codes this morning, the robot just spins in circles infinitely and does not do anything else.
We have tried:
-New Brain
-New inertial sensor
-New wires
None of these worked and we are stuck and wondering if anyone could help. Thank you!

Until you post your code, just another robot chasing its tail.

Reconfigure your brain’s gyro. If this does not work, reset your brain entirely. We had the same problem twice, and they both work.

Do note team is using inertia sensor and not gyro (v4).

1 Like

Post your code, because from what it sounds like you could have your motors set up wrong in there.

Code and a video of your robot, we found that the spin is because we programmed our robot to turn left, but it turns right, making it so the robot will continually spin since it never achieved its left turn

include "vex.h"

using namespace vex;
using signature = vision::signature;
using code = vision::code;

// A global instance of brain used for printing to the V5 Brain screen
brain  Brain;

// VEXcode device constructors
motor leftMotorA = motor(PORT6, ratio6_1, false);
motor leftMotorB = motor(PORT12, ratio6_1, false);
motor leftMotorC = motor(PORT15, ratio6_1, false);
motor_group RightDriveSmart = motor_group(leftMotorA, leftMotorB, leftMotorC);
motor rightMotorA = motor(PORT10, ratio6_1, true);
motor rightMotorB = motor(PORT15, ratio6_1, true);
motor rightMotorC = motor(PORT20, ratio6_1, true);
motor_group LeftDriveSmart = motor_group(rightMotorA, rightMotorB, rightMotorC);
inertial DrivetrainInertial = inertial(PORT19);
smartdrive Drivetrain = smartdrive(RightDriveSmart, LeftDriveSmart, DrivetrainInertial, 319.19, 320, 40, mm, 1);
motor IntakeMotorA = motor(PORT17, ratio18_1, false);
motor IntakeMotorB = motor(PORT18, ratio18_1, true);
motor_group Intake = motor_group(IntakeMotorA, IntakeMotorB);
digital_out DigitalOutA = digital_out(Brain.ThreeWirePort.A);
digital_out DigitalOutB = digital_out(Brain.ThreeWirePort.B);
digital_out DigitalOutC = digital_out(Brain.ThreeWirePort.C);
digital_out DigitalOutD = digital_out(Brain.ThreeWirePort.D);
controller Controller1 = controller(primary);
motor Ladybrown = motor(PORT16, ratio36_1, false);
optical Eye = optical(PORT10);
distance Distance = distance(PORT21);
// VEXcode generated functions
// define variable for remote controller enable/disable
bool RemoteControlCodeEnabled = true;
// define variables used for controlling motors based on controller inputs
bool Controller1LeftShoulderControlMotorsStopped = true;
bool Controller1RightShoulderControlMotorsStopped = true;
bool DrivetrainLNeedsToBeStopped_Controller1 = true;
bool DrivetrainRNeedsToBeStopped_Controller1 = true;

// define a task that will handle monitoring inputs from Controller1
int rc_auto_loop_function_Controller1() {
  // process the controller input every 20 milliseconds
  // update the motors based on the input values
  while(true) {
    if(RemoteControlCodeEnabled) {
      // calculate the drivetrain motor velocities from the controller joystick axies
      // left = Axis3 + Axis1
      // right = Axis3 - Axis1
      int drivetrainLeftSideSpeed = Controller1.Axis3.position() - Controller1.Axis1.position();
      int drivetrainRightSideSpeed = Controller1.Axis3.position() + Controller1.Axis1.position();
      
      // check if the value is inside of the deadband range
      if (drivetrainLeftSideSpeed < 5 && drivetrainLeftSideSpeed > -5) {
        // check if the left motor has already been stopped
        if (DrivetrainLNeedsToBeStopped_Controller1) {
          // stop the left drive motor
          LeftDriveSmart.stop();
          // tell the code that the left motor has been stopped
          DrivetrainLNeedsToBeStopped_Controller1 = false;
        }
      } else {
        // reset the toggle so that the deadband code knows to stop the left motor nexttime the input is in the deadband range
        DrivetrainLNeedsToBeStopped_Controller1 = true;
      }
      // check if the value is inside of the deadband range
      if (drivetrainRightSideSpeed < 5 && drivetrainRightSideSpeed > -5) {
        // check if the right motor has already been stopped
        if (DrivetrainRNeedsToBeStopped_Controller1) {
          // stop the right drive motor
          RightDriveSmart.stop();
          // tell the code that the right motor has been stopped
          DrivetrainRNeedsToBeStopped_Controller1 = false;
        }
      } else {
        // reset the toggle so that the deadband code knows to stop the right motor next time the input is in the deadband range
        DrivetrainRNeedsToBeStopped_Controller1 = true;
      }
      
      // only tell the left drive motor to spin if the values are not in the deadband range
      if (DrivetrainLNeedsToBeStopped_Controller1) {
        LeftDriveSmart.setVelocity(drivetrainLeftSideSpeed, percent);
        LeftDriveSmart.spin(reverse);
      }
      // only tell the right drive motor to spin if the values are not in the deadband range
      if (DrivetrainRNeedsToBeStopped_Controller1) {
        RightDriveSmart.setVelocity(drivetrainRightSideSpeed, percent);
        RightDriveSmart.spin(reverse);
      }





void pre_auton(void) {
  Drivetrain.setHeading(0,degrees);
  Drivetrain.setDriveVelocity(25,percent);
  Drivetrain.setTurnVelocity(20,percent);
  Intake.setVelocity(100,percent);
  Ladybrown.setVelocity(100,percent);
  Ladybrown.setStopping(hold);
  
  
  // Initializing Robot Configuration. DO NOT REMOVE!
  vexcodeInit();

Did you guys figure it out?