What is the best way to do turns in autonomous?

I just wanted to get some input on what other people are doing in their code to produce accurate and consistent turns.

What are you currently using?

Separate tuned pid loops for each side w/quad encoders, though I’m pretty sure a gyro would be better.

I used to use PID, but after about 3 months of fine tuning, I gave up on getting it to work consistently. I now just tell the motors to go full speed till they hit the gyro target.

Doesn’t that drift?

No. I just reset the sensor value after each step in the autonomous. This seems to eliminate all drift problems.

You’re doing something wrong if it takes 3 months.

Your new approach is heavily dependent on battery voltage and will be very inconsistent.

Just tell the motors to slow down when it reaches 75 percent of the goal. So something like
void turning2(int target)
{
while(abs(SensorValue[gyro]) < target*.75)
{
motor[chassL] = -127;
motor[chassR] = 127;
}
while(abs(SensorValue[gyro]) < target)
{
motor[chassL] = 25;
motor[chassR] = -25;
wait1Msec(100);
}
}

Couldn’t this be better achieved with a p controller?

Thats exactly why I’m asking.

shrugs
I just thought it would be ez, and for turning you don’t really need it

Use PID then. Ask for help on the forums if you have difficulty tuning. The problem that caused you to take 3 months to tune your PID controller doesn’t lie in the algorithm.

I would argue that turning is exactly when you do need it. Even a slight inaccuracy could lead to multiple inches or even a foot of error if driving any significant distance across the field.

@NyQuil were you making sure to calibrate your gyro?

Aren’t you just supposed to do it once in preauton?

@NyQuil Yep! just making sure you were calibrating your gyro. The biggest recommendation I would have is to use PID and make sure to scale your gyro value. Watch 1826’s video for more info.

Thanks, I’ll be sure to check it out!