Robot Keeps Spinning

I am new to Vex Robotics and am teaching 10 middle schoolers. They are having a blast learning the coding. We have run into a strange issue. We are working on the Claw Bot and 2 robots continue to spin in circles when they code Turn Right 180 degrees. I have tried everything I can think of. We even have a student in the class who competed in Korea and did well and he can’t figure it out either. Has anyone else had this issue?

I have not had this issue but it may be due to other interfering parts of the code or different gearing than the program thinks it has. It would be easier for us to help if you could show the code which is causing this.

We just had the same issue with one of our teams using the Gyro on the Drivetrain.
This is a v1 brain and v1 Gyro.

If they do a turnRight for 180 degrees it spins forever.
If they do a turnLeft for 180 degrees it works just fine.

I haven’t had time to dig in but the gyro does increment counter-clockwise (turning left).
I haven’t tried turning right 45 degrees or 90 degrees yet so see if there is a special case issue with 180 degrees.

So as a short-term fix, try turning left 180 degrees.

The most common issue is a math problem…reversed use of < or > sign when the numbers generated go positive or negative (especially negative… you’ll want to “stop” when the value < -180° . If you can “print” the gyro values to your brain, the student will be able to see as the robot moves what the values are reading, then it makes the math function easier to visualize.

What does the brain think is happening?

Create a print out on the screen for the gyro position and see what it says. Lift the robot in the air and the printout should change from 0° to 90°.

Also, the Gen 1 Gyro needs to be oriented with the logo pointing up. If it is mounted on the side, it won’t give you the results you are looking for.

1 Like

Hello. Thank you for your response. We are using Gen 2 devices. The Robot config is using Brain Inertial.

Hello1 Thank you for your response. I have included the code and the robot’s config, It seems to be correct… However, it hits the first turn right and spins in circles. I do appreciate your help!

float myVariable;

// “when started” hat block
int whenStarted1() {
CLAW.spin(forward);
Drivetrain.driveFor(forward, 304.0, mm);
CLAW.spin(reverse);
Drivetrain.driveFor(reverse, 152.0, mm);
Drivetrain.turnFor(right, 90.0, degrees);
Drivetrain.driveFor(forward, 152.0, mm);
CLAW.spin(forward);
Drivetrain.driveFor(reverse, 152.0, mm);
Drivetrain.turnFor(left, 90.0, degrees);
Drivetrain.driveFor(forward, 152.0, mm);
Drivetrain.turnFor(left, 90.0, degrees);
Drivetrain.driveFor(forward, 152.0, mm);
CLAW.spin(reverse);
Drivetrain.driveFor(reverse, 152.0, mm);
Drivetrain.turnFor(right, 180.0, degrees);
Drivetrain.driveFor(forward, 152.0, mm);
CLAW.spin(forward);
Drivetrain.driveFor(reverse, 152.0, mm);
Drivetrain.turnFor(left, 90.0, degrees);
Drivetrain.driveFor(forward, 152.0, mm);
Drivetrain.turnFor(left, 90.0, degrees);
Drivetrain.driveFor(forward, 152.0, mm);
CLAW.spin(reverse);
Drivetrain.driveFor(forward, 152.0, mm);
Drivetrain.turnFor(right, 180.0, degrees);
Drivetrain.driveFor(forward, 152.0, mm);
CLAW.spin(forward);
return 0;
}

int main() {
// Calibrate the Drivetrain Gyro
calibrateDrivetrain();

whenStarted1();
}
Screenshot 2023-04-25 at 8.32.52 AM

They could’ve also forgotten to tell the gyro to calibrate

Thank you everyone for the feedback! You guys were right! It was a math issue due to the brain calibration. We recalibrated the offending brains and viola, they are working as they should!

Donna, probably worth drilling down a bit on your reply. Probably not a math issue but rather a failure to include a Calibrate block/ command in your start-up code? Pretty much routine for our guys. The usual routine is to make sure the robot is positioned as desired and then start the code which should contain a Calibrate command followed by a couple of seconds of waiting before proceeding.

Try calibrating the brain in devices