Changes between Initial Version and Version 1 of Hand/262/SoftwareSetup/Linux


Ignore:
Timestamp:
May 12, 2011, 7:16:00 PM (13 years ago)
Author:
edison
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Hand/262/SoftwareSetup/Linux

    v1 v1  
     1= BarrettHand BH8-262 software setup - Linux =
     2== !Ubuntu/Debian ==
     3The BarrettHand software version 4.4.x will run in Linux under the 32-bit version of Ubuntu 9.10.  This software is installable with a Debian package, which contains the source code and precompiled binaries that are ready to run the demos, examples, and GUI for these versions of uBuntu.  Double-clicking on the Debian package will download and install all dependencies automatically and is the easiest way to get started running and developing software for the BarrettHand quickly.  If you are not running Ubuntu version 9.10, which this software was tested with, it may be possible to build the GUI, demos, and examples from the BarrettHand source code provided in the "tgz" compressed version of the software.
     4
     5----------------------------------------------------------------------------
     6        Using the BarrettHand software and notes for the Debian Package
     7----------------------------------------------------------------------------
     8
     9In the past the Debian package has been compiled to run on Ubuntu 7.10 and some of these notes are left here.  However, there aren't newer versions of wxWidgets available that are needed for the BHControl GUI for Gutsy (Ubuntu 7.10).  Barrett is not planning on generating a Debian installer packages for older versions of Ubuntu.  In addition to the build-essential package the BarrettHand Debian software package contains dependencies on libwxgtk2.8-d and libglut3-dev for the Control GUI.  Ubuntu 9.10 has repositories to download these but if you are using Ubuntu 7.10 then you will need to add additional repositories to the end of /etc/apt/sources.list in order to install the BarrettHand software with the Debian package.  Instead of editing this file by hand you may goto System -> Administration -> Software Sources -> Third Party Software and add these lines one at a time.
     10
     11deb http://old-releases.ubuntu.com/ubuntu/ gutsy main universe multiverse
     12deb http://old-releases.ubuntu.com/ubuntu/ gutsy-updates main universe multiverse
     13deb http://old-releases.ubuntu.com/ubuntu/ gutsy-security main universe multiverse
     14
     15If the BarrettHand software is installed using the Debian package it will be in the directory:
     16
     17        /usr/local/Barrett/BHand
     18
     19If you have installed the software with the Debian package you should be all set to run an example.  To do so, open a terminal and issue:
     20
     21        cd /usr/local/Barrett/BHand/examples/Supervisory
     22        ./Supervisory
     23
     24The example should start and will ask for a COM port.  Hit "1" and the enter key for /dev/ttyS0 (or a different number for other com ports).  See the notes further below if you are using a USB to serial adapter.  There are other demos and examples to try in the BHand directory.  If the software was installed with the Debian package then you will have the build-essential package installed on your system and will be able to rebuild the example by issuing:
     25
     26        make clean
     27        make
     28
     29When you have the GUI installed and are ready to run it, open a terminal and issue:
     30
     31        cd /usr/local/Barrett/BHand/bhcontrol
     32        ./BHControl
     33
     34The !CodeBlocks package is required to build or rebuild the GUI and can be downloaded and installed with Synaptic Package Manager in Ubuntu 9.10.  In the future there may be additional support for other IDEs like Eclipse.  On Ubuntu 7.10 you will have to download the sources online from http://www.codeblocks.org/downloads.  In addition, if you are using Ubuntu 7.10, you will need to download and install libgtk2.0-dev using Synaptic Package Manager in order to compile !CodeBlocks.  The older version of !Codeblocks 8.02 was found to be available at: http://www.codeblocks.org/downloads/6. Extract the package to the desktop and from a terminal issue these commands to build and install !CodeBlocks:
     35
     36        cd Desktop/codeblocks-8.02-src
     37        ./configure
     38        make -j4
     39        make install
     40        ldconfig
     41
     42You may rebuild the BarrettHand Control GUI or the API library with !CodeBlocks but to do so may require the appropriate permissions to modify files in /usr/local/Barrett (at least for Ubuntu 9.10).  Running !CodeBlocks as root will solve issues with permissions and allow you to rebuild the GUI.
     43
     44To build or rebuild the BarrettHand Control GUI:
     45        - Start !CodeBlocks by either:
     46                - Launching it in Applications -> Programming -> Code::Blocks IDE
     47                - Opening a terminal and issuing: sudo codeblocks
     48        - Open the !CodeBlocks project file BHControl (in /usr/local/Barrett/BHand/bhcontrol/BHControl.cbp)
     49        - Select the build target: Build -> Build Target -> Linux Release
     50        - Click Build -> Build and Run or press F9
     51
     52The binary for the API library is not required to build the Control GUI.  Presently, it is only used to build the demos to illustrate how to use a Makefile to build from the API library instead of including "bhand.cpp".
     53
     54To build or rebuild the BarrettHand API Library:
     55        - Open the !CodeBlocks project file BHand in the API directory
     56        - Select the build target: Build -> Build Target -> Linux Release
     57        - Build by clicking Build -> Build
     58
     59-------------------------------------------------------------------------------
     60        Additional Info for BarrettHand Libraries, Headers, and Makefiles
     61-------------------------------------------------------------------------------
     62
     63The Debian package will install binaries for libraries that are dependencies for the BarrettHand in /usr/local/lib.  The library files, which are required third party dependencies for controlling the hand, that are automatically installed by the BarrettHand software are:
     64
     65        libctb-barrett-0.14.a
     66        libctb-barrett-0.14.so
     67        libPocoFoundationBarrett.so
     68
     69Notice that the filenames for the third party CTB and POCO libraries have been renamed to include "barrett" or "Barrett" in order to not stomp on a users installation of the CTB or POCO libraries.  Barrett did not want it to be possible that the BarrettHand software would overwrite the users libraries so we renamed them to make sure they were unique.  When developing these applications users should link to these libraries (in /usr/local/Barrett/BHand/thirdparty/lib or the copies of these in /usr/local/lib).  However, the required header files are only available in /usr/local/Barrett/BHand/thirdparty/include.  See the examples, which show how a Makefile may include and link the required third party headers and libraries along with the BarrettHand source code file "bhand.cpp" and header file "bhand.h".  If you would rather link to the BarrettHand library instead of including the "bhand.cpp" source file in a Makefile then take look at the demos that illustrate how to do that.
     70
     71----------------------------------------------------------------------------
     72        Compressed "tgz" file
     73----------------------------------------------------------------------------
     74
     75The rest of this file describes how to build the BarrettHand Control GUI, BarrettHand API Library, Examples, and Demos from the provided source files for Ubuntu with the compressed tgz file.  These instructions are not necessary if installing on Ubuntu 7.10 or 9.10.  For these platforms it is recommended to install the BarrettHand Software with the provided Debian package, which will download dependencies so that you can get started with running and developing software for the BarrettHand quickly.  In case you don't want to install the BarrettHand software with the Debian package below are alternative installation instructions to get started with the software provided in the .tgz file for the BarrettHand software.
     76
     77----------------------------------------------------------------------------
     78        GNU C++ Compiler
     79----------------------------------------------------------------------------
     80
     81If you do not already have the build-essential package installed then you may install it from a terminal using the following line:
     82
     83sudo apt-get install build-essential
     84
     85-------------------------------------------------------------
     86        Installing Third Party Dependencies for Ubuntu
     87-------------------------------------------------------------
     88
     89Install and build third party open source dependencies for the BarrettHand API Library:
     90
     911) Build the CTB Serial Port library included by Barrett (Location: thirdparty/sources/ctb-0.14).  It is necessary to use the version supplied by Barrett in Linux.
     92
     93Open a terminal and issue the commands
     94        cd thirdparty/sources/ctb-0.14/build
     95        make DEBUG=0 GPIB=0
     96        sudo su
     97        make DEBUG=0 GPIB=0 install
     98        ldconfig
     99
     100Also, in order to use the CodeBlocks IDE project files without changes, you will need rename the CTB libraries.  Rename these by issuing these commands:
     101        cd /usr/local/lib
     102        mv libctb-0.14.a libctb-barrett-0.14.a
     103        mv libctb-0.14.so libctb-barrett-0.14.so
     104
     105
     1062) Build the POCO library.  Version 1.3.6 is the version that was tested and is included in thirdparty/sources).  You should also be able to download the latest version if you wish.
     107
     108Simple instructions are provided that will work for most users that do not already have a version of POCO installed.  If a different version of POCO is installed already see below for notes on how to setup a special minimal copy of POCO just for the BarrettHand.
     109
     110Do one of the following:
     111        - Download libpoco-dev using Synaptic Package Manager (version 1.3.3 or later)
     112        - Get a copy of the POCO source files (version 1.3.3 or later).  Use the version provided or download "The Economy Package" source code from http://pocoproject.org/download/
     113
     114Unpackage poco into a temporary directory
     115        gunzip poco-X.Y.tar.gz
     116        tar -xf poco-X.Y.tar
     117        cd poco-X.Y
     118
     119You only need to Build only the libraries that the BarrettHand Software requires
     120        ./configure --no-tests --no-samples --omit=XML,Util,Net
     121        make -s -j4 Foundation-libexec
     122        Install POCO to /usr/local
     123        sudo make -s Foundation-libexec install
     124
     125Also, in order to use the CodeBlocks IDE project files without changes, you will need rename the POCO library.  Rename it by issuing these commands:
     126        cd /usr/local/lib
     127        mv libPocoFoundation.so libPocoFoundationBarrett.so
     128
     129Notes on having multiple versions of POCO:
     130If you want to have a separate version of POCO just for the BarrettHand then don't execute sudo make -s Foundation-libexec install.  Instead, copy the header files to a location outside of /usr/local/include and include them when you build the API.  Also, rename the libPocoFoundation.so as shown above.  That file can be copied to /usr/local/lib manually.
     131
     132At this point you may compile the examples or continue the building dependencies for the GUI.
     133
     134If you want to build the BarrettHand Control GUI from the source files you will need to build these third party open source dependencies:
     135
     136
     1373) Install the wxWidgets library (2.8.10 or later)
     138
     139Open Synaptic Package Manager found in System -> Administration
     140
     141Select the following package and install it
     142        libwxgtk2.8-dev
     143
     144
     1454) Install OpenGL and GLUT
     146
     147Open Synaptic Package Manager found in System -> Administration
     148
     149Select and install the following package
     150        libglut3-dev
     151
     152
     153-------------------------------------------------------------
     154        Building the Examples
     155-------------------------------------------------------------
     156
     157To build Monitor Strain, RealTime, and Supervisory examples open a terminal.  The examples do not require the BarrettHand API library binary and instead directly include the BarrettHand source files.
     158
     159In the terminal:
     160
     161   1. CD to the example directory (examples/supervisory, examples/realtime, etc)
     162   2. Issue: "make" to build the example
     163   3. Run it with "./Supervisory" or whatever the output name is
     164
     165
     166-------------------------------------------------------------
     167        Code Blocks IDE
     168-------------------------------------------------------------
     169
     170Code Blocks is a cross platform IDE that may be used to build the BarrettHand Control GUI and/or the BarrettHand API Library.
     171
     172Open Synaptic Package Manager found in System -> Administration
     173
     174Select the following package and install it
     175        codeblocks
     176
     177
     1781) To build and run the BarrettHand Control GUI
     179        - Start CodeBlocks by launching it in Applications -> Programming -> Code::Blocks IDE
     180        - Open the CodeBlocks project file BHControl (in /usr/local/Barrett/BHand/bhcontrol/)
     181        - Select the build target: Build -> Build Target -> Linux Debug
     182        - Click Build -> Build and Run or press F9
     183
     1842) To build the BarrettHand API Library
     185        - Open the CodeBlocks project file BHand in the API directory
     186        - Select the build target: Build -> Build Target -> Linux Debug
     187        - Build by clicking Build -> Build
     188
     189
     190-------------------------------------------------------------
     191        Building the Demos
     192-------------------------------------------------------------
     193
     194To build bh45demo and ForceResponse demos first create the BarrettHand static library.  Follow the directions above for the CodeBlocks IDE and how to build the BarrettHand API Library.
     195
     196To build a single demo from the terminal:
     197
     198        1. CD to the demo directory (demos/bh45demo, demos/ForceResponse, etc)
     199        2. Issue: "make" to build the demo
     200
     201-------------------------------------------------------------
     202        Hardware Notes
     203-------------------------------------------------------------
     204
     205The BarrettHand API uses the CTB library for a cross-platform serial port library.  It only uses
     206the names /dev/ttyS0, /dev/ttyS1, etc.  If you want to use a USB to Serial adapter then one way
     207to do that would be to create a symbolic link from a Terminal:
     208
     209        rm /dev/ttyS0
     210        ln -s /dev/ttyUSB0 /dev/ttyS0
     211
     212To verify a serial connection with the Hand that is not dependent on the GUI you may use Minicom that may be downloaded with Synaptic Packet Manager.  It is a program for Linux that is similar to Hyperterminal.  Configure the baud rate, device name ("/dev/ttyS0", "/dev/ttyUSB0", etc.), and verify that commands such as "HI" can be sent to the hand.  Start minicom from a terminal with:
     213
     214        minicom -s
     215
     216To actually make the USB to serial adapter work after a reset, one way is to create a script as shown below and add it to /etc/init.d
     217
     218        #! /bin/sh
     219        rm /dev/ttyS0
     220        ln -s /dev/ttyUSB0 /dev/ttyS0
     221
     222and run:
     223        update-rc.d myusbtoserial.sh defaults
     224
     225-------------------------------------------------------------
     226        Installing PCAN
     227-------------------------------------------------------------
     228
     229The Debian package will install the PCAN USB adapter automatically.  If you are installing the driver yourself, you may follow these steps to use the PCAN driver:
     230
     2311. Create a symbolic link to the kernel header files
     232        - cd /usr/src
     233        - type uname -r to find out which linux kernel is being used
     234        - type ls and check to ensure the headers are available for this kernel (PCAN requires /usr/src/linux/include/linux/verson.h)
     235        - if you do not already have the symbolic link "linux" you may create it with ln -s linux-headers-2.6.31-14-generic linux (substitute your linux header's directory)
     236
     2372. Make and install PCAN library
     238        - cd peak-linux-driver-6.20
     239        - make NET=NO
     240        - su -c "make install"
     241
     2423. Load the PCAN loadable kernel module
     243        - cd driver
     244        - sudo modprobe pcan
     245
     246-------------------------------------------------------------
     247        Launching BHControl GUI ()
     248-------------------------------------------------------------
     249
     250Launching BHControl may require a known display and you may see an error similar to the one below.
     251
     252Xlib:  extension "GLX" missing on display ":0.0".
     253Xlib:  extension "GLX" missing on display ":0.0".
     254freeglut OpenGL GLX extension not supported by display ':0.0'
     255
     256Try to install graphics drivers so the that OpenGL will work for the GUI.  A search online for your version of Ubuntu and the graphics manufacturer will probably return useful information for installing these graphics drivers.  If you have Ubuntu 7.10 and an Nvidia card, you may try the Envy GUI found with the following link: http://linuxgamingtoday.wordpress.com/2008/01/24/install-nvidia-drivers-using-envy-in-ubuntu.