Find the Egg
What at first sounded like an easy task...
Meet the Jedi

Daniella and Brittany : Master Jedi
Objective
Create a search pattern for Artoo, that will allow him to find random placement on the court. Then to utilize this position to find eggs. Once an egg is spotted, move to it, and capture it.
Search Pattern
My first chunk of code for this part was very complex, it involved the use of several different stopwatch segments, while loops, and was just begging to create errors. However, I revised this code to simply move around on a radius when the program is first initiated, and to follow this pattern until one of the create's bump sensors is triggered. Once a sensor is "bumped" the robot will back up 250 mm and rotate in a circle while detecting eggs. If no egg is detected after one revolution, the robot will restart the cycle.
Debugging
Debugging--so important. Throughout my 40 plus hours on this project, I learned the importance of using debugging tools. I relied heavily on the cricket display to show values such as servo poisition, distance sensor, and to display the values of mathematical functions I created. This method was extremely effective, but nothing can really take the place of tools like beeps and leds. I used beeps to signify when the robot was detecting an egg, and I used leds to show when the create had moved to a new section of code and to make sure the create was on/off.
Creating Artoo

Obstacles to Overcome
To make it simple, there were many obstacles I had to overcome. My biggest stuggle was getting the ball to detect the eggs. I had to spend a lot of time playing with the long range distance sensor and its values before I realized that the values begin to lose their accuracy when they attempt to detect values more that 50 cm away. I just assumed that because they were suppose to detect values between 10 cm and 80 cm that all the values would be accurate. I also placed my distance sensor to close to where the egg was going to be captured, I put it within the 10 cm range it needed. So I had to redesign my contraption to push the sensor further back into the cargo bay.
This isn't the only time I had to redesign my robot's contraption. I also made it have these really long arms extending from the back of the cargo bay, and although they looked really cool, they were unneccesary and ended up causing more problems to my code. First of all, they made it really hard to attach things, like bump sensors, to the ends because all my wires had to sodered and they would squish up against the walls and begin to break if they hit the wall at certain angles.
Another huge problem I had, was when I had to fully functional, seperate codes. I made two codes that were incompatible and I had a really hard time getting them to fit. Although I ended up just readjusting everything, making functions made it a lot easier to incorporate my partners code into mine, as well as making it easier to find and eliminate errors.
Lessons Learned
- how to use servos
- better debugging tools
- the fuzzy way some devices work (distance sensors)
- how to use functions properly
- the importance of the KISS principle
- that a robot project can take over 40 hours...
The reason it's worth it...
