Simplicity is prerequisite for reliability.
– Edsger W. Dijkstra
Couple things to do today.
Part 0 – Warm Up
Technical Sketching Warm-up.
Part 1 – Karel the Robot Learns Java
Named after Karel Capek, the Czech playwright, Karel is a program (software and curriculum) designed by Stanford. Karel provides a basic introduction to the programming language we’ll be using for Robotics. In addition, Karel makes use of Eclipse, the same IDE we’ll be programming our robots in.
“Karel is a very simple robot living in a very simple world. By giving Karel a set of commands, you can direct it to perform certain tasks within its world. The process of specifying those commands is called programming. Initially, Karel understands only a very small number of predefined commands, but an important part of the programming process is teaching Karel new commands that extend its capabilities.”
-Eric Roberts of Stanford University
“Karel’s world is defined by streets running horizontally (east-west) and avenues running vertically (north-south). The intersection of a street and an avenue is called a corner. Karel can only be positioned on corners and must be facing one of the four standard compass directions (north, south, east, west). A sample Karel world is shown below. Here Karel is located at the corner of 1st Street and 1st Avenue, facing east.
Several other components of Karel’s world can be seen in this example. The object in front of Karel is a beeper. As described in Rich Pattis’s book, beepers are “plastic cones which emit a quiet beeping noise.” Karel can only detect a beeper if it is on the same corner. The solid lines in the diagram are walls. Walls serve as barriers within Karel’s world. Karel cannot walk through walls and must instead go around them. Karel’s world is always bounded by walls along the edges, but the world may have different dimensions depending on the specific problem Karel needs to solve.
What can Karel do?
When Karel is shipped from the factory, it responds to a very small set of commands:
move() Asks Karel to move forward one block. Karel cannot respond to a move() command if there is a wall blocking its way.
turnLeft() Asks Karel to rotate 90 degrees to the left (counterclockwise).
pickBeeper() Asks Karel to pick up one beeper from a corner and stores the beeper in its beeper bag, which can hold an infinite number of beepers. Karel cannot respond to a pickBeeper() command unless there is a beeper on the current corner.
putBeeper() Asks Karel to take a beeper from its beeper bag and put it down on the current corner. Karel cannot respond to a putBeeper() command unless there are beepers in its beeper bag.
The empty pair of parentheses that appears in each of these commands is part of the common syntax shared by Karel and Java and is used to specify the invocation of the command. Eventually, the programs you write will include additional information in the space between the parentheses, but such information is not part of the Karel’s primitive world. These parentheses will therefore be empty in standard Karel programs, but you must remember to include them nonetheless.
It is also important to recognize that several of these commands place restrictions on Karel’s activities. If Karel tries to do something illegal, such as moving through a wall or picking up a nonexistent beeper, an error condition occurs. At this point, Karel displays an error message and does not execute any remaining commands.”
-Eric Roberts of Stanford University
Part 2 – Lightbot, Pseudo Code, & Karel
Work on Lightbot 3 assignment to start understanding code.
Use the same principles of Pseudo Code and iteration from the Lightbot 3 Assignment to write a pseudo code for Karel. Program Karel to pick up the beeper in front of him, place a beeper in the top right corner, and go back to start. Keep in mind, on the applet, you only had four available commands:
You may only use those four commands in your pseudocode. Once you have it, test it, if you think its right, call me over and we’ll see how it looks.
Part 3 – Isaac Asimov
Look into Isaac Asimov. Tell me a bit about him.
Can you find what his big contribution was to Robotics?
Do we still use this today? Have we made any modifications to it (and if so, what are they)?
Part 4 – Research
Look into a bit about the origins of Robotics, and advancements or achievements pre-1950. Choose a topic to do a short research 1-2 page paper on (Let me know what it is).
-FlowChart Do Over
-Flow Charts and Catch Up
-Basic Commands to make a Sandwhich
-Robotics Simulation & Basic Behaviors