Changes between Version 1 and Version 2 of Hand/280/SoftwareSetup/Linux


Ignore:
Timestamp:
Jul 7, 2015, 8:12:36 PM (9 years ago)
Author:
bz
Comment:

--

Legend:

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

    v1 v2  
    88
    99In 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 
     10{{{
    1111deb http://old-releases.ubuntu.com/ubuntu/ gutsy main universe multiverse
    1212deb http://old-releases.ubuntu.com/ubuntu/ gutsy-updates main universe multiverse
    1313deb http://old-releases.ubuntu.com/ubuntu/ gutsy-security main universe multiverse
    14 
     14}}}
    1515If the BarrettHand software is installed using the Debian package it will be in the directory:
    16 
    17         /usr/local/Barrett/BHand
    18 
     16{{{
     17/usr/local/Barrett/BHand
     18}}}
    1919If 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 
     20{{{
     21cd /usr/local/Barrett/BHand/examples/Supervisory
     22./Supervisory
     23}}}
    2424The 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 
     25{{{
     26make clean
     27make
     28}}}
    2929When 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 
     30{{{
     31cd /usr/local/Barrett/BHand/bhcontrol
     32./BHControl
     33}}}
    3434The !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 
     35{{{
     36cd Desktop/codeblocks-8.02-src
     37./configure
     38make -j4
     39make install
     40ldconfig
     41}}}
    4242You 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.
    4343
     
    6262
    6363The 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 
     64{{{
     65libctb-barrett-0.14.a
     66libctb-barrett-0.14.so
     67libPocoFoundationBarrett.so
     68}}}
    6969Notice 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.
    7070
     
    8080
    8181If you do not already have the build-essential package installed then you may install it from a terminal using the following line:
    82 
     82{{{
    8383sudo apt-get install build-essential
    84 
     84}}}
    8585-------------------------------------------------------------
    8686        Installing Third Party Dependencies for Ubuntu
     
    9292
    9393Open 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 
     94{{{
     95cd thirdparty/sources/ctb-0.14/build
     96make DEBUG=0 GPIB=0
     97sudo su
     98make DEBUG=0 GPIB=0 install
     99ldconfig
     100}}}
    100101Also, 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 
     102{{{     
     103cd /usr/local/lib
     104mv libctb-0.14.a libctb-barrett-0.14.a
     105mv libctb-0.14.so libctb-barrett-0.14.so
     106}}}
    105107
    1061082) 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.
     
    113115
    114116Unpackage 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 
     117{{{
     118gunzip poco-X.Y.tar.gz
     119tar -xf poco-X.Y.tar
     120cd poco-X.Y
     121}}}
    119122You 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 
     123{{{
     124./configure --no-tests --no-samples --omit=XML,Util,Net
     125make -s -j4 Foundation-libexec
     126}}}
     127Install POCO to /usr/local
     128{{{
     129sudo make -s Foundation-libexec install
     130}}}
    125131Also, 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 
     132{{{
     133cd /usr/local/lib
     134mv libPocoFoundation.so libPocoFoundationBarrett.so
     135}}}
    129136Notes on having multiple versions of POCO:
    130137If 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.
     
    206213the names /dev/ttyS0, /dev/ttyS1, etc.  If you want to use a USB to Serial adapter then one way
    207214to 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 
     215{{{
     216rm /dev/ttyS0
     217ln -s /dev/ttyUSB0 /dev/ttyS0
     218}}}
    212219To 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 
     220{{{
     221minicom -s
     222}}}
    216223To 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 
     224{{{
     225#! /bin/sh
     226rm /dev/ttyS0
     227ln -s /dev/ttyUSB0 /dev/ttyS0
     228}}}
    222229and run:
    223         update-rc.d myusbtoserial.sh defaults
    224 
     230{{{
     231update-rc.d myusbtoserial.sh defaults
     232}}}
    225233-------------------------------------------------------------
    226234        Installing PCAN
     
    230238
    2312391. 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 
     240{{{
     241cd /usr/src
     242uname -r (to find out which linux kernel is being used)
     243ls (check to ensure the headers are available for this kernel, PCAN requires /usr/src/linux/include/linux/verson.h)
     244}}}
     245If you do not already have the symbolic link "linux" you may create it with:
     246{{{
     247ln -s linux-headers-2.6.31-14-generic linux (substitute your linux header's directory)
     248}}}
    2372492. Make and install PCAN library
    238         - cd peak-linux-driver-6.20
    239         - make NET=NO
    240         - su -c "make install"
     250{{{
     251cd peak-linux-driver-6.20
     252make NET=NO
     253su -c "make install"
     254}}}
    241255
    2422563. Load the PCAN loadable kernel module
    243         - cd driver
    244         - sudo modprobe pcan
     257{{{
     258cd driver
     259sudo modprobe pcan
     260}}}
    245261
    246262-------------------------------------------------------------