Chapter 3: Programming
History of Programming Languages:
Levenez.com has a nice history of all programming languages
Robolab Video Trainer:
PSEUDO CODE (for all robotics):
Pseudo code is a way to state a program in a sentence form. You will be required to analyze some of the blocks and read the whole program in sentence form.
Say this program this way: Start program. Motors A and B, at power 5, will go forward for 10 seconds and then all output ports will stop for 2 seconds. Program end.
Basically, all programs will read block by block. Lets try another.
Say this program this way: Start program. When touch sensor is pressed 3 times, on port 1, motors A and B will go forward , at power 5, for 10 seconds and then all output ports will stop for 2 seconds. Program end.
Try the next two silently on your own and then with the teacher.
Hints: After start, there is a light sensor waiting for a light setting of 34 on port 1. Notice also power 2 setting on the motor. And, how about the 4 seconds after the motor. Did you also notice motor C instead of B?
Hints: Notice after the motor block the rotation sensor block on port 2 that is waiting for 100 rotations.
Inventor Icons: (print and glue to magnets, use on metal backed white board)
Activity:
Program a friend or your team mates:
Left leg represents motor A
Right leg represents motor B
Each full step is one second
Hands and arms can represent sensors
In sentence form, state what you want program to do and train your robot friend(s) to do the task
Start program. Motor A and B forward 4 seconds and stop. End program.
Start program. Motor A and B Backward 4 seconds and stop. End program.
Start program. Motor A forward 4 seconds and stop. End program.
You try the rest. Expand and make each more complicated. Use only the commands in Robolab.
Ask questions, look for ideas, or find troubleshooting tips:
ask Robohi <--- visit "For Educators" and look up topics (posts). There is more than one page of stuff. Make sure you are registered before trying to post something.
Work on this for day 8 ... (review everything learned thus far)
-------------------------------------------------------------------------------------------------------------
The thought process:
Teach students how to logically think out a problem to find a solution. It must include "if ... then ..." or "if ... else ..." statements. Start off with the novice then move up and see if the students can follow.
Simple exercise: logicchart.mov
Novice: Flow Chart
Intermediate: Flow Chart
Advanced: Flow Chart
Activity:
Create a flow chart of the following from what was previously learned.
Novice:
1. Problem: Navigate something to the office from any where on campus.
2. Include: Include 2 possible routes using "if ... then ..." statements.
Intermediate:
1. Problem: Navigate a simple maze.
2. Include: As many "if ... then ..." statements as it takes to get to the end of the maze. If the robot or thing navigating has no site, what happens if it gets in a corner? How will it find its way to the end and not the start? Your robot can only have 3 sensors max and two motors.
Advanced:
1. Problem: Navigate a room. The robot must somehow navigate the room and cover as much of the floor as possible with chairs and other obstacles in the way. You must keep the logic and programming short. Keep it simple as well.
2. Include: Everything you've learned from your flow chart knowledge you just learned. What patterns would you use to help your robot navigate? You may want to learn patterns the Roomba uses to do its job. Your robot can only have 3 sensors max and two motors.
Microsoft Robotics Studio: (optional)
More on programming: (Teachers, review each one before presenting and only use what you need to, if you are not sure, skip this section)
Robolab help through www.cipce.rpi.edu:
Robolab knowledge base by Tufts Robolab @ CEEO:
Engineers and Storyellers
Available programs from the www.lugnet.com (LEGO Users Group Network):
High Tech Kids.org has a bunch of FLL (First Lego League) strategic approaches to understanding a scenario and programming:
A little more advanced, but this Power Point presentation gives a good look at strategies in using Robolab:
Control & Communication Using ROBOLAB - Keith M. Johnson
Ask questions, look for ideas, or find troubleshooting tips:
ask Robohi <--- visit "For Educators" and look up topics (posts). There is more than one page of stuff. Make sure you are registered before trying to post something.
Work on this for day 9a ... (review everything learned thus far)
Tutorials on programming: (Teachers, please play every movie and note where this is as you will need to review these movies soon)
Setup on robolab:
Let's learn something about sensor blocks that wait for something to start the program:
Let's learn something about sensor blocks that use a switch (true or false, if ... then, while ... else, etc.):
Let's learn about jumps and loops:
Let's learn how to create a line follower:
Line follower (single light sensor)
Let's learn how to change the motor power:
Let's learn about containers:
Ask questions, look for ideas, or find troubleshooting tips:
ask Robohi <--- visit "For Educators" and look up topics (posts). There is more than one page of stuff. Make sure you are registered before trying to post something.
Work on this for day 9b ... (review everything learned thus far)
Can you figure out these examples?:
http://ecrp.uiuc.edu/v6n2/bers/figure1.jpg, what does this program do?
http://www.eduxe.sk/legomenu/robolab/texty/software_soubory/program1.jpg
What does this program do?
Mr. Laurie has a good example of Robolab's capabilities. Click on the picture and see a bigger version. Try and figure out what's going on. Write it down and break it apart to find out what this robot will do.
From meninhats.com, What does this program do? Click on the picture for a larger version.
http://lego.zschlebnice.sk/obr/sw_robolab_program.gif, What does this program do?
Interesting program example from cornell.edu.
From Buildityourself.com, What do you think this program will do?
Programming at a distance example from http://web.me.unr.edu/me151/spring_01/ecc_robolab_files/image007.jpg
Troubleshooting:
ask Robohi <--- visit "For Educators" and look up topics (posts). There is more than one page of stuff.










