Require Immediate Help!!!!

hello, im part of a robotics team and i got a big problam, our compatition is less than a week and theres something with our gyro sensor. every time i tell my robt to turn right 90 degrees and only that, it does very well. but when i run it in my main program, it turns far a bit less or more and everytime i print its values it always stops at -900 but the rbot hasnt actualy turned 90 degrees. my gyro is in a safe spot n the robot, theres no shorting and everytime i hit the robot the vaules dont spike a lot, only about 20 to 50 out of 900. if anyone knows what is happening and can send me a response it would be very appreciated.

another problem i got is that im going in certain sections of the area using IMEs , they work but when the program is going back to the start to do the exact same thing they dont work, its lake they save their values from before evan thou i am presenting to 0 and stopping them everywhere in the program. they work very good at the first time but after they dont. help would be again very appreciated.

Post your code so people can help you.

For resetting IMEs, use nMotorEncoder[whatever] = 0.

Or just don’t use IME’s. They are a pain and love to not work. Quadratic Encoders are better.

Are you checking what the gyroscope value is at before turning? If not, your 90 degree turn may not be targeting that. Try doing the following (it’s in pseudocode):

newGyroTarget = getGyroValue + 90;
turnRight(someSpeed);
while(getGyroValue < newGyroTarget) {
delay(10ms);
}
stopTurning;

YM “quadrature encoders.”

I wonder what quadratic encoders would look like :wink: Maybe a parabola :wink:
LOL

As for your actual problem with the gyro, I recommend using some form of PID to make it more consistent. Even having only the P term would be helpful. If you do not have time for this, however, try using a slower speed. Most likely the robot is just drifting a little bit.

For the problem with the IME’s, are you able to provide a few more details? Also, like others in this thread have said, please post your program.