Our main strategy for robust alignment was to use the walls.
Initially, orient ourselves in the field by using the ultrasonic sensors to find the walls around our safe space and understand our orientation and location.
Then we drive up to the walls and wedge ourselves on the corner of the 'Fakebook' fact check walls to get into the first position.
To shoot into the second target (the middle 'Twitter') tower we experimented with both using IR to align and also differential sonar sensor to understand our position/angle off of the wall.
In order to more accurately determine the bot's relative position to the gaming arena, we decided to implement differential sonar sensors on the right hand side of the bot. In order to do this, we used two sonar sensors on this side. While it was useful to know how the distance between a side of the bot and a wall, using one sensor did not tell us the relative position of the bot. For example, we still could not determine if the side was parallel or angled towards a wall. In order to more accurately drive our motors and determine the state of the bot, we decided that it was important to not only know position, but also the difference in between the readings on a side. If the distance was greater than some threshold, we would make slightly nudges to realign the bot in a more favorable position. By using a differential reading, we were able to align the bot's side parallel to the wall with much more consistency.
This technique was especially useful for determining a position when we wanted to escape the safe space. We wanted to align the right hand side of the bot toward the safe space wall. Without the differential reading, we would often over-rotate, drive forward, and get stuck against this wall.
One tradeoff between greater position precision with the differential technique was that we had to use more Arduino pins.
Although our bot did not use the IR beacon for alignment, we did design an IR sensing circuit. This circuit was functional, but there was integration issues with the drive train motors. We set up the IR circuit in a sourcing configuration using a 100k Ohm resistor. This input is Vin.
The circuitry schematic can be seen below:
The input buffer was to ensure that the signal created by the photo transistor was isolated. It also was used to isolate the 100k Ohm resistor from the 4th order Butterworth filter. Without the buffer, the resistance in the sourcing configuration could perturb the intended corner frequency (350Hz) of the high pas filter. The Butterworth filter was to attenuate other light that could be interpreted as noise. The filter was designed to be 4th order to sharply attenuate frequencies that were not interesting.
The filter was simulated in LTspice, and the the frequency response can be seen below:
The instrumentation amplifier was used to provide low noise amplification. Because many devices were connected to the 5V rail and ground, the differential nature of the amplifier removes grounding noise from the signal. The gain of the amplifier was 11.
Finally, the output of the amplifier is fed into the LM339 to produce a discrete signal that could be more easily read by the Arduino. The lower trip point was set at 0.25V and the upper trip point was set at 1V. Because this is an inverting comparator, the output signal is low when a signal is detected. Although we did not intend to use the IR sensor to move into shooting position, we had thought about using the sensor to fine tune the bot's position so that the shooter was lined up with the tower.