Submitted by Steve Norris

PIC-based Walking Engine Quick Overview

Nomad Project Video (Quick Time) - More to come!

Projects

Hexor (Simon B)
A PIC-based Walking Engine for the QuadCrawler (Steve Norris)
Block Sorter (Brian Bovaird)

My HexCrawler is configured with a Basic Stamp BS2p for its main processor. To unload most of the workload of the Stamp, I programmed a PIC 16F688 to talk with the PSC and control the qait sequencing of the servos. The Stamp only has to issue simple serial commands like forward or spin right in order to move. To further reduce the load off the Stamp I built what I call a Robot Sensor Array (RSA). This consists of 3 PIC processors the provide left/right proximity detection, run the Ping and S3 scanner, and cliff detection. The Stamp only has to scan a few binary lines to detect left, right, front and danger.

The QuadCrawler also uses a BS2p, a PIC to control gait and a simpler version of the RSA.

HexCrawler QuadCrawler

A PIC-based Walking Engine for the QuadCrawler

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

Where:
!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> Stamp.

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 Nomad.

I hope this has been useful and would like to hear any comments or suggestions to take this project further.