Brian Bentow - Yu-min Kim - Joshua Lewis
For our final second semester project we programmed the AIBO to find its pink ball and dive kick it towards the goal. View Code. View Video (WMV). View Short Video (AVI).
We had to add a new class of "yellow" colors for goal recognition in addition to the already defined "pink" for ball recognition. This shouldn't have been too hard, but we had to do it a few times to get it right. Once we got it working the dog was able to classify the goal really well, but we still had a minimum pixel count policy for the goal objects, since there was some noise from the AIBO pen's surroundings.
We improved our ball search behavior in two ways. First, we looked up and down while searching, in order to avoid missing really close and really far away balls. Second, we lowered the neck angle, so that we'd be able to see balls that were right next to the AIBO more easily.
Initially we copied over our ball approach code from our Follow Ball behavior. However, in order to do a good job kicking the ball we needed to be a little bit more sure of our orientation and distance relative to the ball. We implemented several changes in the ball following behavior with this goal in mind. First, we judged our distance from the ball not by the noisy pixel count metric, but rather by the vertical angle of the head when the dog is looking straight at the ball. Second, we made the range of satisfied head positions along the horizontal axis tighter, and introduced a sidestep motion when the head was near but not in the satisfied range. Third, we made slight adjustments to how the forward speed was calculated.
The second and third changes were worthwhile, but the first ended up being problematic. The gradations in vertical head angle were not fine enough to make good predictions about where the ball was. We ended up reverting to a souped up pixel count approach that guaranteed we'd get a little closer to the ball than the threshold, and thus we wouldn't have weird border states (normally).
Unlike the follow ball behavior, which simply stopps moving when it reaches a satisfying position with respect to the ball, the Score Goal behavior attempts to then find the goal. To accomplish this, the dog rotates around the ball, looking up and down, keeping track of both the last known position of the ball and the last known position of the goal. Once the two positions line up within a certain threshold, the dog goes into its kicking state.
Rotating around the ball was not trivial however. Theoretically we could find the appropriate angular and y axis (right to left) velocities that would result in the AIBO moving in a perfect circle. Of course odometric error issues make that impossible, so we have to somehow correct our motion. Additionally, a simple rotating state wouldn't be able to compensate for ball movement or disappearance. In keeping with our "ball centric" view of the world, we decided to constantly correct our position based on the observed characteristics of the ball. To this end, we set the dog at a constant y axis velocity and then adjusted the angular and x axis velocities based on where the dog saw the ball going. After a little tweaking this worked really well, and allowed the dog to trace out a pretty good orbit around the ball as well as compensate for unexpected ball movement.
For one final tweak, we caused the dog to rotate for another half second before kicking the ball since we noticed that its kicks had a slight bias to go left.
The kicking state was the easiest state to implement. It basically says: walk towards the ball for a little bit, then kick it, then hope you score a goal.