Академический Документы
Профессиональный Документы
Культура Документы
By: Maleko Bravo Hanan Kashkoul Alejandro Martinez John Mayen John Ong Malissa Rodriguez #304 #312 #316 #317 #322 #326
Project Lead the Way: Principles of Engineering Period 3 February 21, 2014
Table of Contents
Section Page
Design Brief Final Pictures Final Code Hanans Reflection Questions Alejandros Reflection Questions John Mayens Reflection Questions Malissas Reflection Questions Malekos Reflection Questions John Ongs Reflection Questions
1 2-3 4-6 7 - 10 11 - 14 15 - 17 18 - 19 20 - 23 24 - 26
Design Brief
Client: Elevator Company Designers: Maleko Bravo, Hanan Kashkoul, Alejandro Martinez, John Mayen, John Ong, Malissa Rodriguez Problem Statement: A company would like to begin producing residential elevators. Your team must design the control system and a prototype of an elevator that can go between four floors in any combination. The prototype must include a set of four switches to represent each floor of the elevator. Each floor the elevator stops at, must have a call button and a set of four lights to indicate where the elevator is currently located. A built-in safety mechanism requires that the elevator normally rest on the ground floor and return to the ground floor after a user determined period of non-use. Design Statement: Design and build an elevator that meets the given constraints and satisfies the companys requirements. Constraints: 1. Must be able to go between four floors in any combination. 2. Must include a set of four switches to represent each floor. 3. Must have a call button. 4. Must have a set of four lights to indicate where the elevator is currently located.
Figure 2
Figure 3
Description of Pictures
In Figure 1, you have our elevator. In the elevator, there are many different sensors that make the elevator function the way it does. For example, you have four
Final Code
In this code, you have a preset destination of where the four floors are. The ultrasonic sensor sees and knows where those floors are because it has a cone field of vision. This is also why our code sometimes has issues. Because the sensor has a cone field of vision, the sensor picks up the chain, which causes some problems because now the sensor lost its train of thought, and it cannot figure out where the distance of the floor is. In our elevator, we have two towers, each with two 369 motors. We designed the elevator in a way that the one motor will run counterclockwise while the other motor runs clockwise. In our code, we have if statements and what happens is that if the bump switch for the first floor is pressed, and when it is pressed we know that the value is one, one motor will run clockwise and the other motor will run counterclockwise, which will raise the platform to the preset destination, which is the first floor. This is the same process if the platform is at the base level. Consequently, if the elevator is on the base floor and the button for the third floor is pressed, then the platform will rise to the third floor. This applies to all of the bump switches when the platform is on the base floor. However, if the platform is on the fourth floor and the bump switch for the second floor is pressed, then the motor that is going clockwise will go counterclockwise, and the motor that is going counterclockwise will go clockwise; in turn, the platform will go to the preset distance where the second floor is, in order for the platform to go to the second floor. This idea applies with any other floor.
Reflection Questions
#1. task main() { startMotor(RightMotor, 63); startMotor(LeftMotor, 63); wait(4); } #2. task main() { startMotor(RightMotor, 63); wait(4); stopMotor(RightMotor); } Complex behavior examples:
Alejandro Martinez Name 3 analog and 3 digital sensors. Explain each in detail (how each works, what port they would plug in to, what the input/output would be, etc) 1. One analog sensor includes the potentiometer. The potentiometer works by measuring the rotation of a shaft between 0 and 265 degrees. The potentiometer can determine the position and direction. You would plug in the potentiometer into an analog port in the cortex. The input would be a range where you tell the code how many times you want to turn. A digital sensor it the quadrature shaft encoder. It is a digital counting sensor. It has a shaft that is inserted into the
You can see that here you have a complex code that is composed of several other basic and simple behaviors. The code has commands that are basic such as turning on the right motor and half speed counter clockwise. These are the 3 types of behaviors. Describe/Explain while loops in great detail. 4. While loops allow a section or part of a code to be repeated as long as a specific condition it true. In a while loop there are three main parts to it. You need the word while, you need the condition, and lastly you need the command or commands that you want to be repeated. The condition in a while loop is in control of how long or how many times the while loop is repeated. For example, if the condition is correct the while loop will repeat but if the condition in invalid or false then the while loop stops and the rest of the code continues. Curly braces are extremely important in a while loop. The command or commands between the curly braces will repeat as long as the condition in correct or true. When handling while loops you have to consider boolean logic. The decisions you tell the code are based on questions. There are only two answers in the code yes or no. A decision breaker when deciding what statement to use is that a while loop is more flexible than an until statement.
John Mayen
Malissa Rodriguez Name three analog and three digital sensors. Explain each in detail (how each works, what port they would plug into, what input/output would be, etc) 1.The three digital sensors include the light sensor, potentiometer, and line follower. Three analog sensors include bumper switch, limit switch, and lastly ultrasonic range finder. One digital sensor is the Bumper Switch. The bumper switch has a grey button, that when it is pressed, it makes the robot respond as it was programmed and expected to do. It does this by maintaining a high signal on its sensor port, which means the bumper switch is turned off when not pressed and turns on when pressed. While the bump switch is pressed, the signal changes to low, which tells the robot that the switch has been triggered on, the bumper switch remains turned on until the button is longer being pressed. The inputs and outputs of the bumper switch are 1 to 0. Another digital sensor is a potentiometer measures the rotation of a shaft between 0 and ~265 degrees. If only two terminals are used, one end and the wiper, it acts as a variable resistor or rheostat. A potentiometer measuring instrument is essentially a voltage divider used for measuring electric potential (voltage); the component is an implementation of the same principle. Describe the cortex in detail (the purpose, the ports, the connections, etc 2.The VEX Cortex Microcontroller is basically one of the main parts of the machine and has a huge role in controlling what the machine does. The cortex has twelve digital ports for the digital sensors and has eight analog ports for the analog sensors, and also has ten motor ports. The cortex is basically the center of the code and the actual machine and information. The purpose of the cortex is to deliver the information from the code to the ports, to help transfer information or a demand to the machine, to make it move and work, and also controlling each part of the machine. There are three types of behaviors. List and describe each. Then, give 2 examples of actual code for each of the three behaviors 3.There are three different types of behaviors. A behavior is basically what the robot is doing. The three types of behaviors are simple, basic, and complex. A simple behavior is a basic behavior with some sort of requirement for a sensor value or some other condition to begin. A
Maleko Bravo 1. There are different kinds of sensors such as digital and analog sensors. For example, three different types of digital sensors are a bumper switch, limit switch, and optical shaft encoder. Another example of three different analog sensors are a light sensor, a line follower, and a potentiometer. In digital sensors, there are only two different values that you can get, either 1 or 0. 1 represents when it is true or on, for example when a bumper switch is being pressed, it gives out a 1 value. In contrast, 0 represents when it is not true or on, for example, when the bumper switch is not being pressed, it is not on. In analog sensors, the outputs range in different numbers compared to just having two outputs. For example, light sensors range from 0 to 4095. When you have a black object in front of a light sensor, you will get a number close to 4095 because it is sensing darkness compared to a huge amount of light. When you put a white object in front of the light sensor, you will get a lower value range closer to 0 because it is sensing more light compared to the black object. First for digital sensors, I will explain a bumper switch. As explained before, digital sensors can only have two different outputs of either 1 or 0. When it is 1, that means that it is giving out a value of a true statement meaning that the bumper switch is being pressed. The other output that a bumper switch can get is a 0. In a 0, that means that it is giving out a value of false or off statements meaning that the bumper switch is not being pressed. This rule is the same for a limit switch. Digital sensors can only have two different outputs of either 1 or 0. When it is 1, that means that it is giving out a value of a true statement meaning that the limit switch is being pressed. The other output that a bumper switch can get is a 0. In a 0, that means that it is giving out a value of false or off statements meaning that the bumper switch is not being pressed. The last example of a digital sensor is optical shaft encoder. An optical shaft encoder can measure both the position and direction of rotation of a VEX shaft. This allows you to calculate the speed of the shaft, as well as the distance it has traveled, which can be very useful measurements for autonomous programming. It works by shining light onto the edge of a disk outfitted with evenly spaced slits around the circumference. As the disk spins, light passes through the slits and is blocked by the opaque spaces between the slits. The encoder then detects how many slits have had light shine through, and in which direction the disk is spinning.An optical shaft encoder is a digital sensor because it counts 360 times to create a revolution. It counts either up or down meaning that it can be a positive (up) or negative value (down). Then, I will explain the analog sensors. I will first start with a light sensor. As I said previously, you get a
4. Robot programmers commonly use while loops because it allows a certain part of the code to repeat itself until the statement is false. While loops are when the code function is true, it repeats itself until the function turns false. When making this on ROBOTC, you need the while with the statement that you want either being true or false and the semi colons. Semi colons are one of the most important parts of a code because that ends the simple behavior of the code. The while loop controls how long and how many times that the code can be repeated. For example, the code will not repeat if it is invalid, but it will
John Ong 1.) One digital sensor that we use is the bump switch. In our elevator we use it as a call button. What this switch does is it gives us 0 or 1 output values which tells the computer when it is pressed. It plugs into the digital slot on the cortex. When pressed it activates the program that lifts the platform to that switchs corresponding floor. Another digital sensor is the limit switch. This switch works very similar to the bump switch. It gives an output of 0 or 1 or yes or no outputs. These outputs tell the computer whether the switch has been activated or not.
StopMotor(Rightmotor); } The next type of behavior is simple behavior. Simple behaviors allow the robot to do simple tasks. These simple tasks can then be used in more complex codes to complete even more complicated tasks. Examples of simple behavior code would be:
The third type of behavior is complex. Complex behavior is a longer more complicated code that is made up of various combinations of simple and basic behaviors. These behaviors also include while loops and if and else commands. Here are some examples: As you can see in this complex code that is using a while loop, the program consists of simple behaviors like setting the motor to a certain speed when true.
This is another example of complex code. It is just a single behavior made up of shorter simple behaviors. The simple behaviors would be setting the motors to turn on at different speeds. Although as we can see in the pseudo code that the whole behavior is the robot going straight ahead, turning left and then stopping which is a lot more complex of a behavior that the simple behaviors that make it up. 4.) What a while loop is, is a program that is run continuously over and over if a specific condition is met. The way code works is it is read top to bottom until the end of the program. The while command will be placed before the behavior so that the computer reads while first and knows that if the condition is met it then goes on to read the code below it. What a while loop does is that once a predetermined condition is met or the condition is true, it repeats the code that is in the curly brackets under the while command. Depending on how long the condition is true will determine how long the program within the while loop will be repeated. Once that condition is no longer true then the computer will stop repeating the while loop and continue on reading down the rest of the program.