Pivot, the Hexapod Robot
Robot programming for an autonomous walking hexapod

About this web page

This page shows how robot programming is done using the Acroname Brainstem controller, and how the code is implemented to let the robot walk around autonomously.




What else to find
How to start a project by thinking about the design of the robot. This will save a lot of headaches when done properly. Next, a page how to build the robot, and how to program the micro controller for autonomous walking with obstacle avoiding capability. For fun, movies and links to other useful websites can also be found.



Programming

Using the Brainstem GP1.0 controller

This section explains the usage of the Acroname Brainstem GP1.0: how programs are written, compiled, and loaded into the robot controller.

Writing TEA programs

To start of, the programs which run in Acroname's Brainstem controller are written in the "TEA" language which syntax is very similar to the C programming language. Any text editor can be used to edit the code. The code is saved as a ".tea" file, but needs to be compiled in order for the brainstem controller to understand the code.

Console example to compile a TEA program
Figure 1: Compiling a TEA program
using the console.

Compiling TEA programs to CUP code

Compilation is done via Acroname's console, which is downloadable at the companies website. The console is available for Win32, MacOS X, and Linux. After downloading and installing this software, the console can be found in the aBinary directory on your computer as console.exe.
The TEA code which is used to control the robot has to be saved in the aUser directory. The code which is written for Pivot is saved as r01.tea in this directory. Compiling is done by starting the console, and giving the command steep "r01.tea", see Figure 1. After succesfull compilation, this creates a r01.cup file in the aObjects directory.

Downloading CUP code to the Brainstem controller

Once the TEA program is compiled into a .cup file, the program can be downloaded via the RS232 interface of the Brainstem. This is done by connecting the Brainstem controller via the serial interface convertor and RS232 cable to the host computer. With the robot powered up with batteries, the console indicates via a green blinking status indicator that the Brainstem is connected to your computer and console program. After the command load "r01.cup" 2 0 is given to download the code to the Brainstem, the command launch 2 0 starts executed the program on the controller. Note that the 2 stands for the module number, which defaults to 2 for the Brainstem controller. In case several Brainstem modules are connected, the next Brainstam module has number 4. The 0 stands for the slot number in which the code is loaded, which can be any slot ranging from 0 to 10.

Robot Programming

Below is the basic TEA code for the robot to make some steps, and to let it turn. The program does not have the capability to use the SRF04 range finder yet, and consequently also no obstacle avoidance capability. The basic code is used to experiment with the walking routines and to calibrate the robot. To give an indication of the size of the program, it compiles into 333 bytes.
The code is devided into three separate parts:

r01.tea:

Main robot controller program loop

r01_dat.tea:

Robot controller servo calibration

r01_servocmds.tea:

Robot controller servo commands