Egr100
Fall 1999
Ileana Streinu
Doreen Weinberger
Lab 5
Topics
- A Tour of Lego MindStorms programming.
- How it works: multi-tasking versus sequential execution.
- Individual commands for:
- Controlling the motors: on/off, direction, power.
- Sound: beep, tone
- Counter: reset, add to counter
- Communication with another RSX: send to RSX, reset message
- Time: wait, reset timer
- Watchers: launch a program ("stack") when some event
happens. Events are triggered by
- Sensors: light sensor watcher, touch sensor watcher, etc.
- Counter: counter watcher. You can do something special when the
counter goes beyond a threshold, for instance.
- Timer: triggers a program when a certain amount of time has
passed. Can reset the timer afterwards.
- RSX: triggers a program when a message has been beamed-off
from another RSX. The messages have code numbers. For each code
number, or for a group of them, you can have a certain "stack"
(program) execute.
- Main program (stack): other than the watchers, which are
triggered by events, you can have
something executing all the time (no matter what).
- Stack Controllers
They can be used anywhere, either in the main program or in a
stack under the control of a sensor watcher.
- Choose: do one thing or another, depending on whether, at the
time the execution of the program gets there, a certain condition
is true or false.
- Repetition: to do things repetitively,
either a given number of times, or until a condition
happens. Repeat x times, Repeat forever, Repeat while (a sensor
condition is true), Wait until (a sensor condition becomes true).
- My Commands.
When you want to group things together, for instance some
sequence of commands that is done identically in various parts of
your
program, group them by creating a new command (yours!!). For
instance, you can create your piece of music to be played when
your robot bumps into a wall, receives a message from another
RSX, etc.
If time allows:
- Watch the
MIT
RoboRats
competition (video clip)
and some of the students
projects
- I will pass around the MindStorms challenges: RoboSports, Extreme
Creatures. You can choose some project from the book to do
next time. You can use the design in the booklet or improve it,
but the programming should be yours!
To do
This evening, you have several options to choose from. Only the first
two tasks are mandatory, the others are yours to choose from.
- Finish the path-following robot using the maze. You might
want to stick with a simple mechanical design and check your
programming carefully for logical errors. If all looks well, work
on calibration.
- Combination of maze path-following with obstacle detection,
using bumbers (touch sensors).
- A simple robot communication project: this is essentially a
programming exercise (a very useful one). Done by two teams
together. One RSX is the master, who sends encoded
commands to the slave RSX. When receiving the messages,
the slave can do several things (start, stop, sing, etc.).
To turn in
As usually, the two items of the weekly lab report. And enjoy the
break!
Last updated October 7, 1999.
Ileana Streinu