Colony | |||||||
Autonomous Recharging
Christopher Mar, Austin Buchan, Brad Neuman, Brian Coltin, Justin Scheiner, Felix Duvallet

Video Clip of 2 Robots w/ Task
Video Clip of 3 Robots w/o Task
Overview
The Autonomous Recharging process consists of 4 main functions: task scheduling, seeking, battery charging regulation, and charging station management. Wireless communication, BOM locating, and I2C communication are integral components to these functions.
Task and Charging Scheduling
The task scheduling, which is managed by the Scheduler Finite State Machine (FSM), encompasses the entire autonomous recharging process. The code in the schedule is designed to be modular enough to incorporate a variety of tasks while still maintaining the wireless network and monitoring the battery level. If the battery level ever falls below a certain threshold, the Scheduler FSM moves from the task to the Charging FSM, which manages the charging process. Currently, the task is the smart-run-around behavior which implements basic obstacle avoidance using the five Sharp IR rangefinders each robot is equipped with.
Within the Charging FSM, there are multiple states which handle all aspects of the charging process, including the different modes of communication with the charging station, the different seeking methods, and the actual charging itself. When the robot requests a bay from the station, it can accept or deny the robot's request - depending on whether or not another robot is currently seeking the station - and the robot must enter the correct state and wait until the station is available. Similarly, there are also states to ensure successful communication and negotiation between the robot and the station when the robot is in the act of either docking or leaving the station.
Once stable communication with the station has been established, the robot enters into the seeking states, where it uses a combination of the BOM and homing sensor to navigate its way to the charging station. In the BOM-seeking state, the robot converts the reading from the station's BOM-flash into the angular velocity it needs to turn towards the station. Once seeking with the BOM gets the robot within range of the beacons on the station, the Charging FSM moves into seeking with the homing sensor. The sensor, which is connected via the charge board, is an infrared detector that receives IR pulses from the emitted by two modulated IR LEDs (beacons) on the charging station. In this state, the charge board reads and sends this homing data over I2C to the Dragonfly, allowing the robot to adjust its alignment with the station accordingly. During all seeking, the Dragonfly monitors I2C packets coming in from the charge board so that it can stop once it successfully makes physical contact with the station.
When the robot reaches the station and begins charging, the Charging FSM moves into the charging state, which monitors I2C packets, looking for a contact error or a full battery. If the charge board senses an error, meaning that the robot has lost physical contact with the charging station, the robot begins seeking again in order to reacquire contact with the station. In the case of a full battery, the robot initiates the leaving sequence, where it backs out of the contacts and out of the way of any other robot seeking the station at the time.
Charging Station Management
Physically, the charging station is a set of bays, each one equipped with charging contacts mounted to fit securely to the charging pads on the robots. Each bay also has a seciton of BOM emitters and two homing beacons to be used by seeking robots. The wireless communication between the charging station and the robots operates within the established token ring topology - whenever a robot needs to talk with the charging station, it holds the token while waiting for a response before passing the token on to the next robot in the ring. In this implementation, the charging station itself does not become part of the token ring, and instead only talks over the wireless whenever a robot first initiates contact.
When the station receives a charge request from a robot, it first checks the bays to see if there are any free. If there are no free bays, the robot is denied, and it must wait for a bay to open up. If there is a bay open, however, the station will allocate that bay to the robot using the robot's ID number within the token ring. To avoid potential collisions and confusion, the station ensures that only one robot is ever seeking at one time. Accordingly, if there is already another robot seeking, the requesting robot must wait until the first robot has reached the station before beginning to navigate to its allocated bay. Whenever a robot arrives at or leaves the charging station, the station exchanges acknowledgments wirelessly and maintains information internally, allowing for proper management of its bays.
In order to minimize robot collisions, the station uses a bay allocation algorithm that assigns bays based on the amount of space to either side. That is, when a robot requests a charge, the station analyzes the state of each bay and attempts to assign that robot to the bay furthest away from any other occupied bay.
