Creepy
Hybrid
Part 2
By Alan Marconett
Last time, we discussed the mechanical aspects of Strider,
the “Creepy Hybrid” — a low-cost platform for exploring the
operation and construction of a legged robot. We’ve also got it
mostly assembled. This time, we’ll discuss how to program the
microcontroller and the servo controller board.
For Starters
For our learning experience, we will compile our own
“stripped down” and modified version of the Lynxmotion
(LM) AH3-R Basic program that will run on the BB2 board
with an Atom Basic module installed. The Atom module
sends serial commands to the SSC32 servo driver board.
For our own fully commented Creepy Hybrid control
program, check the SERVO website for downloads
( www.servomagazine.com).
Creepy Code
Our BASIC program will only use the joysticks of the
wireless PS2 controller and few — if any — of the buttons
as it is just intended to get us started. We made an effort
to minimize the code length in order to simplify the
program. Feel free to expand it!
The basic (no pun intended) tasks of our program can
be summarized:
44 SERVO 10.2009
•Read PS2 joystick (or a COM port).
•Interpret the joystick data into a “motion vector”
(which way we want to go).
•Calculate IK (Inverse Kinematics) for the leg moves.
•Move the legs.
Using some “canned” peripheral functions available in
Basic Micro’s Atom Basic makes it easy to read the PS2
interface from a joystick or a COM port. The shiftout and
shiftin commands you see first initialize the PS2 interface
for us (we want the joystick in analog mode) and then
allow us to read information from the joystick. We’re
primarily interested in the data from the right joystick.
This joystick will allow us to control or drive the robot
forward or backward, and make left or right turns.
But you knew that!
To keep this program similar to the original LM code so
that you can also start understanding it, I’m going to use
the same coordinate systems as the AH3-R Basic program
created by the free LM PowerPod utility. That is, X is