The Complete 2DoF Hexapod Tutorial
The Complete
2DOF Hexapod Tutorial. Updated 09/30/2010
Notice: Required Hardware: Required Software: - Wiring Schematic (2dofsch2.gif) Goal: |
Image of Hexapod 2. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step
1. Establishing Communication. The first thing we need to do is establish a connection between your computer and the SSC-32 so that we can align the servos. This is done by using a program called LynxTerm on the PC with the SSC-32 connected. Connect the serial data cable to the PC's serial port. This can be recognized by having 9 pins that stick out. Connect the other end of the serial data cable to the SSC-32's DB9 port. Note, if your computer does not have a native serial port, you can add one, or you can also use a high quality USB to Serial adapter such as one made by FTDI. If you are using an FTDI adapter cable, please install the VCP (Virtual Com Port) driver and change the "latency" property to its minimum. |
Figure 1. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step
2. Install and run LynxTerm on your PC. Plug the 9vdc battery in and notice the green LED light up on the SSC-32. Choose the COM port for your computer from the drop down menu in the upper left corner. Click in the black box, type "ver" and press "enter". If everything is working correctly, you should receive a response such as "SSC32-2.03XE". Note, the LED on the SSC-32 is not a power indicator but a status indicator. Its job is to light up on power up showing the SSC-32 is 95% functional. After it receives a serial command it will turn off, and from there on it will blink when it receives data. This will happen even if the data is not formatted correctly. The LED on the Bot Board II is a simple power indicator. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step
3. Aligning the Servos. Place the robot on top of a CD spindle or other similar object to support the body and lift the legs off the ground. Make sure your 6v battery is connected to the wiring harness and flip the power switch to the ON position to apply power to the servos. Click the All=1500 button at the bottom of the program and the legs should respond by quickly moving to a position near centered. If the robot was constructed properly, the legs will be horizontal and perpendicular to the body. If the legs are more than 15° off you may need to remove the output horn, rotate it, and reinstall it. The next step is to align the servos in software to be perfectly aligned. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step
4. Click on the H2 Sequencer button in the lower left corner. Since no servo is perfect, you will need to set offsets to center each servo. Use the Offset tool under Servo Quick Test. Click on "Read" to load any previous offset settings. 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 "Write" to save your offsets to the SSC-32 EEPROM. Refer to Figures 4-2 and 4-3 for how each servo should be aligned. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Schematic.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step 5.
Programming the Microcontroller. 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 Micro Studio to allow programming the chip. Refer to this tutorial for assistance on using the BASIC Micro Studio program.
|
Figure 5. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step
6. PS2 Control.
Controlling the motion of the hexapod is handled using a single joystick. Make sure the controller is in Analog mode. control of the direction of walking with the right joystick, while Left and Right on the D-Pad adjusts speed. 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 and the stride motion. 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. You may notice that there are no commands to change the height of the robot's body in the default program. In order to take full advantage of the mechanical advantage legs, they need to remain at their highest point. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step 7.
Autonomous Control. 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. The exact angle of the sensors isn't critical, but will affect the robot's behavior. Experimentation is encouraged.
|
Figure 7. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step 8.
Additional Information. The Hexapod Sequencer can be used to test the hexapod without a microcontroller. Simply connect the SSC-32 to the serial port as if you were going to align the servos, then follow along. 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.
|
Figure 8. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step
9. 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. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Step
10. For the do-it-yourselfers, the program to the right will set up and initiate walking on the robot. To change speed and direction just alter the XL, XR, XS values. The robot will immediately begin walking in the speed and direction commanded. |
|