Autonomous tips

My team did not do very well this season we found that autonomous won or lost the vast majority of our matches therefore we want to have a better autonomous next season. All of us were on a FLL team last year and two of us have programming experience out side of robotics. We would like to ask the forum what sensors we should use and how should we go about programming our autonomous for next season.

Nobody ever seems to like to use line followers, but they’re great for lining your robot up with the field. I would never use them to follow a line, but line sensors are much better than fuzzy ultrasonics and can help you “reset” any error accumulated by encoders.

Optical shaft encoders are our favorites

I would use a variety of sensors depending on the job and your abilities. If you know how to fine tune a potentiometer to work with your lift, use that. If not, use encoders. My recommendations are definitely the big red quad encoders for distance judging, a gyro for turns, and a potentiometer for the lift. I would also fiddle with the order of the cables on the quad encoders to get both turning positive while moving forward. (Normally one encoder will count backwards if both are not facing the same way, and because the encoder is just reading a voltage drop on each cable, you can swap the ports that the two cables are plugged into, and that sensor will count the opposite direction it did before.)

How do you use the gyros. The encoders are not that foreign to me because of FLL.

Gyros are used in a very similar way. They return an angle in degrees. You can have a set point, and an error that you can use for PID’s or other loops. I switched to turning using the gyro this year and it dramatically improved the consistency of turning.

How much wheel slippage do you expect to get.

A gyro returns values in tenths of degrees from the position it was in when you turned the robot on. Here is a link to the RobotC websites tutorial:
It covers how to initialize and calibrate the gyro so that it gives accurate and consistent values.
How my code is:

void turnright(int speed, int degrees)
    int prevValue = SensorValue[gyro];//This is because you can't set a gyro to zero like an encoder.
    while(SensorValue[gyro] < prevValue +degrees)//Everything is relative to the last known position of the gyro.
     motor[left]  = 100;
     motor[right] = -100;

Perhaps you misunderstand. The Gyro module is fixed to the robot frame parallel to the floor, and senses when the frame rotates. Ideally, it act similar to a compass, except that North is whatever direction it is pointing when it is turned on.
If you use wheel encoders to measure rotation when turning, then wheel slip matters.
If you use gyro to track rotation, then it doesn’t matter if the wheels slip, or if you get rammed, or if giant hand action picks up your robot and rotates it in the air, and sets it down again, the gyro will know what direction the robot is facing.
While the thread title is ‘autonomous’, another use of gyro is to make “field oriented holonomic” driver control possible.

Quad encoders have proved useful for our team to know exactly how far our robot has traveled and we also have a sonar sensor that will keep us from running into the other robots.

Thread resurrection by AdamAnDrone!

shaft encoders and gyros, you can do anything

Holy Thread resurrection!

Anyway, Limit switches and Bumper switches are bae :smiley:

Also Gyros are amazing :stuck_out_tongue: