Motors not stopping on spin to position calls

Hey! Just had a quick question on a problem that I am having. Basically, we have a “bevel” that tilts platforms backward so that we can place rings onto them. We printed the values of the position of the motors, the bevel being folded as 0, and found that 1.47 revolutions are the correct number for the arm to move all the way down, and 0.68 revolutions are the number for the tilt. In our auton code, the lines we use to move the tilter are:

Bevel.spinToPosition(Up, rev, false) // Bevel raised up
Bevel.spinToPosition(Down, rev, false)// Bevel all the way down

Most of the time, this works fine. However, on some random occasions, the arm doesn’t stop moving and keeps trying to go down past the lowest position, causing it to get stuck. There is no pattern with when this occurs. I am making sure that the starting position is all the way up (in the exact same place) every single time, so I don’t think that its a problem with the robot initializing 0 in the wrong spot. Wondering if anyone has encountered this in the past/knows what might be wrong.

Thanks!

Bevel.spinToPosition(Up, rev, false); // Bevel raised up
Bevel.spinToPosition(Down, rev, false); //Bevel all the way down

Next time, please format your code with three back ticks (```) to make it easier for us to read your code. Have you tried adding a stop command after your code like this just in case it keeps going?

Bevel.spinToPosition(Up, rev, false); // Bevel raised up
Bevel.spinToPosition(Down, rev, false); //Bevel all the way down
Bevel.stop();