In the past few years, we have realized that a good robot starts with good mechanical design, and then the programming will be a lot easier. However, there are a lot of great things that we can do with programming that will make designing a robot easier as well. In the past few years, we have begun to utilize several more complicated programming methods that have allowed our robot to complete more missions.
PID Line Follow: In 2014, we did a lot of research around the idea of line-following (which was a major part of that year’s challenge). Using the beauty of the Internet, we were able to write and integrate a PID line-follow program. We even wrote one that uses two sensors instead of just one, in the thinking that this might make the program more accurate.
Gyro Sensor PID: In 2015, we developed a PID Gyro-based program that keeps the robot driving in a straight line. We developed this by using a PID line-follow program developed for the 2014 challenge and incorporating the gyro into the PID instead of the light sensor. This was really helpful because we found that the tall skinny wheels tend to make the robot swerve/turn more than smaller/wider wheels, but we really like them for acceleration and a smaller robot footprint. It also helps to correct for any differences in the power/efficiency in each motor driving the wheels.
Gyro Sensor-Measured Turns with Error Correction: In 2017 (the Animal Allies challenge), we recognized that one of our major issues was that if you used the Gyro to make a turn, it would not stop on the same Gyro value every time. So we created a program that can tell if the robot is off to the left or to the right of the target, and then make a corrective turn to put it back onto the correct Gyro setting. The program loops back and forth so that it doesn’t stop until the gyro reading is correct. We did a lot of testing around this, and found that it was off by only 1 degree, but it was consistently off, and the additional time added by running this loop was minimal.
Ramp-up and Ramp-down Speed Control (see MyBlocks section for program): In 2016, we also noticed that when our PID gyro program from 2015 (see #6) was the least accurate was when we were starting a program at a higher speed. The robot seemed to do a quick little “wheelie,” which usually twisted it in one direction or another, and then the gyro program would make a correction, but sometimes, if the speed was too high, the robot would still not be in the correct position. To try an eliminate these “wheelies,” but still be able to run programs at high speeds, we worked this summer on developing a “Ramp-up and Ramp-down” speed-controlling program. With this program, we use variables to tell the program what we need. As the robot is increasing power to the wheels, it is also using the PID Gyro program that we developed in 2015 to keep the robot going straight. Then it starts to slow down at a specified distance, ramping-down until it reaches the minimum speed, and finishes the distance at minimum speed. The secret to the program’s usefulness is our ability to use variables to set the following:
- Maximum and minimum speed values
- Ramp-up increments (usually about 0.25-0.75% power)
- Ramp-Down increments (usually about 0.75-1.0% power)
- Distance at which robot should be at Max Speed
- Distance at which the robot should start slowing down
- Overall distance (in degrees)
- Target gyro setting (in degrees)