Group 1 Introduction to Intellegent Robotics CS 4970/5973 03/30/03 Project 2 - Robot Code Documentation Our robot "Bertha" managed to score no more than one point. However, we feel that the behavior we gave her was intellegent. The four main components of our code are input decoding, the two behavior, and the behavior sythesis. Input Decoding There were three types of input for Bertha, two touch sensors on the bumpers, three light sensors on the light tracking servo, and a range finder on the top servo. Because of the handyboard can't run more than four processes, the touch sensors were handled directly in the behavior synthesis function, arbitrate(). The code was simple. If either was triggered, Bertha would back up, turn away from the side that triggered the escape, and then return to normal operation. The three sensors on the light tracking servo had no active behavior assigned to them. Instead, they were checked by the light tracking behavior as required. The range finder was the key to avoiding obstacles, and therefore it ran continuously as defined in a seperate process. The code simply had the servo move from the far left to the far right and back in five degree increments, taking a reading at each of the 37 stops. As it took each reading, it would update the corresponding element in the range array. This data could then be used by the range finding behavior. Behaviors Both behaviors, the light tracking and the range finding, continually ran in seperate processes. Each process would look at the current situation and make a suggestion on which direction to go next. This could be one of seven choices: TURN_LEFT, DRIFT_LEFT, FORWARD, TURN_RIGHT, DRIFT_RIGHT, BACKUP, and STOP. Along with a direction, behaviors assign a priority level to their choice, from PRIOITY_LOW to PRIORITY_GOD. The light tracking behavior has two modes. The first occurs when Bertha doesn't have a lock on the light, meaning that all three of the light sensors don't register a bright enough light. When this happens, the behavior switches to PRIORITY_GOD to prevent the robot from taking any other action while it seeks out a light. It then sweeps the area with its light servo looking for a suitable light to track. If it finds one, the behavior returns to the tracking mode. If it does not, however, Bertha will spin 120 degrees and try again. If Bertha does not see a light after 4 such scans, this behavior supresses itself for ten seconds, allowing Bertha to roam and possibly get into a position that will find the light. If Bertha does have a lock on the light, it will update the servo to make sure the light stays in the center, and suggest a rotation toward the side the servo points to. The priority here is set to PIORITY_MED if the light is close, or PRIORITY_LOW if the light is far away, unless it is close to the 90 degree mark, in which case the priority is set to PRIORITY_HIGH. The range finding behavior takes the data from the sensor sweep, and uses a helper function is_obstacle_there() to determine if an object is close in one of five zones. If there are close objects, either straight ahead, or in the front corner zones, this behavior will look for the best open zone of the five, and try to head there, with priority set relative to how close the object is. Behavior Sythesis No fancy method of sythesis was attempted here. In this code, the behavior with the higher priority "won". In case of a tie, the range finding behavior won out. The idea of note in the final behavior was the addition of a "epilepsy attack." The idea here was that if Bertha had been going forward for an extended period, that something must be wrong and a brief course change would be beneficial. So as Bertha went forward for twenty seconds, an epilepsy count rose, and once it hit the defined limit, Bertha would turn briefly, and then continue as before.