INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

SegwayRmpAcfr
[SegwayRmp driversC++Linux]

An ACFR implementation using USB and CAN interfaces. More...

An ACFR implementation using USB and CAN interfaces.

Segway RMP USB

Note: This driver has been tested on the balancing platform RMP200 and the caster version RMP50.

The segwayrmp driver provides control of a Segway RMP (Robotic Mobility Platform), which is an robotic version of the Segway HT (Human Transport), a kind of two-wheeled, self-balancing electric scooter. Because of its power, weight, height, and dynamics, the Segway RMP is a potentially dangerous machine. Be very careful with it.

For safety, this Segway will stop (zero-out motion commands) if no new command has been received from the PC in the previous 400ms or so. This is done in Segway firmware and this component does not duplicate this functionality. Thus, if you want to continue moving at a constant velocity, you must continuously send your desired velocities to the Platform2d interface (Teleop component does exactly that).

When controlled through the USB port, the Segway implements an extra level of safety precaution which works as follows. On startup, the Segway black box checks for the presence of a host PC. If the host PC is absent, the Segway disables itself. All of this means that the following startup order must be followed:

  1. Host PC is powered up and the Segway USB cable is plugged in (give it enough time to activate USB)
  2. SegwayRMP is powered up.

If for some reason you did it in the wrong order (e.g. the cable was unplugged), just power cycle the Segway.

The implementation of orca_interface_odometry3d interface does not integrate robot's motion in the vertical direction. The altitude (z coordinate) of is always reported as 0.0.

Dependancies
  • libIceUtil (for timing)
  • libftdi

The USB version of RMP uses a chip from Future Technology Devices Int. (FTDI). Following the Windows demo software from Segway we use a high-level closed-source library from FTDI to communicate with their chip. The Linux and Windows versions of the library have a (nearly) identical API. On linux the library is called libftd2xx.so and it uses the standard low-level libusb.so.

Make sure libusb is installed. In Debian, the easiest is to install the developer package. It's likely that you already have the library and all this package will do is create a couple of symbolic links.

# apt-get install libusb-dev

The Orca component has been tested with libftd2xx.so.0.4.13 and libusb-0.1.so.4 (these are the latest versions tested). Download the libftd2xx library from www.ftdichip.com. Untar and follow the installation instructions in README.dat file. Note an incorrect version number in several places and that the line to add to your fstab file depends on the distribution and kernel number. The following has been tested in Debian, kernels 2.6.12 and 2.6.15 and Kubuntu, kernel 2.6.20.

none            /proc/bus/usb   usbfs   defaults,devmode=0666   0       0

Tips for troubleshooting: Use usbview (or look at /proc/bus/usb/devices) to check whether the Segway shows up when you plug in the USB. Use dmesg on the console to see whether the mounting is successful.

In addition, copy the header files provided with the distribution to a standard place, e.g.

# cp ftd2xx.h WinTypes.h /usr/local/include/.

On some systems, an additional symbolic link needs to be created for shared libraries to load properly. You'll see an error message at runtime that contains "libftd2xx.so.0: cannot open shared object file".

# ln -s /usr/local/lib/libftd2xx.so.0.4.10 /usr/lib/libftd2xx.so.0

As usual, make sure that both Linux and CMake detect the changes

# ldconfig
$ cd <hydro_src>
$ rm CMakeCache.txt
$ cmake .

You should see the following line in CMake output:

    USB Driver for Segway RMP - can be built
Extra configuration. Used for USB and CAN
  • Acfr.GainSchedule (string)
    • Choice of the gain schedule for the closed-loop controller in balanced mode
    • Valid values: { "normal", "tall", "heavy" }
    • Default: "normal"
  • Acfr.MaxVelocityScale (double)
    • Scaling factor applied to forward velocity.
    • Valid values: [0.0 .. 1.0]
    • Default: 1.0
  • Acfr.MaxTurnrateScale (double)
    • Scaling factor applied to yaw rate.
    • Valid values: [0.0 .. 1.0]
    • Default: 1.0
  • Acfr.MaxAccelerationScale (double)
    • Scaling factor applied to forward velocity.
    • Valid values: [0.0 .. 1.0]
    • Default: 1.0
  • Acfr.MaxCurrentLimitScale (double)
    • Scaling factor applied to forward velocity.
    • Valid values: [0.0 .. 1.0]
    • Default: 1.0
  • Acfr.ProductModel (string)
    • The model of the RMP hardware
    • Valid values:
      • { 'RMP50', 'RMP100', 'RMP200', 'RMP400' }
    • Default: 'RMP200'
  • Acfr.RequireSpecificBuildId (bool)
    • If true, the vehicle will not operate on all other build IDs (ie RMP firmware versions)
    • Default: 0
  • Acfr.RequiredBuildId (int)
    • The only RMP firmware version which the component will allow (ignored if RequireSpecificBuildId is not set)
    • Default: 0
  • Acfr.AllowMoveInTractorMode (bool)
    • Allow the vehicle to move in tractor mode (this allows extra safety)
    • Default: 1
  • Acfr.AllowMoveInBalanceMode (bool)
    • Allow the vehicle to move in balance mode (this allows extra safety)
    • Default: 1
  • Acfr.LogCanDataToFile (bool)
    • For debugging purposes, log all received CAN data to a file.
    • default: 0
  • Acfr.CanDataLogFileName (string)
    • The log file to use for received CAN data (only if LogCanDataToFile is set).
    • default: canlog.txt

Segway RMP CAN

Dependencies.
  • libIceUtil (for timing)
  • libpcan

This driver is written to interface with the PCMICA CAN card from peaksystems http://www.peak-system.com/linux . Please read the general description above for the USB driver as some of the information there is directly relevant. The drivers for the peak devices should be downloaded from the website above. Download the driver package *.tar.gz, unzip and follow the installation instructions in Documentation/Installation-en.pdf . This should work for PCMCIA, USB, PCI cards etc, though only the PCMCIA version has been tested!

Concise Debian Instructions

The following should work on Debian (last tested with driver version 6.11, kernel 2.6.26)

# apt-get install linux-source linux-headers-[VERSION]-[ARCH]
# cd /usr/src/
# ln -s linux-headers-[VERSION]-[ARCH] linux

Now compile and install the driver. We assume here 2.6.25 kernel or newer. Our driver does not work with the netdev interface, so the support for it must be disabled (see webpage for details).

$ cd [PEAK-SRC]
$ make NET=NO_NETDEV_SUPPORT
# make install
Note:
if you get an error "cp: cannot stat `/etc/modprobe.conf': No such file or directory", just try to install again, it will work on the second try.
Ubuntu Instructions

On at least one ubuntu installation it was necessary to make some additional changes in order to run the installs.

  • On the system which had a split headers installation. ie under /usr/src/ existed two headers directories linux-headers-.2.6* and linux-headers-2.6*-386 it was necessary to create the symbolic link /usr/src/linux to point at the linux-headers*-386 directory not at the linux-source directory as described in the installation notes. Again note that this is the headers*-386 directory not the the headers* dir.
    # cd /usr/src/; ln -s linux-headers-2.6.17.11-386 linux;
    
  • After doing the peak driver 'make install' step, edit the default shell used in the "pcan_make_devices" script from #!/bin/sh to #!/bin/bash. This file exists under /usr/local/bin .

Now back to compiling Orca SRC. As usual, make sure that both Linux and CMake detect the changes

# ldconfig
$ rm CMakeCache.txt
$ cmake .

You should see the following line in CMake output:

    CAN Driver for Segway RMP - can be built
Extra configuration. Used for the peak CAN
  • Acfr.CanDevice (string)
    • Select the linux file that is the end point for communication with the peak can device
    • Valid values: { "/dev/pcan*" }
    • Default: "/dev/pcan40" (The default is the first PCMCIA port)
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5