Changes between Version 2 and Version 3 of Hand/262/SoftwareSetup/Windows


Ignore:
Timestamp:
May 12, 2011, 7:17:45 PM (14 years ago)
Author:
edison
Comment:

--

Legend:

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

    v2 v3  
    1 = BarrettHand BH8-262 software setup - Linux =
    2 == !Ubuntu/Debian ==
    3 The 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.
     1= BarrettHand BH8-262 software setup - Windows =
     2This file describes how to build the BarrettHand Control GUI, BarrettHand API Library, Examples, and Demos from the provided source files.  The necessary third party headers and libraries (CTB serial port library, POCO, and wxWidgets) are included in the Windows installer to reduce the effort in compiling the source files for the hand with MinGW and Visual C++ 2008.  The instructions for building these libraries from source code are included below.  Windows XP or later is required (32-bit version) and the Peak drivers for the USB to CAN adapter if using a BH8-280 hand.
    43
    5 ----------------------------------------------------------------------------
    6         Using the BarrettHand software and notes for the Debian Package
    7 ----------------------------------------------------------------------------
    84
    9 In 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.
     5== MinGW "Minimalist GNU for Windows" ==
    106
    11 deb http://old-releases.ubuntu.com/ubuntu/ gutsy main universe multiverse
    12 deb http://old-releases.ubuntu.com/ubuntu/ gutsy-updates main universe multiverse
    13 deb http://old-releases.ubuntu.com/ubuntu/ gutsy-security main universe multiverse
    147
    15 If the BarrettHand software is installed using the Debian package it will be in the directory:
     8Install MinGW, "Minimalist GNU for Windows" (GPL + public domain)
    169
    17         /usr/local/Barrett/BHand
     10  1. Download:
     11      http://www.mingw.org -> Downloads -> Automated MinGW Installer
     12      (tested with version 5.1.4, released 2008-04-26)
     13 
     14  2. Install:
     15      - MinGW base tools
     16      - g++ compiler
     17      - MinGW Make
     18 
     19  3. You will need to add the bin directory to your system's search path:
     20      Control Panel -> System -> Advanced -> Environment Variables ->
     21      System Variables -> Path, add "C:\MinGW\bin" (or your MinGW bin path)
    1822
    19 If 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:
    2023
    21         cd /usr/local/Barrett/BHand/examples/Supervisory
    22         ./Supervisory
    2324
    24 The 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== Windows Build Instructions for Third Party Dependencies ==
    2526
    26         make clean
    27         make
    28 
    29 When 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 
    34 The !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 
    42 You 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 
    44 To 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 
    52 The 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 
    54 To 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 
    63 The 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 
    69 Notice 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 
    75 The 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 
    81 If you do not already have the build-essential package installed then you may install it from a terminal using the following line:
    82 
    83 sudo apt-get install build-essential
    84 
    85 -------------------------------------------------------------
    86         Installing Third Party Dependencies for Ubuntu
    87 -------------------------------------------------------------
    8827
    8928Install and build third party open source dependencies for the BarrettHand API Library:
    9029
    91 1) 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.
     301) Build the CTB Serial Port library and set the CTB environment variable
    9231
    93 Open 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 
    100 Also, 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
     32- Install SED from http://gnuwin32.sourceforge.net/packages/sed.htm
     33- Locate and run the script build_ctb.bat in "C:\Program Files\Barrett Technology\BHand\ThirdParty"
     34        - This scipt will automatically issue "mingw32-make -f makefile.gcc DEBUG=0 GPIB=0" to build the CTB library
    10435
    10536
    106 2) 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.
     372) Build the POCO library
    10738
    108 Simple 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.
     39Find the source code:
     40- Locate the source code in "C:\Program Files\Barrett Technology\BHand\ThirdParty"
     41- Download the "The Economy Package" source code from http://pocoproject.org/
    10942
    110 Do 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/
     43Example:
     44- Copy POCO libary to "C:\poco-1.3.6p2"
     45- Set the POCO_BASE environment variable to be "C:\poco-1.3.6p2"
     46- If you do not have Gawk for Windows download it from http://gnuwin32.sourceforge.net/packages/gawk.htm and install it
     47- Download MSYS (tested MSYS-1.0.11) from http://www.mingw.org and install it
     48- Launch MSYS (from the icon on the desktop) and issue
    11349
    114 Unpackage poco into a temporary directory
    115         gunzip poco-X.Y.tar.gz
    116         tar -xf poco-X.Y.tar
    117         cd poco-X.Y
     50        CD C:/poco-1.3.6p2
     51        ./configure --config=MinGW --no-tests --no-samples --omit=XML,Util,Net
     52        make -s -j4 Foundation-libexec
    11853
    119 You 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 
    125 Also, 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 
    129 Notes on having multiple versions of POCO:
    130 If 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 
    132 At this point you may compile the examples or continue the building dependencies for the GUI.
     54At this point you may compile the examples and/or continue building dependencies for the GUI.
    13355
    13456If you want to build the BarrettHand Control GUI from the source files you will need to build these third party open source dependencies:
    13557
    13658
    137 3) Install the wxWidgets library (2.8.10 or later)
     593) Build the wxWidgets library (tested with 2.8.11)
    13860
    139 Open Synaptic Package Manager found in System -> Administration
     61Find the source code:
     62- Locate wxMSW-2.8.11-Setup.exe windows installer in "C:\Program Files\Barrett Technology\BHand\ThirdParty"
     63- Download wxMSW with the installer for Windows from http://www.wxwidgets.org/
    14064
    141 Select the following package and install it
    142         libwxgtk2.8-dev
     65The debug and release libraries still need to be built for MingGW.  Follow these steps:
     66- Edit wxWidgets-2.8.11\include\wx\msw\setup.h and change the #define wxUSE_GLCANVAS 0 to #define wxUSE_GLCANVAS 1
     67- Also change the line that defines wxWIN_COMPATIBILITY from 1 to 0
     68- Open a command prompt and issue the following commands
     69- CD C:\wxWidgets-2.8.11\build\msw
     70- mingw32-make -f makefile.gcc SHARED=0 UNICODE=0 USE_OPENGL=1
     71- mingw32-make -f makefile.gcc SHARED=0 BUILD=release UNICODE=0 USE_OPENGL=1
     72- Set the WXWIN environment variable to be C:\wxWidgets-2.8.11 or the correct path
    14373
    14474
    145 4) Install OpenGL and GLUT
     754) Setup MinGW to include Glut header file
    14676
    147 Open Synaptic Package Manager found in System -> Administration
     77You may find the GLUT binaries for development (version 3.7.6) in the ThirdParty\glut-3.7.6-bin directory.
    14878
    149 Select and install the following package
    150         libglut3-dev
     79- Place glut.h in C:\MinGW\include\GL
     80
     81Notes:
     82- This instruction was taken from the guide for using GLUT with the MinGW compiler at http://www.mingw.org/wiki/HOWTO_Use_Mark_J_Kilgards_OpenGL_Utility_Toolkit_GLUT_with_MinGW
     83- The file glut32.lib is in the "ThirdParty\glut-3.7.6-bin" directory and the glut32.dll is in the copied to the system directory during installation.
    15184
    15285
    153 -------------------------------------------------------------
    154         Building the Examples
    155 -------------------------------------------------------------
    156 
    157 To 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 
    159 In 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
     86== Building the Examples ==
    16487
    16588
    166 -------------------------------------------------------------
    167         Code Blocks IDE
    168 -------------------------------------------------------------
     89To build or rebuild Monitor Strain, RealTime, and Supervisory examples run the "make_examples" batch file located in the examples directory.  The examples do not require the BarrettHand API Library because they include the BarrettHand source files.
     90
     91Alternatively, to build directly from the command prompt:
     92
     93  1. CD to the example directory (examples/supervisory, examples/realtime, etc)
     94  2. Issue: "mingw32-make ARCH=windows" to build the example
     95
     96Note: The POCO_BASE environment variable must be set to the directories of these dependencies.
     97
     98
     99== Code Blocks IDE ==
     100
    169101
    170102Code Blocks is a cross platform IDE that may be used to build the BarrettHand Control GUI and/or the BarrettHand API Library.
    171103
    172 Open Synaptic Package Manager found in System -> Administration
     104Download the binary release WITHOUT MinGW from http://www.codeblocks.org/downloads
    173105
    174 Select the following package and install it
    175         codeblocks
     1061) To build the BarrettHand Control GUI
     107- Open the CodeBlocks project file BHControl
     108- Select the build target: Build -> Build Target -> Windows Debug
     109- Build by clicking Build -> Build and Run or press F9
     110
     1112) To build the BarrettHand API Library
     112- Open the CodeBlocks project file BHand
     113- Select the build target: Build -> Build Target -> Windows Release
     114- Build by clicking Build -> Build
     115
     116Note: If the POCO or wxWidgets dependencies were installed to other locations you will need to modify the CodeBlocks project files so that the header and library files can be found.
    176117
    177118
    178 1) 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 
    184 2) 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
     119== Building the Demos ==
    188120
    189121
    190 -------------------------------------------------------------
    191         Building the Demos
    192 -------------------------------------------------------------
     122To build bhdemo45 and Force Response demos run the "make_demos" batch file located in the demos directory.  The demos require the BarrettHand API Library and also illustrates it being used in a Makefile.
    193123
    194 To 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.
     124To build a single demo from the command prompt:
    195125
    196 To build a single demo from the terminal:
     126  1. CD to the demo directory (demos/bhdemo45, demos/ForceResponse, etc)
     127  2. Issue: "mingw32-make ARCH=windows" to build the demo
    197128
    198         1. CD to the demo directory (demos/bh45demo, demos/ForceResponse, etc)
    199         2. Issue: "make" to build the demo
     129Note: The POCO_BASE environment variable must be set to the directories of these dependencies.
    200130
    201 -------------------------------------------------------------
    202         Hardware Notes
    203 -------------------------------------------------------------
    204131
    205 The BarrettHand API uses the CTB library for a cross-platform serial port library.  It only uses
    206 the names /dev/ttyS0, /dev/ttyS1, etc.  If you want to use a USB to Serial adapter then one way
    207 to do that would be to create a symbolic link from a Terminal:
     132== Visual C++ 2008 Express Edition ==
    208133
    209         rm /dev/ttyS0
    210         ln -s /dev/ttyUSB0 /dev/ttyS0
    211134
    212 To 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:
     135If you don't have Visual C++ and would like to use the express edition then you may download it from:
    213136
    214         minicom -s
     137   http://www.microsoft.com/express/Downloads/#2008-Visual-CPP -> Visual Studio 2008 Express -> Free Download
    215138
    216 To 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
     139The following build instructions should be sufficient to build third party dependencies required by the BHControl Visual Studio Solution.  However, they were tested on a system setup for using the MinGW compiler for building all the software described above.
    217140
    218         #! /bin/sh
    219         rm /dev/ttyS0
    220         ln -s /dev/ttyUSB0 /dev/ttyS0
     141   Build wxWidgets:
     142      - Open Windows Explorer and open wxWidgets-2.8.11\build\msw\wx.dsw
     143      - Select Build -> Configuration Manager -> Active solution configuration -> Release
     144      - Right-click Solution 'wx' and do Build Solution (do this twice so that all projects are built)
     145      - Set the WXWIN environment variable to be C:\wxWidgets-2.8.11 or the correct path
    221146
    222 and run:
    223         update-rc.d myusbtoserial.sh defaults
     147   Build the POCO library:
     148      - Navigate to C:\poco-1.3.6\Foundation
     149      - Open Foundation_vs90.vcproj
     150      - Select Build -> Configuration Manager -> Active solution configuration -> release_shared
     151      - Right-click the Foundation project and then Build
     152      - Copy C:\poco-1.3.6\bin\PocoFoundation.dll to C:\Windows\system32
    224153
    225 -------------------------------------------------------------
    226         Installing PCAN
    227 -------------------------------------------------------------
     154   Build the CTB library (optional step - you should already have this lib):
     155      - Navigate to ctb-0.14\build
     156      - run nmake -f makefile.vc DEBUG=0 GPIB=0
    228157
    229 The 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 
    231 1. 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 
    237 2. Make and install PCAN library
    238         - cd peak-linux-driver-6.20
    239         - make NET=NO
    240         - su -c "make install"
    241 
    242 3. Load the PCAN loadable kernel module
    243         - cd driver
    244         - sudo modprobe pcan
    245 
    246 -------------------------------------------------------------
    247         Launching BHControl GUI ()
    248 -------------------------------------------------------------
    249 
    250 Launching BHControl may require a known display and you may see an error similar to the one below.
    251 
    252 Xlib:  extension "GLX" missing on display ":0.0".
    253 Xlib:  extension "GLX" missing on display ":0.0".
    254 freeglut OpenGL GLX extension not supported by display ':0.0'
    255 
    256 Try 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.
    257 
     158   Open BHControl.sln which should be located in C:\Program Files\Barrett Technology\BHand\BHControl
     159      - Select the Release configuration (debug build of the GUI in Visual Studio does not build)
     160      - Right-click BHControl project in Solution Explorer and select Build