Wednesday, April 29, 2009

Day 2 of Obstacle Course

After last class, I stayed and worked on my program and robot. Now, Ive got my robot design with all the sensors attached but im having some stabilization issues with the wheels. I think if I add a rod to them, it should stabilize them. Program wise, ive got everything up until avoiding the obstacle. I think today, ill be able to get the basic programming down which will leave me with tweaking it next class. Im hoping to finish early to get a few extra bonus points.

Monday, April 27, 2009

Obstacle Course Challenge


Today we were given the assignment of completing an obstacle course using pretty much all of the sensors we have been studying about. It starts out on a line and you must clap to make it start.I will use a sound sensor for this part. It then moves forward and stops in a box for 5 seconds. For this section, I plan on using the light sensor to detect the edge of the box so my robot can be more accurate and always stop even if the robots starting distance changes. The next step is to bump into a pillar, back up, and turn right. For this, I plan on putting a touch sensor on the front of my robot which will detect the wall. I will turn down the power on my motor so the robot doesnt break when it hits the wall. It will hit it gently and then back up and turn right. The next section is to sense a desk but not touch it. After you sense it, you must turn right. For this I will use the ultrasonic sensor. An important consideration is to put the ultrasonic sensor in the front but behind the touch sensor so the touch sensor will be able to touch the wall in the previous step. The next part will probably be the hardest. It involves sensing a randomly placed object in the course and avoiding it. For this, I will use the ultrasonic sensor again and tell it to go right it it detects an object. After it goes right, I will tell it to go forward so i dont hit the object and then turn left and forward until the finish line which I will use a light sensor. I will tell the robot to stop once it senses the black line.

Chapter 11 and 12

Chapter 11 is about loop blocks. A loop block cant do anything on its own but when combined with other commands, it can save you a lot of time. To use the loop, simply place the loop into the program and drag the commands you want to repeat into the loop. At the bottom, where you change the setting of the loop box, you have 5 options. you can have the robot loop forever, loop until a sensor is pressed, loop for a certain amount of time, loop for count, and loop for logic. If you want more actions after the loop finishes, place them after the loop. If you select show counter, a data plug appears which tells other blocks the number of loops that block has done via a data wire. If the infinity button is selected, the loop will go forever. If you choose the sensor option, the loop will end when a sensor is activated. If you choose the count option, you can tell the loop how many times you want it to loop. If the logic option is selected, the program shows a data wire which can be connected to a logic block. The final part of chapter 11 is nested loops. Nested loops are useful if you want to loop something then have the program do something else then repeat all of it again. You can loop the loop essentially. Chapter 12 is about switch blocks. A switch block tells the robot to do one thing if a certain thing happens and another thing if it doesn't happen. This can be controlled by many of the same things as the loop block. A switch block also has the ability to do more than two things. If you deselect the flat view box from the switch, it will allow you to do more than two things based on reading from a sensor etc. These blocks should be very useful in our next challenge.

Thursday, April 23, 2009

Tyler's Field of View Experiment



This week in robotics class, weve been learning about the ultrasonic sensor. Its actually a pretty cool sensor that works kind of like a bat. It sends a high pitched sound out and it tells how far away the object is by how long it takes for the sound to bounce off the object and return. We did two investigations. The first one was just the basics of the ultrasonic sensor and seeing if different objects affected the way the sensor detected them. We found that the readings are a little inaccurate with soft objects because the sound is absorbed. If the object is too thin, the sensor cant read it, and also if the object is round, it can have a little bit of an effect on the way the sound bounces back. In the second investigation, we found out what the field of view of the sensor is. In this experiment, we put a robot on the line and moved around a can and marked the outline of where the sensor detected the object. This was useful to know the information but we had no way to peel up the floor and keep it in our notebooks so we made a scale model which fit on a piece of paper. The scale for the model to the real life thing was 1:5. My results were a little bit different than the expected results probably because there was something wrong with my sensor. I have included pictures of what it sopossed to look like (Hyoungmin's results in real life) and my results on the scale model.

Wednesday, April 15, 2009

Chapter 4: Reading Sensors

This chapter was all about the different sensors available for the NXT. The chapter starts out by saying the differences between the new NXT and the old NXT. On the new NXT, there are 4 sensor ports rather than 3 and it features a different cable which locks into place. The next part is about the touch sensor. It is the simplest sensor of all. Not much has changed from the old version except for the studless connections. The touch sensor can tell if its pressed, released or bumped. The most common use for the touch sensor is as a bumper. The bumper can be made to be open and then be pressed when it runs into something, or it can be closed all of the time and released when something presses it. The next sensor was the light sensor. The light sensor detects ambient light and measures its intensity. With this sensor, you must set a threshold for it to work properly. This was shown in previous blog posts. The light sensor can measure two different types of light, reflected light (from an emitted beam from the sensor), or ambient light. Using the reflected light, you can tell what color your robot is going over or how far away a color is from the sensor but not both at the same time. you can do this because different colors reflect different amounts of light. An application of ambient light that we did was line following. If you combine the light sensor with a lamp brick, you can make a photoelectric cell which can tell if the light is interrupted. The next sensor is the ultrasonic sensor. This sensor emits a high frequency ultrasonic sound which bounces off objects and is received again and the time taken for this to happen tells the sensor, how far an object is. An advantage of ultrasonic sensors is its ability to work in the dark. Using this sensor, you can tell the robot to stop or perform an action when it approaches something that is ______ inches/cm away. The last sensor is the rotation sensor. This sensor is built into the motor. With the motors in the NXT, they can detect when going over rough terrain. For example, if your NXT is going straight, and you press down on one of the wheels, that wheel will speed up to compensate. This is a new feature in the NXT.

Line Tracking

The past week we have been working with the light sensor. In these activities, our main goal was to be able to find a threshold using the light sensor, get the robot to follow a line using the light sensor, and finally to make it follow the line faster. To find the threshold for the black line and the white to the side of the line, we must go to the NXT view menu and select reflected light. We then get the two values for light and dark. From here, we add up the two values and divide that number by two. Our next task was to get the NXT to follow a line. To do this, we started by mounting the light sensor to the front of the robot. On the programming software, we used a switch block and we selected the light sensor option. The threshold was then entered into the box. The switch block tells the robot to do one thing if it sees a value above the threshold and another thing if it sees a value below the threshold. We put a loop block around this so this behavior would repeat infinitely. We wanted the robot to track the right side of the line so we programmed the robot in the switch block to go right when the robot sees a value below the threshold and left when the robot sees a value above the threshold. The robot slowly inches its way on the line. The power on the motors must also be turned down to make it track properly. This is what the next investigation fixed. The next investigation was all about making the robot track the line faster. In this investigation, the light sensor was put on the back of the robot which was closer to the wheels which meant that the robot didnt have to turn the sensor as far to get a reading. The program for this was almost the same except this time, the robot was going backwards rather than forwards so we set the motor blocks to go backwards. We did a calculation and it took only 73% of the time it would have taken if the sensor were mounted in the front.