Lesson 2: Programming and Movement
Lesson 2: Programming and Movement
After students have completed their robots it is time to put them into action. Now is a good time to talk to your students about how robots work. Ask them abstract questions like "Will a robot always do what we tell them to?" The answer to that question is yes, but many students will think no. No seems like the correct answer because robots will have unintended actions, like going left when the programmer wants it to go right. But the reality is that robots take every command a user gives it and follows it through exactly, the errors come from problems in the commands humans give to robots. This concept may be too abstract for younger children but it really helps the older students understand how programming works.
Students who get done early or classes that have finished their robots but do not have time to do the entire programming lesson will find this challenge a good opportunity to learn how the robot moves before actually telling it to move with programming. Although some of the math involved may be beyond younger students.
Give your students a tape measure or a printed-out paper ruler, one with centimeters and inches would be best. Draw a tic mark on one of the wheels with a piece of chalk or place a piece of opaque tape on the wheel. Ask each team to find out how many full rotations of the wheel it would take for the robot to move 2 feet, or any arbitrary distance like the distance of the surface of a table. Students who have already learned about circumference can usually figure out that the distance around the wheel is the same as the distance the robot moves. Students who have never learned about circumference will need some assistance coming to this conclusion.
This challenge is very useful because it teaches students how the robot will be moving when programming begins. The robot is told how far to go in either Degrees or Rotations, both referring to how far the wheel moves. If they can equate 1 rotation to an exact distance they will come into the concept of programming in rotations easier.
NXT Programming is very easy to learn, but can be difficult to master. There are many things that can be done with the software, but for the sake of a simple lesson it is best to start with just moving the robot. This is done with simple movement blocks like the ones shown below.
Movement blocks come from the left side menu, the top button shown below
When you click on a movement block you will see a menu like the one below at the bottom of the screen. This menu lets you change the settings on each movement block. Port lets you chose which motor you are using. The convention is to have the two wheel-motors attached to Port B and Port C, leaving Port A for the robot's "Arm" motor. Direction is either Forward, Backward or Brake, and Steeling is simply choosing between left, right, or straight and how sharp the turn is. For steeling generally turning the slider all the way left or right will make a perfect Turn-on-a-dime turn.
The Power slider determines how much power is being put into the motor. For your wheel motors 75 is the normal speed, however the slider can be turned up to 100 for a faster movement or down to 50 for a slower movement. Going lower that 50 makes the motors too weak to move the wheels usually. Next Action tells the robot to either brake and hold position after the movement is done or to just let the motors go and coast.
Duration is the most important criterion for movement, and will require the most trial and error to determine. As said before duration can be measured in Rotations, but also can be measured in Degrees or Seconds. Starting with rotations is a good idea, especially if your students did the challenge at the beginning of the page. Even if your students know how long one rotation is it is still a good idea to do a demonstration for the entire class of how far 1 rotation is, and also how far 4 or 5 rotations is.
When your program is done click on the download button shown below. If everything goes right you should see a message saying download complete shortly afterward.
The best way to teach programming is to halt all building and get the attention of the entire class. Having a projector is a big help so students can see your example program as you make it. The best way for students to learn is to follow along with your example program and they try out trying to program the robot to move some arbitrary track. Going over all the points mentioned above about moving is a good idea, don't get too in depth with your presentation however, students will lose interest the longer they have LEGOs in front of them and aren't actually using them. Giving students around an hour to test out programming will help solidify what they have learned and will ready them for the next task.
Teacher, It Doesn't Work!
Programming issues are very common but usually easy to solve. A list of the most common programming mistakes and how to solve them can be found here.