«

»

Feb 06

How to build iSam under Windows

Due to ill fate I need to quickly build iSam for using it into existing project as SLAM backend. Under Windows 🙁 In this article I want to share my experience.

iSam under Windows

iSam under Windows

Disclaimer: I am sure that such way is not optimal and express “best practices”, so, in case you have enough time – better to avoid such strategy of quick fixes. But I hope that provided methods can be useful and probably can force some one to add appropriate patches to iSam or SuiteSparse.

Let’s start.

1. Firstly, you need acquire necessary dependencies. Download Eigen, boost, cmake-gui and cygwin.
For building sdl under windows you need dxguid.lib which can be found in DirectX SDK.

2. SDL – can be build under Windows out of box without any problems
just download it from the site above and follow build instructions.

3. Download and buid SuiteSparse – you can find patch and build instruction for Windows here – here.

4. Download patch for building iSam under Windows – isam_win.diff

4. checkout iSam library from svn repository:
svn co https://svn.csail.mit.edu/isam

5. pray for all gods and apply patch from cygwin’s command line:
cd Your-root-directory/iSam-folder
patch -p2 <../isam_win.diff

6. Run cmake-gui and set it up to iSam.

Enable “advanced mode” checkbox. Push “Configure” button.
At every step it will complain that something is not found – point it out manually.

1) set up SDL path:
include directory,
path to SDLMain.lib and SDL.lib
2) check USE_GUI box
3) add Eigen include folder
4) Add CHOLMOD include path and path to libcholmod.lib
5) path to CXSParse library – libsxsparse.lib

After that you can generate VS project solution.
But wait!
You still need to perform some tuning to all sub-projects:

For isamlib project
add following include path:
1) path to cs.h (SuiteSparce/CXSparse)
2) path to SuiteSparce_config.h (SuiteSparce/SuiteSparce_config)

For sub-projects isam, addRemove, anchorNodes, covariances, stereo, example add following libraries (from SuiteSparse package) for linking:
1) libcolamd.lib
2) libamd.lib

For isam sub-project you should manually add source containing getopt routine – file isam/xgetopt.cpp from this package. Actually you can use any implementation, for example from lcm library.

For generateSpheresICRA2012 projects add include path to boost/include.

After that it should compile.

Note: by default it doesn’t create dynamic library. If you need isam.dll you have to manually change isamlib project configuration type (Properties->General) from “static library” to “Dynamic library” and add libcolamd/libamd libraries for linking.

Short patch overview:
1) covariance.cpp – header fix
2) utils.cpp – added gettimeofday functions
3) files Node.cpp, Factor.cpp with implementation of constructor are added to isamlib project
4) slam.cpp, cholesky.cpp dynamic allocation is added (instead of C99 standards check for example this)
5) Loader.cpp, Viewer.cpp – added fix for include
6) Collections.cpp – use glEnable(GL_NORMALIZE) instead of GL_RESCALE_NORMAL (because by default on Windows is installed opengl 1.1 check this)
7) isam.cpp – added windows specific main functions (check this)
8) added XGetOpt.h/XGetOpt.c from http://www.codeproject.com/Articles/1940/XGetopt-A-Unix-compatible-getopt-for-MFC-and-Win32
9) added Windows specific exports to almost all classes

Why do you have to edit some iSam sources:
http://thetweaker.wordpress.com/2010/05/05/stdvector-of-aligned-elements/
http://eigen.tuxfamily.org/dox/TopicStlContainers.html
http://www.mcs.anl.gov/research/projects/mpi/mpich1-old/docs/mpichntman/node10.htm

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>