The Complete Hexapod 2 Tutorial

Last modified by Eric Nantel on 2024/07/03 09:20

The Complete Hexapod 2 Tutorial. Updated 01/26/2007

Hardware:
  - SSC-32
  - Bot Board / BASIC Atom 28
  - PS2 Cable / PS2 Wireless Controller (Not included)
  - Extreme Hexapod 2
  - L5 / L6 Arm (Optional)
  - Sharp GP2D12 Sensor (Optional, see text)

Software:
  - LynxTerm (download)
  - Basic Micro Atom IDE ver 2.2.1.1
    - Note, if your Basic Atom chip has a "Rev-D" label on the bottom, you must use IDE v5.3.1.3.
  - Hexapod Programs
   > h2prog1.zip RC.
   > h2prog2.zip RC.
   > h2prog3.zip RC.
   > h2prog4.zip RC.
   > h2l56p5.zip RC.
   > h2prog6.zip RC.
   > h2prog7.zip Autonomous!

Resources:
  - Wiring Schematic (wd001.gif)
  - Wiring Schematic (h2l56wd.gif)

Goal:
  - Install, program, and test the electronics to operate a Hexapod 2 with optional L5/L6 arm from a Lynxmotion, MadCatz, Pelican, or Hiteck wireless controller.


Image of Hexapod 2.

 

 
Step 1.
Install the Bot Board and SSC-32 onto the top of the robot as shown.

Figure 1.

Step 2.
Connect power wires for the servos as illustrated. Click on Figure 2 for a larger, printable version. Install VS1 = VS2, VL = VS1, TX and RX, and both Baud jumpers for these tests. This will set the Baud rate to 115.2k and allow DB9 communications. Consult the SSC-32 user manual for more detailed information.

Figure 2.
 
Step 3.
Connect the servos to their appropriate I/O channels. See Table 1 and consult the SSC-32 users manual. Double check your work. The header pins are close and numerous.
 

SSC-32 I/O Servo
00 Right Rear Vertical
01 Right Rear Horizontal
02 Right Middle Vertical
03 Right Middle Horizontal
04 Right Front Vertical
05 Right Front Horizontal
16 Left Rear Vertical
17 Left Rear Horizontal
18 Left Middle Vertical
19 Left Middle Horizontal
20 Left Front Vertical
21 Left Front Horizontal

Table 3.


Figure 3.
  
Step 4a.
Connect the serial data cable to the PC's serial port. This can be recognized by having 9 pins that stick out.

Step 4b. 
Connect the other end of the serial data cable to the SSC-32's DB9 port. Turn on the power.

Note, you can also use an IOGear USB-to-Serial adaptor.


Figure 4.

Step 5.
Install and run the LynxTerm on your PC. This program uses your computer's serial port to "talk" to the SSC-32. We will use it to quickly test your hexapod robot. This tool can also be extremely useful if you want to write a program for your favorite microcontroller to talk to the SSC-32 directly.

Choose the COM Port for your computer from the drop down menu in the upper left corner.

Note, if you notice the text going below the bottom of the box, it may be necessary to change the font settings and / or change the number of rows on screen under the Terminal Setup.

Click in the black text box and type "ver". If everything is working correctly, you should receive a response such as "SSC32-1.03XE".


Figure 5.

 
Step 6.
Click on the Sequencer button in the lower left corner. Click "All = 1500" and notice the hexapod legs hold position. If the robot was constructed properly, the legs will be horizontal and perpendicular to the body. Now would be a good time to double check the H2 mechanical leg alignment.

If your robot does not have mechanical alignment, then use the Offset tool under Servo Quick Test. Select the servo on the Hexapod diagram and adjust the offset slider to fine-tune the leg alignment. Do this for all twelve servos. When completed, click on Config to display the configuration data. Ignore the first four lines, as they do not pertain to the offset command. The lines starting with "#0PO" can be cut and pasted into the serout command in the programs included with this tutorial. Do a search for "Servo Offset" in the supplied programs and follow the instructions.


Figure 6.

 
Step 7.
The values for the L* and R* textboxes will control the positions the legs are moved to in the sequence. You can fine-tune these values to your mechanical leg arrangement with the same Servo Quick Test. Just adjust the position slider instead of the offset slider.
 

Tripod Leg Movement Sequence
LF Left Front Horiz RF Right Front Horiz
LH Left High Vertical RH Right High Vertical
LM Left Middle Vertical RM Right Mid Vertical
LL Left Low Vertical RL Right Low Vertical
LR Left Rear Horiz RR Right Rear Horiz

Table 7-1


Figure 7.

Step 8.
Now to make the robot walk forward. Adjust the XL and XR sliders to 100%. Note that HT=1500uS (1.5 seconds). Set the XS slider to ~50% and notice that the stride takes 3 seconds. Adjust the HT slider to 1000 and notice that the stride now takes 2 seconds.

You have complete control over all aspects of the tripod gait. Adjust either XL or XR lower to do gradual turns. Setting XL and XR to opposite directions will cause the robot to turn in place. Reverse values of XL and XR will cause the robot to walk backwards. Moving a slider is the same as typing from the terminal or sending the command from a microcontroller. For example, moving XS to 50% is the same as sending "XS50". Once the commands are sent, the robot will continue to walk until it receives XS = 0. If you are using a host microcontroller to send commands, it will be free to do any timing-intensive tasks without worrying about any of the walking process.


Figure 8.

 
Step 9.
For the do-it-yourselfers, the program to the right will set up and initiate walking on the robot. It will be necessary to remove the TX and RX jumpers, install the data cable to the Bot Board, and configure the Baud rate jumpers for 38.4k. Refer to the schematic in Figure 12. To change speed and direction just alter the XL, XR, XS values. The robot will immediately begin walking in the speed and direction commanded. We have several fully functional programs to choose from below.

XL var sbyte
XR var sbyte
XS var byte

XL = 100
XR = 100
XS = 100

start:
serout p15,i38400,["LF1700 RF1300 LR1300",13]
serout p15,i38400,["RR1700 LH1000 LM1700",13]
serout p15,i38400,["LL1800 RH2000 RM1300",13]
serout p15,i38400,["RL1200 VS3000 HT1500",13]
serout p15,i38400,["XL",SDEC XL,"XR",SDEC XR,13]
serout p15,i38400,["XS",DEC XS,13]
loop:
goto loop

Table 9.

 
Step 10.
The following steps refer to several programs that offer complete control of all aspects of the hexapod gait sequence through a wireless PS2 controller. Install and run the BASIC Atom IDE to allow programming the chip.
 

Filename Program description
h2prog1.zip Differential tank-steer mode.
h2prog2.zip Above, and single joystick mode.
h2prog3.zip Above, and leg high-position adjustable.
h2prog4.zip Above,  leg low-pos. adjustable, and obstacle detection.
h2l56p5.zip Above, and L5/L6 arm control.
h2prog6.zip Same as h2prog4, except only single joystick mode and pan-and-tilt on left joystick.

Table 10-1


Figure 10.

Step 11.
Wire your robot as illustrated in the wiring diagram to the right. Click on Figure 11 for a larger, printable version. The Sharp GP2D12 is not required, but offers crash protection if installed. You can use 7.2vdc battery for the best performance, however, if you're installing an L5 or L6 arm 6.0vdc is recommended. This is due to the micro servo on the gripper. For increased runtime, you can power the logic of the Bot Board and SSC-32 from a 9v battery. Just remember to remove the VS=VL jumpers on both boards. Don't forget to install the speaker enable jumper. This will provide audible feedback when using the controller with the provided programs. Install the PS2 receiver module and put fresh batteries in your controller.

When you run the program, you should hear some beeps that will continue until the game controller is recognized. Press the Analog button and the legs should hold position.


Figure 11.

 
Step 12.
Install the Playstation 2 cable as illustrated in Figure 12-1 and 12-2.


Figure 12-1

Figure 12-2


Step 13.
Controlling the motion of the hexapod is handled in two ways. Make sure the controller is in Analog mode. Mode 1 (default) uses a differential or tank mode, where the right joystick controls the right legs, and the left joystick controls the left legs. Mode 2 allows control of the direction of walking with the right joystick, while Left and Right on the D-Pad adjusts speed. Pressing R3 swaps between control modes. Initially, in either mode the joystick positions will allow a max of 100% XS speed. Pressing D-Pad Left lowers the max in 5% increments, and D-Pad Right increases the max in 5% increments up to 200%

Both modes offer additional control of leg trajectory for the alternating tripod gait. This refers to the vertical and horizontal motion that the foot goes through during the walking gait. Pressing /\, O (default), X, or [] changes how the foot is lifted in relation to the stride motion. Control the max vertical height with the R1/R2 buttons. Control the max low position (H2 body ride height) with the L1/L2 buttons. This can also be done with the D-Pad Up and Down buttons with a faster response.

If the robot is driven toward an obstacle, after a threshold is reached the forward joystick position is ignored. However, you can still reverse direction. The controller will also vibrate proportionally in relation to the distance from the obstacle. The Sharp sensor can be enabled or disabled with the Start button.


Figure 13.


Step 14.
The Select button switches between Hexapod and Arm control.

- Move X and Y (Up/Down, To/Away) with the Left joystick.
- Move Z (Base Rotate) and Wrist Angle with Right joystick.
- Close/Open gripper with L1/L2 buttons.
- Turn Wrist (L6 only) Right/Left with the R1/R2 buttons.
     > Arm moving video.
- Invert the X axis with the L3 (left joystick push button).
- Initialize Arm position with the X button.
- Disable/Enable Arm servos with the /\ button.

 
Figure 14.

 

PS2 Controls (Default Tank Mode)
L Joy U Left Side Forward R Joy U Right Side Forward
L Joy D Left Side Backward R Joy D Right Side Backward
L Joy L N/A R Joy L N/A
L Joy R N/A R Joy R N/A
L1 Raise body height R1 Increase leg lift
L2 Lower body height R2 Decrease leg lift
L3 N/A R3 Switch control mode
D-Pad U Raise body height /\ Figure 12
D-Pad D Lower body height X Figure 12
D-Pad L Speed Limit Down [] Figure 12
D-Pad R Speed Limit Up O Figure 12
Start Dis/En Crash Monitor Select Switch to Arm mode

Table 14-1

PS2 Controls (Right-Joystick Mode)
L Joy U N/A R Joy U Forward
L Joy D N/A R Joy D Backward
L Joy L N/A R Joy L Left
L Joy R N/A R Joy R Right

Table 14-2

PS2 Controls (Arm Control)
L Joy Move X and Y R Joy Move Z and Wrist
L1 Close Gripper R1 Turn Wrist Right
L2 Open Gripper R2 Turn Wrist Left
L3 Invert X Axis R3 Switch control mode
X Home Position /\ Diable/Enable Servos

Table 14-1

 
Step 15.
The following autonomous-behavior program requires the addition of three Sharp GP2D12 sensors, connected as follows:

A to D channel 0 sensor: on front left side, facing right.
A to D channel 1 sensor: on front right side, facing left.
A to D channel 2 sensor: on rear, facing behind the robot.
 

Filename Program description
h2prog7.zip Autonomous using two Sharp GP2D12 sensors and one on the rear.

Table 15-1


Figure 15.
Tags:
Created by Eric Nantel on 2024/07/03 09:20
Copyright RobotShop 2018