Twitcher

Twitcher 2.0 is a tabletop robot used for the Trinity Firefighting Competition. It was built by a group of students, including Daniel Grandy and Joseph Gensel, for the 2010 competitive season. The hardware is a wood-based double-platform system using several range-finder sensors, a lighter sensor, a fan, and an Arduino for the main logic. The software solution is based off of the Octobot9 2009 solution.

During the 2010 Trinity Fire Fighting Competition, the robot successfully completed two runs in the maze. In the first run, Twitcher 2.0 blew out the candle, and during the second run, had a fan failure, but correctly located the candle.

= Parts List =


 * Arduino for the main logic
 * Motor controller
 * 2 motors (left and right)
 * 3 IR sensors (Front, left, right)
 * UV Tron for flame detection
 * Fan for putting out the flame
 * Bump-sensor, acting as the start button

= Construction =

Construction was done in spring of 2010, using a custom chasis based on two platforms of wood and a large undercarriage space of about 6 inches. All sensors are directly interfaces through the Arduino, except for the motors which are controlled via a Jr Trex motor controller.

= Pin Out =
 * Start Button - Digital 10 (Yellow is Power, Red is Signal)
 * Left IR - Analog 5
 * Front IR - Analog 4
 * Right IR - Analog 3
 * Photo Sensor - Analog 0
 * Motor Controller - Digital 6 & 7
 * Fan - Digital 9
 * Serial Screen - Ignored for now

= Solution =

The general solution approach was to implement a simple state-machine for the high-level logic, and simple wall-following for low-level movement. The robot starts at the standard starting position, facing south of the sample map, waiting for a press-event on the start switch. Once this happens, the robot state moves into the right-wall follow state, following the right wall. During this state, the photosensor is constantly queried until a reasonable light sensor reading is found. Once this is done, the robot turns on the fan, and rotates around until the candle is out. Once this is complete, the robot halts.



The solution, simply put, is a brute-force maze searching algorithm based on right-wall follow. There is a special conditional in which once the third room is searched, the robot tries to directly move to the final room. Once the candle is put out, the robot halts.

Algorithm
'' The following is an informal outline of the solution algorithm, but does reach all rooms. There is no calculated run-time Big-O function. ''


 * 1) Wait for Start-Button press event
 * 2) Query sensors
 * 3) If this is the 21st turn
 * 4) Follow left into room 4
 * 5) If there is no wall to the right of the robot
 * 6) Move forward the length of the robot
 * 7) Turn 90 degrees to the right
 * 8) Move forward the length of the robot
 * 9) Else, if there is a wall to the front of the robot
 * 10) If the right wall is open
 * 11) Turn 90 degrees to the right
 * 12) Else
 * 13) Turn 90 degrees to the left
 * 14) Move forward the length of the robot
 * 15) Else
 * 16) Wall follow
 * 17) If light is detected
 * 18) Turn on fan
 * 19) Do three cycles of 45 degree movement, sweeping out the flame
 * 20) Repeat from "Query sensors"

Notes:
 * The "move" function will not move if there is an obstacle in the way of the robot, to prevent moving into a wall unintentionally.
 * The "wall follow" function is based on distance from the right wall, turn the vehicle into the wall if too far, and out of the wall if too near.
 * There is a subtle issue in this design, such that when a robot rotates towards a wall, because it is too close, it increases the distance read from the distance sensor because it is now pointing to behind the robot, and thus reads a larger distance. The robot then tries to rotate more, and thus the problem worsens.
 * To solve this, our "Fork Wall following" algorithm limits the left/right max rotation. This means that if the robot is too far, it only turns once into the wall again, or if it is too close, it turns only once away.
 * This is done on purpose to prevent the robot from continuously turning into a wall, which would make it crash.

Source Code
File: Twitcher.pde

File: Hardware.pde