BarrettHand BH8-Series software setup - Windows
This 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.
MinGW "Minimalist GNU for Windows"
Install MinGW, "Minimalist GNU for Windows" (GPL + public domain)
- Download:
http://www.mingw.org -> Downloads -> Automated MinGW Installer (tested with version 5.1.4, released 2008-04-26)
- Install:
- MinGW base tools
- g++ compiler
- MinGW Make
- You will need to add the bin directory to your system's search path:
Control Panel -> System -> Advanced -> Environment Variables -> System Variables -> Path, add "C:\MinGW\bin" (or your MinGW bin path)
Windows Build Instructions for Third Party Dependencies
Install and build third party open source dependencies for the BarrettHand API Library:
1) Build the CTB Serial Port library and set the CTB environment variable
- Install SED from http://gnuwin32.sourceforge.net/packages/sed.htm
- Locate and run the script build_ctb.bat in "C:\Program Files\Barrett Technology\BHand\ThirdParty"
- This scipt will automatically issue "mingw32-make -f makefile.gcc DEBUG=0 GPIB=0" to build the CTB library
2) Build the POCO library
Find the source code:
- Locate the source code in "C:\Program Files\Barrett Technology\BHand\ThirdParty"
- Download the "The Economy Package" source code from http://pocoproject.org/
Example:
- Copy POCO libary to "C:\poco-1.3.6p2"
- Set the POCO_BASE environment variable to be "C:\poco-1.3.6p2"
- If you do not have Gawk for Windows download it from http://gnuwin32.sourceforge.net/packages/gawk.htm and install it
- Download MSYS (tested MSYS-1.0.11) from http://www.mingw.org and install it
- Launch MSYS (from the icon on the desktop) and issue
CD C:/poco-1.3.6p2 ./configure --config=MinGW --no-tests --no-samples --omit=XML,Util,Net make -s -j4 Foundation-libexec
At this point you may compile the examples and/or continue building dependencies for the GUI.
If you want to build the BarrettHand Control GUI from the source files you will need to build these third party open source dependencies:
3) Build the wxWidgets library (tested with 2.8.11)
Find the source code:
- Locate wxMSW-2.8.11-Setup.exe windows installer in "C:\Program Files\Barrett Technology\BHand\ThirdParty"
- Download wxMSW with the installer for Windows from http://www.wxwidgets.org/
The debug and release libraries still need to be built for MingGW. Follow these steps:
- Edit wxWidgets-2.8.11\include\wx\msw\setup.h and change the #define wxUSE_GLCANVAS 0 to #define wxUSE_GLCANVAS 1
- Also change the line that defines wxWIN_COMPATIBILITY from 1 to 0
- Open a command prompt and issue the following commands
- CD C:\wxWidgets-2.8.11\build\msw
- mingw32-make -f makefile.gcc SHARED=0 UNICODE=0 USE_OPENGL=1
- mingw32-make -f makefile.gcc SHARED=0 BUILD=release UNICODE=0 USE_OPENGL=1
- Set the WXWIN environment variable to be C:\wxWidgets-2.8.11 or the correct path
4) Setup MinGW to include Glut header file
You may find the GLUT binaries for development (version 3.7.6) in the ThirdParty\glut-3.7.6-bin directory.
- Place glut.h in C:\MinGW\include\GL
Notes:
- 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
- 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.
Building the Examples
To 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.
Alternatively, to build directly from the command prompt:
- CD to the example directory (examples/supervisory, examples/realtime, etc)
- Issue: "mingw32-make ARCH=windows" to build the example
Note: The POCO_BASE environment variable must be set to the directories of these dependencies.
Code Blocks IDE
Code Blocks is a cross platform IDE that may be used to build the BarrettHand Control GUI and/or the BarrettHand API Library.
Download the binary release WITHOUT MinGW from http://www.codeblocks.org/downloads
1) To build the BarrettHand Control GUI
- Open the CodeBlocks project file BHControl
- Select the build target: Build -> Build Target -> Windows Debug
- Build by clicking Build -> Build and Run or press F9
2) To build the BarrettHand API Library
- Open the CodeBlocks project file BHand
- Select the build target: Build -> Build Target -> Windows Release
- Build by clicking Build -> Build
Note: 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.
Building the Demos
To 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.
To build a single demo from the command prompt:
- CD to the demo directory (demos/bhdemo45, demos/ForceResponse, etc)
- Issue: "mingw32-make ARCH=windows" to build the demo
Note: The POCO_BASE environment variable must be set to the directories of these dependencies.
Visual C++ 2008 Express Edition
If you don't have Visual C++ and would like to use the express edition then you may download it from:
http://www.microsoft.com/express/Downloads/#2008-Visual-CPP -> Visual Studio 2008 Express -> Free Download
The 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.
Build wxWidgets:
- Open Windows Explorer and open wxWidgets-2.8.11\build\msw\wx.dsw
- Select Build -> Configuration Manager -> Active solution configuration -> Release
- Right-click Solution 'wx' and do Build Solution (do this twice so that all projects are built)
- Set the WXWIN environment variable to be C:\wxWidgets-2.8.11 or the correct path
Build the POCO library:
- Navigate to C:\poco-1.3.6\Foundation
- Open Foundation_vs90.vcproj
- Select Build -> Configuration Manager -> Active solution configuration -> release_shared
- Right-click the Foundation project and then Build
- Copy C:\poco-1.3.6\bin\PocoFoundation.dll to C:\Windows\system32
Build the CTB library (optional step - you should already have this lib):
- Navigate to ctb-0.14\build
- run nmake -f makefile.vc DEBUG=0 GPIB=0
Open BHControl.sln which should be located in C:\Program Files\Barrett Technology\BHand\BHControl
- Select the Release configuration (debug build of the GUI in Visual Studio does not build)
- Right-click BHControl project in Solution Explorer and select Build