Should this code work as designed?

Aha! Figured out why I couldn’t replicate before - I was pressing the reset button on the board, but I suspect you were pressing the Run button in XRPCode. Using the reset button, it consistently goes 5cm. However pressing the Run button, I get the same behavior (5cm on the first run, then much further on subsequent runs).

Below is better replication code. Ensure a hard reset is performed, then run this code. The first iteration will go a short distance (5cm), all subsequent iterations will go a longer distance because the motors spin much faster. If no hard reset occurs between runs, it continues to go too far.

I suspect the problem is with the motor speed PID controller. I will submit an issue.