Egghunt project

Page Modified on: 03/29/04

Home
Lab 1
Lab 3
Fire Fighter Project
Knight Rider Project
MCP Project
Egghunt project
Photo Gallery

 

Write up for the Egg Hunt contest.

What does it take to build a competitive robot for the Egg Hunt contest in less than two weeks?

    The task was to build a robot that will collect eggs. The robot has to fit into a 1’ x 1’ x 1’ cube. We could use all the sensors that are found in the lab. I had a base robot that had four motors and was a tried design. I had no major faults and the pros out weighted the cons. Pros: heavy duty, lots of power, traction, durable, excellent turning radius (0”). Cons were – it’s heavier than a two motor design, will draw more current – and the batteries might not last a long time. It is also a less efficient use of the allowed footprint.

The first problem was with the gearing – it was geared to low. It had great traction and power, but it had no speed.

    First step I changed the gearing on it. It gained speed and it still had a lot of torque and traction. Then I realized that the center of gravity was too high. The motors were mounted way over the wheels and the gearing. I rebuilt the whole chassis – moving the motors from the top to the same level as the wheels.

 

Before

 

After

    The next problem was ground clearance – it seemed that moving the motors down I reduced the ground clearance. I solved that problem by using plates on the bottom instead of full size legos. (One full size lego’s  height=about 3 plates).

    My robot’s base was ready – I had to design a claw or maw. I had to design something that would grab and hold the egg. Yet again I tried to make it as simple and durable as possible.

First I used a rubber band as a belt and a servo to make a maw that would close. The trick was that I had to invert the rotation from one side and transfer it to the other side. Turning the belt and making an 8 shape will do that. The problem was that it slipped and the I had to change the servo’s value to keep it closed. I thought of the competition and decided that I would be to unreliable. I used two 40 tooth gears side by side. One would be turned by a servo. The other will be turning in reverse. Now all I had to do is attach my claws to these gears and I had the claw ready.

Before

After

     So far I have used four motors and a servo motor. Two 40 tooth gears and two 24 tooth gears.

    My robot now drives and is able to pick up an egg.

 

    Next step is sensing the egg and picking up when and egg is inside the claw. I used an ET distance sensor for that. This sensor is mounted in front of the vehicle aimed down. The distance between the ground and the sensor will return a value around 70 – if an egg is present the value will drop to about 40. That was simple. The only problem is that the egg has to be inside an imaginary circle for the ET sensor to sense it.

I tried using a sonar but I did not like it for two reasons. The sonar is slower. Requires a large time delay and it is a bit unreliable.

My robot was able to sense if an egg was present, and was able to grab it and gold on to it.

    Next step is to make my robot drive in the arena. I built an arena for some extra credit. It is 6’x 10’ space made out of 2”x 4”beams. I used parts of the wall following program to make my robot drive around the arena. I used 3 more ET distance sensors. I like these ET distance sensors. They are fast and reliable. The only thing I have to make sure to be aware of it’s limitations it does not return linear values. The values will increase as distance gets smaller between the sensor and an object, but after a threshold is passed the values will start decreasing again.

I moved my sensors inside the robot, so even if it gets to close to a wall it will receive correct values.

    My robot randomly drives around the arena and is able to sense and grab an egg. It’s Friday night about 10:00 PM and I’m still here. Funny there are other people here too: Andrew who works on his robot Colin is here and the other Andrew is here too. I’m really impressed by his robot. He rewrote some drivers to work better with his camera. Really cool.

    All the feedback I receive from my robot is a displays set of numbers like how far is the left wall, right wall, object straight ahead – color of the egg etc or on the way home the intensity of the light for each sensor and the reading of the polarized sensor.

 

 

Light sensing

I used light sensing diodes and the light following program that I wrote several weeks ago and now my robot is able to find an egg randomly. Grab it and take it to light.

Nobody believes me that I can use the light sensing diodes in this contest. So I give in the pressure and build my own polarized light sensor. My first one is a disaster. My soldering technique is sloppy, I hot glued my hands to the lego piece. It’s another afternoon – I’m really mad – and alone in the lab. I have to take a break otherwise I would do something that I would regret tomorrow.

The next day…

I’m still trying to make two polarized light sensors to find my home or the opponent’s base. It is still not working correctly. Here is a picture of the one that is the best looking and functional:

 

Last night I implemented a function that would ram the opponent’s robot. It’s another ET sensor mounted on the back of my robot. Way above the 4” wall line. If it senses something close (it is not a wall) it will back up for 1 second and will most likely hit the other robot. I also designed a roll cage for this purpose.

This function had to be dropped when Professor Martin found out about it and made a new rule. No intentional damaging or jamming other robots. Bummer.

I’m back to using the light sensing diodes. I build one almost perfect polarized sensor. Now I need some kind of strategy to figure out my home base. This will be assigned randomly before every heat. I decided that plugging wires and sensors before every heat is not really practical and is also error prone. I use the knob() function on my handy board. This returns a value from 1 to 255 depending from position.

If it’s in position that return one (all the way to the right) then my home base is the horizontal polarized light and the opponent is the vertical. Otherwise it’s reversed.

 

Horizontal

Vertical

60

70

80

80-130

130

140

150

           

     The values returned by this polarized light sensor facing the closest goal starting from midfield.

I wrote a function that would decide which is my home goal. And it would take the eggs to it. No color sensing yet. It drops the eggs when it gets a really intense light. That is a problem if we replace the light bulbs to stronger ones. Also it has to line up almost perfectly with the lights.

I added a top hat sensor to detect the reflection of the floor or the arena. We used high gloss paper to line the goals. When that sensor’s value changed significantly that mean that I was at one of the bases and it was time to drop the eggs.

It works quite well.

My strategy right now is to find an egg randomly – grab it find the light head towards it. Check if it’s the correct polarization - compare to the values above. If the floor’s reflection has changed drop the egg. Back up find more eggs.

     

I used two more tophat sensors to find the color of the egg. If it is a black egg it is non reflective. It is flat black paint that absorbs infrared light. Will return a value higher that 200. If it is any other color it will reflect and will return a value less then 200. That is how I differentiate between different colors.

 

 

It works well because my claw draws the egg really close to the sensors. The problems I encountered were: sometimes when it picks up more than one egg the sensors return a “bad” reading and will take the two eggs into the opponent’s nest. That works when it grabs a black and blue egg. But sometimes it takes the two blue eggs into the opponent’s nest.

    I tested many times and the chance of taking a single wrong colored egg into the wrong nest is minimal. With two eggs there is a 20% chance that it will do the wrong thing – BUT it will almost never take a black egg home. It will work correctly except during the competition. Ha - ha.

 

    What went wrong during the contest – and what would I do differently

 

     I think knowing what I know now – I would do many things differently. I think 3 minutes time is long enough to collect at least 50% of the eggs. I would redesign my light finder program – I think it had to many stops and time delays in it. I think I can make the robot a lot smoother by removing some of those. Also my home finder needed more shielding. In the future I would use a lot more shielding. During the competition my robot got frequently “disoriented”. That was caused by an incorrect reading on the polarized sensor. In the indicated area below my polarized sensor’s readings were all over the place. My home finder worked correctly during all the trials in the lab – but they proved to be unreliable during the heats.

 

Horizontal

Vertical

60

70

80

80-130

130

140

150

Area of bad readings

     My design – would be changed. I would allow my robot to push eggs home. That would pose some risk, but learning what some other robots do - successfully is push as many eggs as possible – would probably improve my robot’s performance.

I would only use two motors – or I would redesign the four motor version robot to have more room in front. I would use the extra space to collect and hold more eggs to carry home. There was no real advantage to having four motors. There were no hills. There was no checking or ramming allowed. I did not provide full power to motors anyways. I ran them on about a 50 - 60 % power level.

    The claw – I think the claw was pretty good. The servo was a bit twitchy but no other complains. I would refine to algorithm so it detects how many eggs it caught. Then I would not run into the problem of taking two blue eggs into the opponent’s nets.

I would increase the power to the motors. That would speed up my robot.

    What if something goes wrong during a heat?

    I did all the developing and testing in the Robotics Lab room 306. The contest was held in a different room with different floor and a different light. I was nervous if my robot would work correctly in the new environment. Some of the numbers inside the functions needed to be adjusted to the current conditions, but overall it was a functional robot.

I did not implement a B brain. I did not feel the need to do that. I tested my robot – with sensors unplugged simulating some kind of sensor failure.    

    First I unplugged the ET sensor pointing straight ahead – the robot ran fine. It only got caught in corners. When I unplugged one of the side sensors the robot hit the walls. But it was strong enough to muscle itself free from the wall of the arena. So if any of the distance sensors fail the robot would work, but would bump into things and that would slow it down considerably.

When I unplugged the color sensors – the sensors that return a value above 200 if the color of the egg is black – it behaved the following way:

    If I picked up a single egg – the robot took it to the correct nest. Blue was taken home, black was taken to opponent’s nest. With two eggs it depended which egg was over the functioning sensor. With both sensors unplugged – the robot took all the eggs to the home base.   

    If one light sensor was unplugged. The robot was running around in the middle of the room – eventually getting closer to the light. With both light sensors unplugged it was a random wobble around the arena.

 

    Versions of programs

    I wrote 9 versions of the program. I ended up using version 7b for the contest. Version 1 was a robot that was just pushing eggs around. Version 2 was able to grab an egg and take it to light. Version 3 was an improved version of version 2. It was demonstrated during the open house. It had no polarized light sensing. Version 4 contained my first attempts to polarized light sensing. It was a failure. Version 5 had a different implementation of polarized light sensing. Version 5 did not work either. Version 6 is a developed version of version 3. I placed polarized sensors to cover the light seeking diodes. Another failure. Version 7 is developed from version 6. I removed the polarized sensors shielding the light sensing diodes and used two light sensing transistors to detect the intensity of the polarized light. This sensor returned values from 50-160 - varying from the least intense to the most intense light that is allowed through the polarized lens.

Version 8 was an attempt to make the robot a lot faster. I changed values to allow it to get closer to the wall. I also tried optimizing the search for eggs feature. I added randomization to the direction that the robot would take. It was as successful as I expected it to be.

Version 9 was another upgrade of version 7. If I had more time I would have completed functions like clean opponent’s nest. When there were about 30 seconds remaining from the heat – my robot was supposed to stop – head towards the opponent’s nest and take some eggs out. I also had a sorting function started. That function was supposed to go to my home nest and search for black eggs. Take them out or take them to the opponents.

Unfortunately I ran out of time. Living in the lab for two weeks was not long enough to implement all these functions.

    Conclusion:

    Building a robot was an enlightening experience. I learned a lot about my abilities. I know that I’m a better structural engineer than a programmer. In the first stage my robot had shock absorbers that traveled about 1” in case of rough terrain. All the ideas I had were geared towards using the torque advantage, ground clearance advantage and the ruggedness advantage were almost useless in the competition. There was no checking allowed, the floor was smooth and I think that limited – the creativity level on what one should do to successfully compete. I think next time having a hill or rough terrain would make the problem more lifelike and the competitors would have to put in more thought into the physical design of the robot.

 

 

 

Home | Lab 1 | Lab 3 | Fire Fighter Project | Knight Rider Project | MCP Project | Egghunt project | Photo Gallery