8. Scenario: (30)
It is the year 2010. It is your birthday and one of your presents is a brand new
programmable robot assistant. It can do everything you instruct it do. You can even
learn it to do tasks comprising of a number of instructions. The first task you have
decided to teach it is to fetch mail.
The following are objects, which it knows, either by factory programming or through
pictures you programmed into its memory:
Hand
Couch
Table
Front door
Door handle
Front gate
Mailbox
Mailbox door
Mail
Your robot can automatically determine whether an object (like a door) is open or closed.
It is however up to you to test this in the tasks you give it.
To ensure that your robot is always safe and close by, you have decided to let it sit on the
couch whenever inactive. Thus you have to start every task from this position.
Remember also to always bring your robot back to this position when a task is finished.
Your robot is programmed to use its right hand as default. If you want to do something
with its left, you must specify “left hand”.
Your robot understands the following commands:
SIT DOWN / STAND UP
WALK TO [object]
PUT HAND ON [object]
TAKE HAND OFF [object]
PUSH UP/DOWN
OPEN/CLOSE [object]
MOVE INSIDE/OUTSIDE
Your robot has only one flow statement, which you can use in the commands you give it:
IF [condition] THEN
{statements}
END IF
For your robot to fetch the mail, it must pass the front door, go out at the front gate to
the mailbox, fetch the mail and put it on the table. The front door is usually left open
for fresh air in the house, but it sometimes shuts due to strong wind. For safety reasons
and to keep the dog from running into the street where it can be run over by cars, the
front gate must be closed every time a person or your robot enters or exits.
Write an algorithm for the robot to fetch the mail. Start your algorithm with “task fetch
mail” and end it with “end task”