Octo ROACH User Manual

OctoRoACH User Manual Last updated 2/20/2012

This document provides instructions for setting and operating the OctoRoACH robot.

The Robot

The OctoRoACH robot is a centimeter scale multi-legged crawling robot, designed for research in robotics, sensing, locomotion, and related subjects.
Chassis : The robot chassis is comprised of a dense carboard material laminated together with a layer of PET plastic. The cardboard provides the structure of the robot, and the PET provides the kinematic joints, in the form of flexure joints. The robot uses elastomeric legs legs molded from a polyurethane material.
Drive : The robot is driven by two DC motors. Forward and turning motions are possible.
Interface : The robot is controlled by a single electronic board carried on the robot, which contains a microcontroller, sensors, and motor drivers.
Power : The robot is powered by a single cell 300mAh (??) lithium-polymer battery, carried on the robot.

Theory of Operation

The current software for the OctoRoACH provides a high-level communication interface between the robot and a controlling personal computer. The PC issues commands to the robot, and receives recorded telemetry data. Communication is accomplished via an 802.15.4 standard radio on the robot control board.
The OctoRoACH robot is moved forward by its two electric motors. The robot is steered via “differential thust”; each motor drives the legs on one side of the robot, so steering is accomplished by setting the thrust higher on one side of the robot. Basic heading control is available through a software feedback control loop from the onboard gyroscope.

Software

The software suite associated with the OctoRoACH robot is comprised of the firmware on the microcontroller onboard the robot and the PC-side command and interface utilities. The firmware is implemented in plain C for the Microchip dsPIC33 microcontroller (the C source is not yet available to customers) .
The robot will be shipped with a complete & operational firmware, ready to run. The PC-side software is written in Python, and requires some installation to get all necessary libraries in place. Several example scripts for structure control or manual “remote control” of the robot are provided.

Setup & Installation

To interface with the OctoRoACH robot, you will need an 802.15.4 radio to plug into your computer to communicate with the robot. The robot can be controlled from Windows, OSX, and Linux.

Hardware

This section is presented as a pool of links and info about important support hardware for the OctoRoach.

Xbee

To communicate with the robot, you will need an XBee module:
http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/point-multipoint-rfmodules/xbee-series1-module#overview

This module is available from many resellers:
http://search.digikey.com/scripts/DkSearch/dksus.dll?x=0&y=0&lang=en&site=us&KeyWords=XB24-AWI-001
http://www.mouser.com/ProductDetail/Digi-International/XB24-AWI-001/?qs=sGAEpiMZZMt6zyh4HYqUXK%252bOp29EHnZS
http://www.sparkfun.com/products/8665

You will also a board to interface the module to a USB port on your computer; Sparkfun sells one of these: http://www.sparkfun.com/products/8687
Since these are frequently out of stock, there are some other similar form factors that will take the same module, but with a different USB connector: http://www.sparkfun.com/products/9819

Charger

The batteries supplied with the MRI built OctoRoACH robots can be found here:
http://www.hobbyking.com/hobbyking/store/__17808__Turnigy_nano_tech_300mah_1S_35c_Lipo_Pack_Suit_Blade_mCPx_.html

NOTE: Do not use the SparkFun chargers with these batteries. They use an identical connector, but with reversed polarity.
A simple charger is available from E-Flite:
http://www.e-fliterc.com/Products/Default.aspx?ProdID=EFLC1000
Using this charger will require an adapter lead, E-Flite part number EFLA7002UM.

E-Flite also makes a charger that can charge multiple batteries at once:
http://www.e-fliterc.com/Products/Default.aspx?ProdID=EFLC1004

Other chargers are available HobbyKing, but these chargers will require some setup to select the right cell type, cell count, etc:
http://www.hobbyking.com/hobbycity/store/uh_viewitem.asp?idproduct=7028
http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=10621 (adapter lead)

Python

Running the OctoRoACH code will require you to install a python interpreter, as well as several libraries. Python is an open-source programming language, with an open-source interpreter and tools readily available. A bundled product from Enthought (www.enthought.com) is recommended for ease of installation: http://www.enthought.com/products/epd_free.php

Enthough Python is no longer recommended, as they have put several required packages behind a subscription pay-wall.
We now recommend using the Anaconda Scientific Python Distribution: https://store.continuum.io/cshop/anaconda/
(click on the blue button in the upper right for "Download Anaconda") This distribution is free, and the extra packages that need to be installed can easily be installed with the directions below:

  • pyserial
  • xbee-python

TODO: Test x64 version of Anaconda on Windows, make sure pyserial works.

Windows

You must install a 32bit version of Python. The 64 bit version is known to not have sufficient library support to work.
After installing Anaconda:

  • open a command prompt (WindowsKey + r, type “cmd”, press enter)
  • type "pip install xbee", press enter.
  • type "pip install pyserial", press enter.

If you want to use joystick control, you'll need to install the pygame library. Unfortunately, it seems that none of the various python package managers (easy_install, pip, conda) can install pygame.

Get an installer here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

If you installed the 64bit version of Anaconda, download and install pygame‑1.9.2a0.win‑amd64‑py2.7.exe
If you installed the 32bit version of Anaconda, download and install pygame‑1.9.2a0.win32‑py2.7.exe

OSX

The XBee module can be made to work with OSX, but the X-CTU utility to configure the XBee is not available for OSX. This section will be filled in later.

Linux

The XBee module can be made to work with Linux, but the X-CTU utility to configure the XBee is not available for Linux. This section will be filled in later.

Installation of python varies greatly by OS distribution. For Ubuntu systems, all libraries can be installed by running the following command in a terminal:

	 Sudo apt-get install python python-serial python-xbee python-numpy

Communications

The use of a computer running Microsoft Windows is required to set up the XBee module to communicate with the robot. After the initial setup, the XBee module can be used with a Windows, OSX, or Linux computer.

Windows

When the XBee module is plugged into the computer, it will provide a “Virtual COM port”. To find out what COM port was assigned to the Xbee, open the Windows Device Manager (WindowsKey + r, type “devmgmt.msc”, press enter). The device will be listed under the heading “Ports (COM & LPT)”. Note that other devices connect to your computer may be provided COM ports as well. Examine the Device Manager with the XBee unplugged to determine which COM corresponds to your XBee.

To configure the Xbee, download the X-CTU program from the Digi website: http://ftp1.digi.com/support/utilities/40003002_B.exe

Start X-CTU once it is installed. Refer to figures 1-4 for the following instructions:

  • Select the COM port corresponding to your XBee module from the list
  • Make settings as shown in figure 1
  • Press “Test/Query”
  • You should see the confirmation shown in figure 2. If not, you need to troubleshoot your Xbee module.
  • Click on the “Modem Configuration” tab
  • Click on the “Load” button, under the “Profile” heading, see figure 3.
  • Load the provided configuration file, motile-octoroach.pro
  • Press the “Write” button
  • You should see the confirmation shown in figure 4. If not, you need to troubleshoot your Xbee module.

Your XBee module should now be configured for use. You will only have to do this once for each Xbee module.

Figure 1:

Figure 2:

Figure 3:

Figure 4:

To set up the Python software library, edit shared.py, and set the COM port to the correct value. For example, if your XBee is on COM6, then you would edit the line to read:

BS_COMPORT  = ‘COM6’

The file shared.py is used as a "global" module, to elide the need for long lists of "global" keywords in control scripts.

You are ready to control your robot. Exit the X-CTU configuration program before running any of the Python code to connect to the robot.

Running the Robot

Several pre-made Python scripts are provided as example of how to command the robot over the radio link.
keyboard_control.py will allow remote piloting of the robot using the keyboard, where the thrust of each side of the robot is controlled by separate keys.
keyboard_control-mix.py uses the arrows keys to control the robot, mixing the left & right arrow key presses into a differential thrust. On-screen instructions are presented at the beginning of execution of each script.
experiment.py is an example of sending the robot a controlled motion sequence, starting data saving telemetry, and downloading the saved data from the robot.

To run the robot, connect a charged battery to the control board. Verify that the red LED is illuminated; this means that the control board is powered and idling.
Execute ‘keyboard_control-mix.py’ by double clicking on it, or by opening a Command Prompt in the containing directory, and typing python keyboard_control-mix.py

Figure ##: Connecting the battery Figure ##: Red LED indicates robot ready to go

You should now be able to remotely pilot your robot about using the keys described in the on-screen instructions. If this does not work, please see the Troubleshooting section.

Accelerometer Calibration

To get high accuracy results from the accelerometer, a calibration step should be performed; this only needs to be done once per robot.

The control board for the OctoRoACH robot has an ADXL345 accelerometer onboard. The chip is configured to sense in the +-8 range. The X,Y,Z acceleration values are saved and downloaded with the telemetry data. Then values are recorded and downloaded in "raw counts" from the ADXL345 chip, and should be converted to G's.

Since the datasheet specifies nominal sensitivity of 256 LSB/G, an approximate conversion is: Acceleration [G] = Acceleration [raw counts] / 256

As per the datasheet, each axis of the accelerometer may have it's own scaling and offset, such that the true scaling is:

To find the calibration parameters [Cx,Cy,Cz,Dx,Dy,Dz], use experiment.py to take a datalog of the robot over 45-60 seconds, as the user holds the robot in the air and slowly rotates it around all 3 of it's axes smoothly, without shifting the center of robot. Since the acceleromter will track a 1G gravity vector with changing orientation, we can fit this data to a 1G sphere, and determine the conversion parameters which are the best fit, in the least-squares sense.

The user should modify the experiment.py such that:
moveq = [1, 0, 0, 45000]
This corresponds to a zero-throttle segment for 45 seconds, which will trigger the telemetry to be saved and downloaded. Slowly rotate the robot through as many unique orientations as you can during this time, without laterally accelerating about the center.

Once you have this data log as an "imudata*.txt" file, rename it to "calib_imudata.txt", and use one of the following calibration scripts to calculate the paramters: Mathematica or Matlab.

Save a record of the parameters [Cx,Cy,Cz,Dx,Dy,Dz], as they should be uniquely associated with the particular control board on the robot you are calibrating. It is not expected that the calibration parameters will change over time.

(TODO: provide pre-made experiment.py for calibration)

Troubleshooting

In this section, known issues will be pooled and addressed. If you are experiencing an issue, especially a reproducible one, please email the author so it can be added to the list.

  • If you can not successfully communicate with your robot, check the settings of the XBee. All the robots built by MRI have the same configuration for the radio:
Channel: 0x0E
PAN ID: ??
Source Addr: ??  (this is the robot's address, "destination" from the point of the Xbee)
Dest Addr: ?? (this is the XBee's address, "source" from the point of the XBee)

The python scripts will attempt to set motor control gains as the first step; if the robot cannot be reached, the script will not continue to execute.

  • The control board will not run if the battery voltage is < 3.3v . If the battery voltage is only just above 3.3 volts, switching on the motors can cause the voltage to drop, and reset the robot.

Known issues

  • The SOFTWARE_RESET and ECHO commands are known to not work with the XBee module. For now, leave RESET_ROBOT set to False in experiment.py ; this will likely only require a fix in the python code, and not the firmware.

Notes At the current time, all OctoRoACH robots are shipped with hard-coded network parameters. As such, all robots operate on the same channel (TODO), with the same network PAN ID (TODO), and the same destination address (TODO). This means that two robots cannot be run at the same time in the same location. This section will be expanded to provide details on how to change parameters and use multiple robots together.

Future sections: Compiling firmware from source Configuring radio parameters Sensing with the microcontroller’s ADC Using microcontroller’s GPIO

Authors: Andrew Pullin, UC Berkeley, Graduate Student