Friday, January 9, 2009

Caleb Tricycle...Different Code...Same purpose....That worked....

Note: There is a picture of the code added to this post....
So before we get to the video, I thought that I would share a picture of what I did to help flatten out a crease in the black line track (which had caused me problems)...The books that are shown there are the books that I have been using to learn about the Lego Robot. That was done while I was on a short break from the studies. It did seem to make a difference.



Here is the video of the working code that was suggest by Baum.



Baum's idea of getting the Robot to follow the line was not to directly follow the black line but the edge of the line. This way the if the sensor got values for the black line, the robot could turn accordingly. Or if the sensor sent values for the white part of the track, it would then turn the other way.



Both of the programs, give me the same result but I did notice that with Baum's algorithm that Caleb Tricycle didn't swing as far out as with Knudsen's algorithm.

Another note...one of the things that I found interesting was that the Robot was still able to run its program, when it began to run off of the mat because the carpet was dark enough...This is at the end of the video.

I worked about 30 minutes organizing the Legos, so that I had a good idea of where to find different pieces.

Time worked since last post: 1 hour
Total for today: 4 hours 10 minutes
Overall: 18 hours 20 minutes

Caleb Tricycle...Different Code...Same purpose....Needs adjustment

So only showing the successful programming code, would be unfair to people...since that is not really real world. I have now have downloaded a piece of code into Caleb Tricycle that does not work...Here are the results.....



I believe that the reason for this problem has to do with the numbers that are used by the robot coming from the light sensor are not set right. Basically, I need to go back and work with Caleb Tricycle to try and achieve numbers that allow him to turn according to what the light sensor says.

Why is this being posted after the successful post about Caleb Tricycle? Because I read in the Baum book about a different algorithm to use for a line follower and decided to try it with my modified Knudsen design. So right now...He just likes to run straight a head.

A quick note about the downloading problem....I am wondering if I am having the problem because the computer is some how getting confused, when I am switching back and forth from remote desktop to directly on the desktop. Just a guess....the last two times I downloaded a program, I was able to download it without restarting the Computer.

Back to program to try and figure out the numbers.

Hours worked since last post: 1 hour 10 minutes
Total for today: 3 hours 10 minutes
Overall: 17 hours 20 minutes

Tricycle...Continued

After reading Baum's book on the design of his line follower, I decided to modify the design of the robot to help keep as much outside light from the sensor as possible this is what I came up with....


I lowered the Light sensor by using a flat Lego piece, I then surround the light sensor with other Legos making sure that they didn't have holes that would allow light in. If they did, I used another flat Lego to cover up the hole. The picture on the far left shows what I ended up using to block out the light, I had run out of the wrap around Lego pieces that I used in the right picture, because I had used one to let the light sensor point down. The picture in the middle is what it looked like before.

I followed the program that was set out in Knudsen's book. The numbers in this picture are not the numbers I ended up using with the program, I started out with the numbers that are given in the book. Then adjusted them as I saw when using a guided mode in the Programming environment.


I once again ran into a problem of getting the program to download to the RCX, this time I decided to restart the computer and make sure that the RCX was on near the beginning of bringing up the program on the machine. It then transferred just fine and allowed me to use a mode to test the code to find out numbers that I needed to be able to tell when the sensor was picking up dark verse light. I was also able download the program a couple of times in order make adjustments to the numbers.

After watching the program run on the Robot, I had the thought that his back wheel reminded me of a dog's tail. I decided then that I should adjust his name to Caleb Tricycle...since Caleb means dog. So here is Caleb Tricycle running...including running off of the mat with the black trail that it is following. The mat came with the Lego Set.


Hours worked today: 2 hours
Hours overall: 16 hours 10 minutes

Thursday, January 8, 2009

Second Robot: Tricycle built for Line Followin'

So after Success with the Bumper bug...I read some more in the books and saw what they had to say. I like the Knudsen book best, I think, because it does a good job of getting you active and then explaining higher concepts, behind design and mechanics of building good robots. So in reading some more from it in after building bumper bug, I found that it was repeating some of what I had already read in the introduction of the Baum book. I also looked at the Baum book on what they had to say on building a bumper robot (one that knows to back up and try a different direction). The concepts were pretty close to the same although they had taken a slightly different route making the bumper and also had example code in another programming environment, which I am planning on coming back to for my final project.


I then moved on to building a new robot....which meant that there was some slight sadness as bumper bug had to be dismantled, in order to get the RCX and other parts that I had used on it. I am once again in the Knudsen book, following their building and programming guide

Here is the what I am calling the Tricycle at one of his beginning stages:

He has gotten his free movin' leg attached, but no motors. The white wheel object is part of what was left at the time of bumper bug, it is connected to part of the base that I had taken the RCX unit off of and hadn't need to fully get into other of its parts.


What Tricycle looked like most of the time while being built, flat on his back. Or on the face of the RCX unit. I believe that he is in the same state as the above picture, only in a different angle. On a side note: I would like to bring your attention to the grey tool on the bottom right corner of picture, it is a tool that helps you take a part the lego bricks...Saving my fingers from great pain in the taking a part of creations.


He has now been given his "nose", where the light sensor will go and the motors that will provide the energy/turning motion for his wheels. The light sensor part is how Tricycle will be able to tell if he is on a black line or not.


Here is the finished product of building the Robot. The big wheels are in front of the motors (there is one directly across for the one in the picture). The light sensor is the blue brick. The black bricks on the RCX unit that have wires coming out of them is how the RCX communicates with the Light Sensor and the Motors.

I have started the programming processes for Tricycle in the computer and believe that I am almost done. With this program, Knudsen is directing me through using subroute in the programming in the Lego Environment. He also brought up a point in the programming section on this robot that I would like to mention and that was: you need to prepare for the worst. I think that I already knew this, because part of robotics is the need for the robot to be able to communicate with the world and the world is not a science labitory. So in programming this robot to follow a black line, we can't just assume that if he doesn't sense the line that he needs to turn the opsite way that he did before to find it because the line could be curved. Therefore in this program, we will use a timer in order for the robot to know when he needs to turn the other way to try and find the line again.

Time spent after last time logged: 3 hours
Total for Today: 4 hours 40 minutes
Overall: 14 hours 10 minutes

"Running Robot"



So for those of you who hear my voice very softly....I am simply talking to myself in the excitement of seeing the Robot move around or wondering at what it is doing.

The first object that he bumps into is my lunch bag, then he starts to go over to a wall but doesn't bump into it...turns and starts going underneath the table, which I was impressed that it got the right angle to be able to go between the feet. I then stopped the recording because it was headed to feet that it was going to run into and it was going backwards. What you don't get to see before I turned the robot off, was that after trying to push himself backwards, he then changed his direction and tried to go a different way.

I have now worked another 40 minutes for today, bring today's total to 1 hour and 40 minutes.
Overall: 11 hours 10 minutes

Excitement Abounds!!!!!

Great news....the program downloaded...at least everything showed that it downloaded....now to snap the robot's 2 large pieces together and test it out. :-D

Trouble Shooting......With more that should be coming later today....

So I worked for about 30 minutes this morning on trying to figure out what is going on, why I can't get the program to transfer to the RCX. To show some other readers out there, who are not familiar with the set up....


The yellow brick is the RCX unit shown in another the post. The black unit standing up, is the IR transimitter, which is hooked up to the computer. The connection that it uses is a 9-pin serial connection (My guess what be that new models of the Lego Robots are now coming with USB connection....to answer a question of how it connects to the computer....according to the help that is linked in the next paragraph).

In the sense of trying to figure out why stuff won't transfer, I have tried googling the error message and got what I felt was very little help.... Try inserting new batteries into the RCX unit.....So Right now...This is what my "built" robot looks like.....


Two large pieces....because the battery section is on the bottom of the RCX, which makes sense for the buttons need to go on top....but it is a pain to change batteries then once the robot is built.

When that didn't work yesterday, I took books home with me to see if I could figure anything out. While since the message that I was getting was about the IR transmitter, I thought that maybe it some how drained its battery and needed a new one. So that is where I started this morning: Changing the 9 volt battery. I also checked the computer to make sure that the Device Manger was showing the port working (it was) and then told it to check for a new driver update (nothing was out there that was better....according to Windows)

The good news is that I got the IR transmitter to transfer the firmware to the RCX (it had "disappeared" since the batteries must have been out of the RCX unit for longer than a minute). Evidence:


The green light that is showing is blinks and lights up when the IR transmitter is transmitting data.

The numbers keep adding one while the firmware is transferring.

And that is all the farther I have gotten so far, as I had to run and go do something for a couple of hours....I am now back and am going to try to convince the software on the computer, the IR transmitter and the RCX unit to all work together and transfer the program!

Time Worked So far today: 1 hour
Time worked over all: 10 hours 30 minutes

Blogger Templates by OurBlogTemplates.com 2007