Line Tracking

Implementing Line following and detection was the most difficult part of the finite state machine of our robot. To detect the black tape, we had to position our tape sensors through holes we cut on our base to be very close to the floor, then determine the hysteresis values of which the tape sensors detect black tape or the white surface of the field.

Line following was needed to reach the ammo depot. In FindingAmmoSubHSM (see the first image), when the front tape sensor detects the black tape the robot will transition between BlackTapeFront and MovingFWD, where it will bobble along the line to straighten itself out while going forward. The robot would quickly turn in the opposite direction when the front tape sensor detected white then move straight forward, and repeat this until it no longer goes outside of the black tape. This was simple and robust as long as the front tape sensor was working.

Line tracking is then used at the end of FindingTSubSubHSM, in which while wall riding, the robot is checking for black tape with its front sensor. Once black tape is found, the robot goes forward briefly before turning to align with the ammo depot.

In AligningTSubSubHSM, line detecting while obtaining the ammo was much more difficult because our robot did not turn consistently and did not always end up in the same place to detect the black tape near the ammo depot. To align with the depot by detecting the T-shaped tape, we tried both timed events and line tracking individually, but neither method was reliable and line tracking was rather difficult because if the robot did not align with the tape the first time, then it would have a hard time trying to realign. To solve this, we made the robot hit the ammo depot mutiple times, while rotating slightly in each succession. This was a much better alterative to attempting to align perfectly with the T when all five sensors detected the tape, which is possible for our robot in theory but was never done autonomously.