My team coded this p loop to help stop our robot from jerking when it stoped, we don’t know whats wrong. Our drive moves backward and clamp just does random things
Here is our code
Sorry, my teammate did not expain what is going wrong. Basically it reverts the auton and the robot just runs into the wall going backwards. We tried changing the direction, but it still did not work. It makes the clamp go reverse too even if we change the direction of that.
When debugging issues like this you really need to monitor the values of your variables are as the loop goes around. Usually, the easiest way to do this is to print the values to the terminal/console using printf() statements.
When you do, you’ll probably see something unexpected. Perhaps the .rotation() values being returned are getting smaller or are negative, rather than increasing as you are expecting.
Also, typically you would want to stop (exit the while loop) when the current >= target, or error <= 0.