A MIPS Programmable Robot Simulator
Craig Zilles
Assistant Professor, Computer
Sciences Department, University of Illinois at Urbana-Champaign
spimBOT is an extension of the spim MIPS
assembler/simulator that allows MIPS programs to control spimBOT, a
virtual robot. Programs interact through collection of memory-mapped
I/O devices to sense the virtual world and control the spimBOT's
actions to accomplish a desired task. spimBOT and its virtual world
can be graphically displayed using X windows.
spimBOT was developed as an educational tool with the following goals in mind:
- Provide a context in which students can write code that interacts with I/O devices and responds to interrupts.
- Provide more open-ended programming assignments where students must devise the appropriate strategy, as well as a correctly coded algorithm.
- Use competition to motivate students to spend "time on task".
To achieve these goals, spimBOT extends spim in the following ways:
- concurrent with MIPS program execution, the program models the actions of the virtual robot, providing interrupts and sensor values that are functions of the simulated environment.
- the virtual environment can be configured to present new tasks.
- spim's use of global variables has been tempered, to allow multiple instances of the simulator to co-exist in the same thread, allowing multiple robots to compete in the same virtual environment.
The figure shown at the
right, was from our Spring 2004 spimBOT contest. The goal of the
contest was to collect more tokens than your competitor. The two
robots and the 15 tokens are initially placed somewhat randomly. A
robot can pick up tokens by simply driving over them, but neither
robot initially knows where the tokens are located. To detect tokens,
the robots must perform "scans" (the colored hatched areas). The
programs set the size and center of the scan and when the scan is
complete (in an amount of time proportional with the area scanned plus
a constant) the scanner interrupts the program, providing a tree-like
data structure that must be searched to identify the token locations
in the scan area. Once the locations of the tokens are known, the
robots can simply drive to the tokens and pick them up.
The contest was designed to require students to manage a certain
amount of concurrency in order to write competitive programs.
Because both scans and the tree traversals have a non-trivial latency,
the best designs were pipelined; the robot was simultaneously scanning
one region, traversing the tree for a second, and collecting tokens
for a third. The size of the region scanned was a trade-off between
the time it took to fill the pipeline (which prefers smaller scans)
with the time to scan the whole screen (which prefers larger scans
because scan time is a constant plus a function of the area scanned).
Download the software
Copyright
spimBOT is copyrighted by Craig Zilles and distributed under the
following conditions:
- You may make copies of spimBOT for your own use and modify those
copies.
- All copies of spimBOT must retain my name and copyright notice.
- You may not sell spimBOT or distribute spimBOT in conjunction with
a commercial product or service without the expressed written consent of Craig Zilles.
Furthermore, because spimBOT is a derived work, spim's
copyright still applies. spim is copyrighted by James R. Larus and distributed under the
following conditions:
- You may make copies of spim for your own use and modify those
copies.
- All copies of spim must retain my name and copyright notice.
- You may not sell spim or distribute spim in conjunction with
a commercial product or service without the expressed written consent of James
Larus.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgements
This material is based upon work supported by the National Science
Foundation under CAREER Grant No. 0347260. Any opinions, findings, and
conclusions or recommendations expressed in this material are those of
the author(s) and do not necessarily reflect the views of the National
Science Foundation.