- Standards
- Introduction to robotics and website requirements
- AutoCad 2
- Student Movie Files 4
- Rhino 3d student work
- All about gears
- Animations in 3d Rhino
- Your first robot
- Rubrics and Design Challenge page
- Safety Exam
- Advance Robotics
- Podcast
- Remote Control Tutorial
- HTML Code
- Rattlesnake bot
- Line Follower
- Parking Space
- Robotic Cockroach
- Proportional Control
- Follow the leader
- Platform 9 3/4
- Ramp Bot
- camstudio videos (T.E)
- Digital graphic organizer (T.E.)
- Robotics Safety information
- data log activities
- Engineering Design PowerPoint
- SUMO BOT
- Sumo bot PowerPoint
- Under-carriage inspection
- skype-controlled nxt robot
- Engineering with NI labview : High school robotics activities
- labview training CS2N
Following the Leader
By Jessica Noble
Tufts University Center for Engineering Education and Outreach
This lesson is part of the ROBOT CONTROL ACTIVITY SEQUENCE. For more activities in this sequence, see the Activity Sequences page on the Tufts CEEO project site.
Introduction
This lesson was designed to introduce the ultrasonic sensor and apply proportional control to assist a LEGO car in completing a task. We will design a robot that can maintain a constant distance between it and the car in front of it using a proportional controller.
Teaching Standards
Learning Opportunities:
In this lab students have the opportunity to understand the following:
1. How to create a system that controls movement to accomplish a goal
2. Ultrasonic Sensors
3. Filtering noise
4. Proportional Control
5. Computer programming
6. Electronics and motors
7. Dynamics
8. Team work and collaboration
Building and Programming Instructions
Building
Create a LEGO car with an ultrasonic sensor in the front, pointing forward, and a large, flat surface on the back. For extra effect, attach this flat surface to a touch sensor so you can sense when your car has been rear-ended. Tape a piece of white paper to this flat surface. Check out the video for an example robot.
Programming
1. Start with a while loop. Create a constant ("false") for the loop condition so that your program runs infinitely.
2. We are using an ultrasonic sensor to measure how far the car in front of ours is. We will control motors to keep our car at a specific distance value. Then, if the car in front moves forward, our car should move forward as well. Place a "Read Sensor" VI in the loop and select Read Ultrasonic from the drop-down menu on the VI. Right-click the Port input to create a constant. Wire the Distance output to a Subtract function. Then create a numeric control for the distance value you want to keep your car at, and subtract the sensor's distance value from this. Now, multiply it by a gain so you can adjust the response of your car. Use the block diagram image below as a guide to complete this step.
3. Add a Motor Control VI and wire the output of the Multiply into the Power of the Motor Control VI. Create a constant for the port and set it to Ports A & B. Use the drop-down menu to set the motors to turn in reverse.
You could load the code onto your car right now and have it work, but you may find that your car jumps forward unexpectedly. The ultrasonic sensor is noisy, and when it doesn't get a good reading, it defaults to its maximum value, 255. We can filter this out by adding a bit of logic. When the sensor reads 255, we want to use the value we used last time through the loop. Let’s add the logic.
4. Between the Sensor and the Subtract VIs, add a Case Structure. After the case structure, wire the blue distance reading to the right edge of the while loop. Right-click the tunnel and select "Replace with Shift Register." Now, on the left side of the while loop, wire the new shift register to the left edge of the case structure. Right-click the shift register to create a constant for this node, and make sure the value is "0."
5. Now, we need to compare the value from the sensor to 255. Add the "Equals?" function (NXT Programming-->Comparison) before the case structure, and wire the output to the Case Selector (green question mark). Wire the blue distance value from the Read Sensor to the bottom input, create a constant for the other input, and type "255" to set the value of the constant.
6. Now, let's think about what to do inside the case structure. When the value equals 255 (the "True" case), we want to use the value from last time. In the "True" case, wire the node from the shift register to the left, to the output node on the right. When the value does not equal 255 (the "False" case), we have a good reading, and want to use the value from the sensor. In the "False" case, wire the node from the sensor to the output node on the right.
Use the images below to create and check your code.
That's it! Target to the NXT bricks, load your program onto each brick, and go. The car in front should just be programmed to drive at a constant speed, and the cars behind follow, keeping a safe distance behind each other using the above program. Try adjusting the gain to get the best response for your car. What happens when you increase the gain? What happens when the car in front goes faster?
By Jessica Noble
Tufts University Center for Engineering Education and Outreach
This lesson is part of the ROBOT CONTROL ACTIVITY SEQUENCE. For more activities in this sequence, see the Activity Sequences page on the Tufts CEEO project site.
Introduction
This lesson was designed to introduce the ultrasonic sensor and apply proportional control to assist a LEGO car in completing a task. We will design a robot that can maintain a constant distance between it and the car in front of it using a proportional controller.
Teaching Standards
Learning Opportunities:
In this lab students have the opportunity to understand the following:
1. How to create a system that controls movement to accomplish a goal
2. Ultrasonic Sensors
3. Filtering noise
4. Proportional Control
5. Computer programming
6. Electronics and motors
7. Dynamics
8. Team work and collaboration
Building and Programming Instructions
Building
Create a LEGO car with an ultrasonic sensor in the front, pointing forward, and a large, flat surface on the back. For extra effect, attach this flat surface to a touch sensor so you can sense when your car has been rear-ended. Tape a piece of white paper to this flat surface. Check out the video for an example robot.
Programming
1. Start with a while loop. Create a constant ("false") for the loop condition so that your program runs infinitely.
2. We are using an ultrasonic sensor to measure how far the car in front of ours is. We will control motors to keep our car at a specific distance value. Then, if the car in front moves forward, our car should move forward as well. Place a "Read Sensor" VI in the loop and select Read Ultrasonic from the drop-down menu on the VI. Right-click the Port input to create a constant. Wire the Distance output to a Subtract function. Then create a numeric control for the distance value you want to keep your car at, and subtract the sensor's distance value from this. Now, multiply it by a gain so you can adjust the response of your car. Use the block diagram image below as a guide to complete this step.
3. Add a Motor Control VI and wire the output of the Multiply into the Power of the Motor Control VI. Create a constant for the port and set it to Ports A & B. Use the drop-down menu to set the motors to turn in reverse.
You could load the code onto your car right now and have it work, but you may find that your car jumps forward unexpectedly. The ultrasonic sensor is noisy, and when it doesn't get a good reading, it defaults to its maximum value, 255. We can filter this out by adding a bit of logic. When the sensor reads 255, we want to use the value we used last time through the loop. Let’s add the logic.
4. Between the Sensor and the Subtract VIs, add a Case Structure. After the case structure, wire the blue distance reading to the right edge of the while loop. Right-click the tunnel and select "Replace with Shift Register." Now, on the left side of the while loop, wire the new shift register to the left edge of the case structure. Right-click the shift register to create a constant for this node, and make sure the value is "0."
5. Now, we need to compare the value from the sensor to 255. Add the "Equals?" function (NXT Programming-->Comparison) before the case structure, and wire the output to the Case Selector (green question mark). Wire the blue distance value from the Read Sensor to the bottom input, create a constant for the other input, and type "255" to set the value of the constant.
6. Now, let's think about what to do inside the case structure. When the value equals 255 (the "True" case), we want to use the value from last time. In the "True" case, wire the node from the shift register to the left, to the output node on the right. When the value does not equal 255 (the "False" case), we have a good reading, and want to use the value from the sensor. In the "False" case, wire the node from the sensor to the output node on the right.
Use the images below to create and check your code.
That's it! Target to the NXT bricks, load your program onto each brick, and go. The car in front should just be programmed to drive at a constant speed, and the cars behind follow, keeping a safe distance behind each other using the above program. Try adjusting the gain to get the best response for your car. What happens when you increase the gain? What happens when the car in front goes faster?