Line Detection

Brief

Detecting the out line, and subsequently making an attempt to stay within the bounds of the field, is a mandatory function of the robot. Failure to do so means disqualification. Most teams tackle this challenge with a ring of line sensors, similar to the ball sensor ring, which can give you the price angle of the line, relative to your robot. However, we have currently opted for a simpler approach, with a single colour sensor and four sonars. These sonars (so long as the robot faces a goal) allow us to know which part of the out line we're on, and so where to move away.

Theory

The most common solution to out line detection is a circular ring of light sensors, which allows you to calculate the relative direction of the line, to the robot, regardless of its orientation of the field. This allows for rapid outline detection, which is essential for high performing robots. The algorithm for doing so would consist of checking which sensors are triggered. Depending on the resolution of the ring, this could trigger anywhere from two (minimum needed) to however many sensors. A vector can be calculated for each sensor, with a constant magnitude, and a direction from the centre of the robot to the position of that sensor. Summing the individual vectors (for the active sensors) yields a resultant vector that points to the direction of the line. This vector is perpendicular to the line. With this information, the robot can move accordingly. Depending on which quadrant the vector is in, jittery movement can be prevented. Many robots constantly back away from the line, but then end up moving toward it again, and so on and so forth. However, given the quadrant of the vector, the x or y component of the robot movement vector can be cancelled out, in order to prevent this (i.e. a vector subtraction, the net movement vector subtracts the line vector).

Develpoment

For our robot, we are opting for a simple MVP to begin with, as the current setup of our robot doesn't easily allow for the addition of a ring. We use a single colour sensor, placed centrally under the robot, which acts as a flag for when we're on the out line. Our robot uses the flag to stop and orient to the closest multiple of 90 degrees. This is because we have 4 sonars, placed 90 degrees apart, so aligning ourselves to a multiple of 90 degrees allows the sensors to be parallel to the walls, for obtaining accurate readings.

The following photo shows the configuration of our sonars (HC-SR04):

Ultrasonic configuration on Team Athena's robot

And the colour sensor underneath (TCS34725):

Colour sensor placement on Team Athena's robot