Using the Hemisson Robot

1. Setting up Linux for use with the Hemisson Robot

The [WWW]Hemisson is a small, inexpensive robot from [WWW]K-Team based on their Khepera robot. It has an excellent set of features for the price. In addition, it has a wireless Bluetooth interface, which makes it work very well untethered with Pyro. This page details getting the radio Hemisson working under Fedora Core 2.

(!) Pyro, versions 3.1.0 and higher now work with the Hemisson thanks to Robin Knight and Kim Wheeler from [WWW]RoadNarrows.

1.1. Hemisson Software Update

To run the Hemisson under Linux, you will need to update your Hemisson on-board program. This section details the steps involved. These instructions provided by the kind folks at [WWW]RoadNarrows. A Users Guide can be found [WWW]here.

  1. Make sure the Bluetooth module is removed from the Hemisson.

  2. Attach a serial cable between a Windows PC and the Hemisson.

  3. Make sure the download tool [WWW]Hemisson Uploader is installed on the Windows PC.

  4. Download the updated Hemisson control program from [WWW]here.

  5. Set the Hemisson to PGM mode (left front switch) and turn on the Hemisson. Along with the power LED, you should also see the red PGM LED lit.

  6. Run the Hemisson Uploader.

  7. Press the "Search" button and choose the hemiosXXXX.hex file (where XXXX is the highest number/letter combination).

  8. Press the "Write" button. The "Info" status field goes through various messages and at a successful download, ends with the message "All OK!"

  9. Turn off the Hemisson and set it back to Exec mode.

  10. Attach the Bluetooth module.

  11. Turn on the Hemisson. You should be already to go.

(!) This HemiOS does not contain any of the builtin dancing, line-following, or Braitenberg modes.

1.2. Linux Bluetooth Installation

Most of these instructions should apply to any modern Linux running a 2.6 kernel.

You'll need to get the bluez support tools and libraries. We did that as root, with:

# '''yum search bluez'''

which told us about the following packages:

# '''yum search bluez'''
Gathering header information file(s) from server(s)
Server: Fedora Core 2 - i386 - Base
Server: Fedora Core 2 - i386 - Released Updates
Finding updated packages
Downloading needed headers
Looking in available packages for a providing package
Available package: bluez-libs-devel.i386 0:2.5-2.1 from base matches with
Available package: bluez-sdp-devel.i386 0:1.5-2.1 from base matches with
2 results returned
Looking in installed packages for a providing package
Installed package: bluez-bluefw.i386 0:1.0-2 matches with
Installed package: bluez-sdp.i386 0:1.5-2.1 matches with
Installed package: bluez-hcidump.i386 0:1.5-4 matches with
Installed package: bluez-pin.i386 0:0.23-1 matches with
Installed package: bluez-utils.i386 0:2.4-3 matches with
Installed package: bluez-pan.i386 0:1.1-4 matches with
Installed package: bluez-libs.i386 0:2.5-2.1 matches with
7 results returned

On Fedora Core 3 and 4, this is installed by default. If you need to install them manuall, we installed these packages:

# '''yum -y install bluez-bluefw bluez-sdp  bluez-hcidump  bluez-pin  bluez-utils  bluez-pan'''

Now we are ready to see if Linux can see the Hemisson. Put the Hemisson into serial port mode (Pgm/Exec in Exec, On/Off in On, and all of the switches to the left when the battery is on the far side away from you. See the Hemisson manual for more details.)

You should see something like the following when you enter hciconfig:

# '''hciconfig'''
hci0:   Type: USB
        BD Address: 00:0C:76:AB:4B:8E ACL MTU: 192:8  SCO MTU: 64:8
        RX bytes:45605 acl:91 sco:0 events:6293 errors:0
        TX bytes:90141 acl:6264 sco:0 commands:24 errors:0

This indicates that we can see the Bluetooth USB dongle. Now, we need to bring up this device (like one does with a ethernet network connection). But first, we need to make a few changes to /etc/bluetooth/hcid.conf in the options section. You need to change security from auto to none, and change pairing from multi to none. Also, comment out pin_helper.

While we are here, go ahead and add in the device section, the option lm slave,accept; and comment out the other lm lines, auth enable;, and encrypt enable;. Here is a copy of our /etc/bluetooth/hcid.conf file:

# HCI daemon configuration file.
# $Id: hcid.conf,v 1.3 2002/07/18 18:12:46 maxk Exp $
# HCId options
options {
        # Automatically initialize new devices
        autoinit yes;
        # Security Manager mode
        #   none - Security manager disabled
        #   auto - Use local PIN for incoming connections
        #   user - Always ask user for a PIN
        security none; # was auto
        # Pairing mode
        #   none  - Pairing disabled
        #   multi - Allow pairing with already paired devices
        #   once  - Pair once and deny successive attempts
        pairing none; # was multi
        # PIN helper
        #pin_helper /usr/bin/bluepin;
        # A dbus PIN daemon can be found at
# Default settings for HCI devices
device {
        # Local device name
        #   %d - device id
        #   %h - host name
        name "%h-%d";
        # Local device class
        class 0x120104;

        # Default packet type
        #pkt_type DH1,DM1,HV1;
        pkt_type DM1,DM3,DM5,DH1,DH3,DH5,HV1,HV2,HV3;

        # Inquiry and Page scan
        iscan enable; pscan enable;
        # Default link mode
        #   none   - no specific policy
        #   accept - always accept incoming connections
        #   master - become master on incoming connections,
        #            deny role switch on outgoing connections
        #lm accept,master;
        #lm accept;
        lm slave,accept;
        # Default link policy
        #   none    - no specific policy
        #   rswitch - allow role switch
        #   hold    - allow hold mode
        #   sniff   - allow sniff mode
        #   park    - allow park mode
        #lp hold,sniff;
        lp hold,sniff,park;
        # Authentication and Encryption
        #auth enable;
        #encrypt enable;

On Fedora Core 3 and 4, the following demons were already running. If they aren't you need to start them. You won't have to do this after a reboot, in any case.

# '''hcid'''
# '''sdpd'''

Now, we should be able to bring the hci USB device up:

# '''hciconfig hci0 up'''

And checking to see that it is indeed up:

# '''hciconfig'''
hci0:   Type: USB
        BD Address: 00:0C:76:AB:4B:8E ACL MTU: 192:8  SCO MTU: 64:8
        RX bytes:45894 acl:91 sco:0 events:6298 errors:0
        TX bytes:90162 acl:6264 sco:0 commands:26 errors:0

There are many tools available to test out the connection. You can:

# '''hcitool scan'''
Scanning ...
        00:04:3E:C1:56:93       hemradio93

There it is! If you have multiple Hemissons turned on with the radio link kit, you would see them there too. We are almost ready to talk to the robot.

Next, we will edit /etc/bluetooth/rfcomm.conf by putting some of the information from the scan. You need to change the device address, and you may want to change the name, like so:

# RFCOMM configuration file.
# $Id: rfcomm.conf,v 1.1 2002/10/07 05:58:18 maxk Exp $
# Example:
rfcomm0 {
        # Automatically bind the device at startup
        bind yes;
        # Bluetooth address of the device
        #device 11:22:33:44:55:66;
        device 00:04:3E:C1:56:93; # hemisson
        # RFCOMM channel for the connection
        channel 1;
        # Description of the connection
        comment "Hemisson Bluetooth device";

Finally, you need to bind the TTY ports with:

# rfcomm bind all

You should now be able to open /dev/rfcomm0 or /dev/ttyUB0 as a serial connection and talk to your Hemisson as if it were directly connected via a serial cable.

You'll notice the green connect light is on, and the green RX light is flashing on the Hemisson when it is receiving commands.

1.3. Multiple Hemissons

For each Hemisson that you have, you will need the scan information, and a section in the rfcomm.conf file. For example, the second Hemisson might give:

# '''hcitool scan'''
Scanning ...
        00:04:3E:C1:56:93       hemradio93
        00:04:3E:C1:56:95       hemradio95

and so you would add:

rfcomm1 {
        bind yes;
        device 00:04:3E:C1:56:95;
        channel 1;
        comment "Hemisson Bluetooth device #2";

to the bottom of the rfcomm.conf file. That's it!

Next: Using the Sony AIBO Robot Up: PyroHardware