Recently I purchased a QuadCrawler (as well as a HexCrawler and Nomad) with
the hope of developing some behavior-based software for these very cool
machines. Unfortunately most of the Basic Stamp's resources are used just
to control the sequencing of the servos. There was very little left in the
way of memory or CPU cycles for my software. To remove this load from the
Stamp I ported the walking code to C and burned it into a PIC
microcontroller (what I call a GaitPIC). Now the Basic Stamp has only to
send simple walk commands (forward, back, spin left, etc.) via a serial line
to the GaitPIC. The GaitPIC will then handle all the servo sequencing and
sends the necessary serial commands to the Parallax Servo Control (PSC).
To further reduce the load off the Stamp I built what I call a Robot Sensor
Array (RSA). This consists of 3 PIC processors that provide left/right
proximity detection, run the Ping and S3 scanner, and cliff detection. I'll
save discussion of the RSA for another post.
I choose the 16F688 from Microchip for the GaitPIC. It only has 14 pins, 2K
of program memory, an internal 8 MHz oscillator, and most importantly a
built-in UART for serial communication to the Basic Stamp and the PSC. The
entire GaitPIC consists of only this one part. Looking at the schematic
(GaitPIC-Quad-Schematic.jpg) you can see that the Stamp is connected to the
RX pin and the TX pin is connected to the PSC. In addition there is an All
Stop pin so the Stamp can issues an immediate emergency stop (Danger!, Will
Robinson) and a Busy output indicating that the current walk command is in
progress. I used the breadboard section of the BOE to wire in the GaitPIC
(GaitPIC-Quad.jpg) and in the future I may give it a more permanent home on
a circuit board mounted above the PSC.
The serial communications from the Basic Stamp to the GaitPIC is simple. The
command is in the following format:
!w XX YY 0xFF
!w is the walk command
XX = Gait
0 = Stop
1 = Spin Left
2 = Spin Right
3 = Fast Forward
4 = Fast Left
5 = Fast Right
6 = Forward
7 = Left
8 = Right
9 = Back
10 = Back Left
11 = Back Right
12 = Fast Back
13 = Fast Back Left
14 = Fast Back Right
YY = Count - The number of times you wish the gait to be repeated. (1-253 or
254 for continuous)
0xFF - End of command
There is a special command for centering the legs.
!c X YYY 0xFF
X = leg number (1-4)
YYY = position value where 750 is the typical center value.
Once you have centered a leg the value is saved in the GaitPIC's EEPROM.
I've included a Basic Stamp program (GaitPIC-Tune.bsp) that allows you set
the center for each leg (1-4).
I also included a test program (GaitPIC-Test.bsp) that you can use to test
the GaitPIC and can use it as an example on how communicate with it from the>
If you wish to program your own GaitPIC I've included the C source file
(GaitPIC-Quad.C). I used the PCM compiler from CCS. I also included the HEX
file (GaitPIC-Quad.HEX) if you don't want to deal with the source.
I currently have a working version for the HexCrawler which I will publish
if anyone is interested and I'm just starting to work on a GaitPIC for my
I hope this has been useful and would like to hear any comments or
suggestions to take this project further.